Dynamic element text item :

First : If the parent element of the text item is a slave,
the info use to create the text (both if option are 'element info' or 'composite text') are taken to the linked master element, and not the slave.
If the salve element is not linked, no information is taken.
Second : if the text is composed with the variable 'label' of the master (both if text from are 'element info' or 'composite text') double click on the text, act like a link and go to the master.



git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5035 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-08-29 14:54:27 +00:00
parent 31775871a4
commit 5248c891f4
7 changed files with 172 additions and 42 deletions

View File

@@ -56,18 +56,23 @@ void SlaveElement::linkToElement(Element *elmt)
// check if element is master and if isn't already linked
if (elmt->linkType() == Master && !connected_elements.contains(elmt))
{
if(!isFree()) unlinkAllElements();
this->disconnect();
if(!isFree())
unlinkAllElements();
for(QMetaObject::Connection c : m_connections)
this->disconnect(c);
m_connections.clear();
connected_elements << elmt;
QETProject *project = elmt->diagram()->project();
connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
connect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
connect(elmt, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)), this, SLOT(updateLabel()));
connect(project, SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
connect(project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel()));
connect(project, SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel()));
connect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
m_connections << connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
m_connections << connect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
m_connections << connect(elmt, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)), this, SLOT(updateLabel()));
m_connections << connect(project, SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
m_connections << connect(project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel()));
m_connections << connect(project, SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel()));
m_connections << connect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
updateLabel();
elmt -> linkToElement(this);