mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Fix wrong behavior when edit the element information
In the diagram editor, when we edit the element information in the side panel, each time we tip something in the text field the cursor always go to the end if the "label" information is empty.
This commit is contained in:
@@ -191,6 +191,7 @@ void ElementInfoWidget::buildInterface()
|
||||
ui->scroll_vlayout->addWidget(eipw);
|
||||
m_eipw_list << eipw;
|
||||
}
|
||||
|
||||
ui->scroll_vlayout->addStretch();
|
||||
}
|
||||
|
||||
@@ -277,6 +278,22 @@ void ElementInfoWidget::firstActivated()
|
||||
*/
|
||||
void ElementInfoWidget::elementInfoChange()
|
||||
{
|
||||
if(currentInfo() != m_element->elementInformations())
|
||||
auto elmt_info = m_element->elementInformations();
|
||||
auto current_info = currentInfo();
|
||||
|
||||
//If both info have a formula, we remove the label
|
||||
//value before compare the equality, because the
|
||||
//label of the information returned by the element
|
||||
//can be different of the current label because
|
||||
//updated by the element to reflect the actual
|
||||
//displayed label according the current formula.
|
||||
if (current_info.contains(QETInformation::ELMT_FORMULA) &&
|
||||
elmt_info.contains(QETInformation::ELMT_FORMULA))
|
||||
{
|
||||
elmt_info.remove(QETInformation::ELMT_LABEL);
|
||||
current_info.remove((QETInformation::ELMT_LABEL ));
|
||||
}
|
||||
|
||||
if(current_info != elmt_info)
|
||||
updateUi();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user