mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-20 10:39:59 +01:00
master element: add auto label when "comment" isn't empty and must show
element info widget -> comment line: must show is checked by default git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2951 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -30,6 +30,7 @@ MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qg
|
||||
{
|
||||
link_type_ = Master;
|
||||
cri_ = 0;
|
||||
connect(this, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +39,7 @@ MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qg
|
||||
*/
|
||||
MasterElement::~MasterElement() {
|
||||
unlinkAllElements();
|
||||
disconnect(this, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,3 +94,17 @@ void MasterElement::unlinkElement(Element *elmt) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MasterElement::updateLabel
|
||||
* update label of this element
|
||||
*/
|
||||
void MasterElement::updateLabel() {
|
||||
QString label = elementInformations()["label"].toString();
|
||||
bool show = elementInformations().keyMustShow("label");
|
||||
|
||||
// setup the label
|
||||
(label.isEmpty() || !show)?
|
||||
setTaggedText("label", "_", false):
|
||||
setTaggedText("label", label, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user