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, 284 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, 277 downloads since 2019-07-20 

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.

Développeur QElectroTech

Re: feature set xref slave position

it is from 0.70rc2 tag

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, 279 downloads since 2019-07-22 

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

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

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

Développeur QElectroTech

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, 297 downloads since 2019-07-30 

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

Développeur QElectroTech

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, 285 downloads since 2019-08-01 

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

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

Développeur QElectroTech

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

Re: feature set xref slave position

Hello Stromie,

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

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

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.

Re: feature set xref slave position

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

Développeur QElectroTech

Re: feature set xref slave position

Hi Joshua

i have fixe the point 2.
I am still new to Git. I tried to make a pull request

Re: feature set xref slave position

Hi Stromie,

sync your fork to mirror first, and create Pull request :
https://help.github.com/en/articles/cre … ll-request

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: feature set xref slave position

Hi Stromie,

I can't add your Pull request your repository isn't up to date synced to master mirror and it remove some works.
wget https://github.com/qelectrotech/qelectr … l/11.patch

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: feature set xref slave position

Hello Stromie, thanks added your work.
If user choose textitem alignment the change isn't on the fly, need to reload project to take change, you can fix it?

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: feature set xref slave position

Hello



I have to see how I can trigger an update when changing. I will fix it.

Re: feature set xref slave position

Hi, 
please use this tabs policy for indentations. ;-)
https://download.qelectrotech.org/qet/forum_img/qtcreator_tabs_config.png

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: feature set xref slave position

Hi Stromie,

if user set in project config Xrefs "text alignment" for manual editing text position by item, all Xrefs is moved to Top, please add Bottom by default.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: feature set xref slave position

Thanks to your contribution nomicons/smile

Développeur QElectroTech

Re: feature set xref slave position

Ok, found !, In the general configuration of QET, the Xref_slave for all projects was badly defined on Top and override the one defined in the project configuration if I choose text alignment. It's my fault and I could have searched long time in the code, sorry for the noise. nomicons/blush

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."