mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
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
This commit is contained in:
@@ -64,6 +64,22 @@ void ElementInfoWidget::setElement(Element *element)
|
|||||||
m_element = element;
|
m_element = element;
|
||||||
updateUi();
|
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);
|
connect(m_element, &Element::elementInfoChange, this, &ElementInfoWidget::elementInfoChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,20 +91,7 @@ void ElementInfoWidget::setElement(Element *element)
|
|||||||
void ElementInfoWidget::apply()
|
void ElementInfoWidget::apply()
|
||||||
{
|
{
|
||||||
if (QUndoCommand *undo = associatedUndo())
|
if (QUndoCommand *undo = associatedUndo())
|
||||||
{
|
|
||||||
m_element -> diagram() -> undoStack().push(undo);
|
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);
|
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();
|
if (m_live_edit) enableLiveEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user