mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-13 20:59:58 +01:00
Display Location Field in Diagram and assign Folio Variables to Element's Information Fields
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4546 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -28,7 +28,8 @@
|
||||
*/
|
||||
SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
|
||||
CustomElement(location, qgi, state),
|
||||
m_comment_item (nullptr)
|
||||
m_comment_item (nullptr),
|
||||
m_location_item (nullptr)
|
||||
{
|
||||
link_type_ = Simple;
|
||||
connect(this, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)), this, SLOT(updateLabel(DiagramContext, DiagramContext)));
|
||||
@@ -88,14 +89,16 @@ void SimpleElement::updateLabel(DiagramContext old_info, DiagramContext new_info
|
||||
new_info["label"].toString().isEmpty() ? eti->setVisible(true) : eti -> setVisible(new_info.keyMustShow("label"));
|
||||
}
|
||||
|
||||
//Comment of element
|
||||
//Comment and Location of element
|
||||
QString comment = new_info["comment"].toString();
|
||||
bool must_show = new_info.keyMustShow("comment");
|
||||
QString location = new_info["location"].toString();
|
||||
bool must_show_location = new_info.keyMustShow("location");
|
||||
|
||||
if (!(comment.isEmpty() || !must_show) && !m_comment_item) {
|
||||
if ((!(comment.isEmpty() || !must_show) && !m_comment_item)||(!(location.isEmpty() || !must_show_location) && !m_comment_item)) {
|
||||
m_comment_item = new CommentItem(this);
|
||||
}
|
||||
else if ((comment.isEmpty() || !must_show) && m_comment_item) {
|
||||
else if (((comment.isEmpty() || !must_show) && m_comment_item) && ((location.isEmpty() || !must_show_location) && m_comment_item)) {
|
||||
delete m_comment_item;
|
||||
m_comment_item = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user