From 521c495ef0f278646c013688b53832e7bb1794ab Mon Sep 17 00:00:00 2001 From: blacksun Date: Tue, 10 Jan 2017 09:09:30 +0000 Subject: [PATCH] Minor : Element info widget : when editing the field formula, the field label must be disable. Only work when element info widget is in the dock, but not with the dialog : fix it. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4839 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/ui/elementinfowidget.cpp | 40 +++++++++++++------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/sources/ui/elementinfowidget.cpp b/sources/ui/elementinfowidget.cpp index 76520fa14..03f646fc9 100644 --- a/sources/ui/elementinfowidget.cpp +++ b/sources/ui/elementinfowidget.cpp @@ -64,6 +64,22 @@ void ElementInfoWidget::setElement(Element *element) m_element = element; updateUi(); + ElementInfoPartWidget *f = infoPartWidgetForKey("formula"); + ElementInfoPartWidget *l = infoPartWidgetForKey("label"); + + if (f && l) + { + if (f->text().isEmpty()) + l->setEnabled(true); + else + l->setDisabled(true); + + connect(f, &ElementInfoPartWidget::textChanged, [l](const QString text) + { + l->setEnabled(text.isEmpty()? true : false); + }); + } + connect(m_element, &Element::elementInfoChange, this, &ElementInfoWidget::elementInfoChange); } @@ -75,20 +91,7 @@ void ElementInfoWidget::setElement(Element *element) void ElementInfoWidget::apply() { if (QUndoCommand *undo = associatedUndo()) - { m_element -> diagram() -> undoStack().push(undo); - - ElementInfoPartWidget *f = infoPartWidgetForKey("formula"); - ElementInfoPartWidget *l = infoPartWidgetForKey("label"); - - if (f && l) - { - if (f->text().isEmpty()) - l->setEnabled(true); - else - l->setDisabled(true); - } - } } /** @@ -232,17 +235,6 @@ void ElementInfoWidget::updateUi() eipw->setHideShow(true); } - ElementInfoPartWidget *f = infoPartWidgetForKey("formula"); - ElementInfoPartWidget *l = infoPartWidgetForKey("label"); - - if (f && l) - { - if (f->text().isEmpty()) - l->setEnabled(true); - else - l->setDisabled(true); - } - if (m_live_edit) enableLiveEdit(); }