mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Start to revamp the code about formula and label of elements and conductors
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4791 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -75,7 +75,20 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +189,22 @@ void ElementInfoWidget::buildInterface()
|
||||
ui->scroll_vlayout->addStretch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementInfoWidget::infoPartWidgetForKey
|
||||
* @param key
|
||||
* @return the ElementInfoPartWidget with key @key, if not found return nullptr;
|
||||
*/
|
||||
ElementInfoPartWidget *ElementInfoWidget::infoPartWidgetForKey(const QString &key) const
|
||||
{
|
||||
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
|
||||
{
|
||||
if (eipw->key() == key)
|
||||
return eipw;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementInfoWidget::updateUi
|
||||
* fill information fetch in m_element_info to the
|
||||
@@ -203,6 +232,17 @@ 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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user