Default enabled state of AcceptAll button is disabled. An attempt to update the state on Undo/Redo/Delete sketch feature operations.
// 5. stop operation
aWorkshop->displayer()->updateViewer();
aMgr->finishOperation();
+ XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
+ anOpMgr->updateApplyOfOperations();
} else {
bool isPartRemoved = false;
// Delete part with help of PartSet plugin
}
}
+void XGUI_ActionsMgr::onAcceptAllToggled(bool theState)
+{
+ if (!theState) {
+ QAction* anAcceptAllAction = operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ anAcceptAllAction->setEnabled(theState);
+ }
+}
+
QKeySequence XGUI_ActionsMgr::registerShortcut(const QKeySequence& theKeySequence)
{
if (theKeySequence.isEmpty()) {
case Accept:
case AcceptAll:
aResult = new QAction(QIcon(":pictures/button_ok.png"), "", theParent);
- // the default value is disabled, some modifications should be performed in order
- // to update enable state of this action.
- // AcceptAll is blinked when sketch is started from enabled to disabled.
- aResult->setEnabled(false);
+ // the default value is disabled, so the next connect is used to restore this
+ // default state by untoggle this action
+ connect(this, SIGNAL(toggled(bool)), this, SLOT(onAcceptAllToggled(bool)));
break;
case Abort:
case AbortAll: {
void updateCheckState();
//! Updates actions according to current selection in the viewer
void updateOnViewSelection();
+ //! Update the default enable state of the action by untoggle it. The default value is disabled.
+ //! \param theState the new state of the AcceptAll action
+ void onAcceptAllToggled(bool theState);
protected:
//! Sets all actions to isEnabled state.
/// \param theEnabled the state value
void setApplyEnabled(const bool theEnabled);
+public: // TEMPORARY, it should be protected and be performed automatically
/// Emits nestedStateChange for operations with an information about validity of the operation
/// \param theOperation the sent operation. If it is NULL, all operations in the stack are sent.
void updateApplyOfOperations(ModuleBase_Operation* theOperation = 0);
+protected: // TEMPORARY
/// Commits the current operatin if it is valid
bool commitOperation();
for (int i = 0; i < theTimes; ++i) {
aMgr->undo();
}
+
+ operationMgr()->updateApplyOfOperations();
updateCommandStatus();
}
for (int i = 0; i < theTimes; ++i) {
aMgr->redo();
}
+ operationMgr()->updateApplyOfOperations();
updateCommandStatus();
// unblock the viewer update functionality and make update on purpose
if (deleteFeatures(anObjects, anIgnoredFeatures, aDesktop, true)) {
myDisplayer->updateViewer();
aMgr->finishOperation();
+ operationMgr()->updateApplyOfOperations();
updateCommandStatus();
}
else {