1

Topic: feature set xref slave position

I have

i have now the problem that in dynamicelementtextitem.cpp

void DynamicElementTextItem::setPlainText(const QString &text)
{
    if (toPlainText() == text)
        return;
    ...
        else if (m_slave_Xref_item)
    {
        QRectF r = boundingRect();
        QPointF pos(r.center().x() - m_slave_Xref_item->boundingRect().width()/2,
                    r.bottom());
        m_slave_Xref_item->setPos(pos);
    }

I can not reference xrefProperties xrp = diagra...referencing

Post's attachments

Menu.PNG, 8.14 kb, 792 x 161
Menu.PNG 8.14 kb, 10 downloads since 2019-07-20 

2 (edited by stromie 2019-07-20 14:10:43)

Re: feature set xref slave position

now the code, it is not ready

Post's attachments

Attachment icon XrefSlavePos.patch 13.45 kb, 11 downloads since 2019-07-20 

3

Re: feature set xref slave position

Ok I read the patch but don't try (I've got an issue to patch).
Everything look good, what exactly your problem ?
I try tomorrow to apply the patch and test it.

4

Re: feature set xref slave position

it is from 0.70rc2 tag

5

Re: feature set xref slave position

Yes off course is a patch based on old Subversion, please use 

git clone git://git.tuxfamily.org/gitroot/qet/qet.git qet_git

Or fork https://github.com/qelectrotech/qelectr … rce-mirror

Post's attachments

Attachment icon XrefSlavePos.patch 14.24 kb, 10 downloads since 2019-07-22 

6

Re: feature set xref slave position

my problem is, the m_slave_Xref_item->SetPos will put in two function. 
1. void DynamicElementTextItem::updateXref()
2. void DynamicElementTextItem::setPlainText(const QString &text)

in 1 i have 

XRefProperties xrp = diagram()->project()->defaultXRefProperties(m_parent_element.data()->kindInformations()["type"].toString());

the Xrp variable has the info about the XrefPos

but in 2 there is not xrp

7

Re: feature set xref slave position

Why did you don't call it ?
write

XRefProperties xrp = diagram()->project()->defaultXRefProperties(m_parent_element.data()->kindInformations()["type"].toString());

in the method

DynamicElementTextItem::setPlainText

and everything work very well.

May be it would be better to create a new method something like

DynamicElementTextItem::updateSlaveXrefPos

because the code for adjust the pos is bigger than before and take a lot of place in these two methods.

I try it, very good nomicons/wink

8

Re: feature set xref slave position

thanks Joshua



I had tried it on the weekend ever before with the insertion. But the program crashed. Today noticed that I have inserted it in the wrong place. Will finish it this week

9 (edited by stromie 2019-07-30 18:17:33)

Re: feature set xref slave position

I have a version ready. I hope that fits.

Post's attachments

Attachment icon XrefSlavePos.patch 14.24 kb, 14 downloads since 2019-07-30 

10

Re: feature set xref slave position

Ok, I haven't got time this week, but I will check your patch this weekend.
Thanks nomicons/smile

11

Re: feature set xref slave position

Hi Stromie,

great ! I tried your patch and it work well.
If you could keep source code  indentation tabs, like this edited patch. ;-)

Post's attachments

Attachment icon XrefSlavePos_1.patch 12.81 kb, 11 downloads since 2019-08-01 

12

Re: feature set xref slave position

Ok look good.
Just some little thing and after what, we can push your patch to qet nomicons/smile

1. Instead of use your own enum for left/right etc... you should use enum provide by Qt https://doc.qt.io/qt-5/qt.html#AlignmentFlag-enum I know there is not something for PosTextAignment but instead you can use AlignJustify or AlignBaseLine which in this case we are sure to not use it for a sixth alignment.
2. When use Qt enum we also can use QMetaEnum for a lot of thing and for us, get the name of the enum as a string to write it in the setting or the xml.
See dynamic element text item to/from xml to get an example.
3. When set pos to right, the Xref is far from the label

13 (edited by stromie 2019-08-04 16:39:49)

Re: feature set xref slave position

Thanks for testing

1. ok i use it
2. I have tried it but I have to look at me again in peace
3. i have fix it

https://github.com/stromie/qelectrotech-source-mirror

14

Re: feature set xref slave position

Hello Stromie,

you could sync your repository to QET mirror and make a Pull request, thanks.

15

Re: feature set xref slave position

Hello Scorpio810

Currently I am still trying to edit point 2 by Joshua. I'm not quite getting there yet.

16

Re: feature set xref slave position

Hello Stromie,
if you want some help, I can help you here or by mail.