CAM: Fix expression editor so that widgets refresh after closing
src/Gui/QuantitySpinBox.cpp: - Call updateExpression() after setExpression() in QuantitySpinBox src/Gui/SpinBox.cpp: - Call updateExpression() after setExpression() in ExpressionSpinBox src/Gui/Widgets.cpp: - Call onChange() after setExpression() in ExpLineEdit src/Mod/CAM/Path/Base/Gui/Util.py: - Connect to showFormulaDialog signal and refresh CAM QuantitySpinBox Python wrapper when dialog closes
This commit is contained in:
committed by
Chris Hennes
parent
bba37208cc
commit
db40eb1478
@@ -659,6 +659,7 @@ static App::Document* getPreselectedDocument()
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
int DlgExpressionInput::getVarSetIndex(const App::Document* doc) const
|
||||
{
|
||||
auto paramExpressionEditor = App::GetApplication().GetParameterGroupByPath(
|
||||
|
||||
@@ -607,6 +607,7 @@ void QuantitySpinBox::openFormulaDialog()
|
||||
else if (box->discardedFormula())
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
updateExpression();
|
||||
box->deleteLater();
|
||||
Q_EMIT showFormulaDialog(false);
|
||||
});
|
||||
|
||||
@@ -196,6 +196,7 @@ void ExpressionSpinBox::openFormulaDialog()
|
||||
else if (box->discardedFormula())
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
updateExpression();
|
||||
box->deleteLater();
|
||||
});
|
||||
box->show();
|
||||
|
||||
@@ -1621,6 +1621,7 @@ void ExpLineEdit::finishFormulaDialog()
|
||||
else if (box->discardedFormula())
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
onChange();
|
||||
box->deleteLater();
|
||||
|
||||
if(autoClose)
|
||||
|
||||
@@ -131,6 +131,21 @@ class QuantitySpinBox(QtCore.QObject):
|
||||
self.widget.installEventFilter(self)
|
||||
# Connect local class method as slot
|
||||
self.widget.textChanged.connect(self.onWidgetValueChanged)
|
||||
# Connect to showFormulaDialog signal to track dialog open/close
|
||||
try:
|
||||
self.widget.showFormulaDialog.connect(self.onFormulaDialogStateChanged)
|
||||
except AttributeError:
|
||||
# Widget may not have this signal
|
||||
pass
|
||||
|
||||
def onFormulaDialogStateChanged(self, isOpen):
|
||||
"""
|
||||
Slot called when the formula dialog is opened or closed.
|
||||
When the dialog closes (isOpen=False), refresh the widget.
|
||||
"""
|
||||
if not isOpen:
|
||||
# Dialog has closed, update the widget to reflect any changes
|
||||
self.updateWidget()
|
||||
|
||||
def eventFilter(self, obj, event):
|
||||
if event.type() == QtCore.QEvent.Type.FocusIn:
|
||||
|
||||
Reference in New Issue
Block a user