#include <XGUI_SelectionMgr.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Events.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationFeature.h>
#include <ModuleBase_SelectionValidator.h>
+#include <ModuleBase_Tools.h>
#include <QAction>
+#include <QMainWindow>
#ifdef _DEBUG
#include <iostream>
if (myShortcuts.contains(theKeySequence)) {
QString aMessage = tr("Shortcut %1 is already defined. Ignore.");
aMessage = aMessage.arg(theKeySequence.toString());
- Events_Error::send(aMessage.toStdString());
+ Events_InfoMessage("XGUI_ActionsMgr", aMessage.toStdString()).send();
return QKeySequence();
}
myShortcuts.append(theKeySequence);
}
}
-QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId, QObject* theParent)
+QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId)
{
QAction* aResult = NULL;
if (myOperationActions.contains(theId)) {
aResult = myOperationActions.value(theId);
- if (theParent && aResult->parent() != theParent) {
- aResult->setParent(theParent);
- }
+ //if (theParent && aResult->parent() != theParent) {
+ // aResult->setParent(theParent);
+ //}
} else {
+ QWidget* aParent = myWorkshop->desktop();
switch (theId) {
case Accept:
case AcceptAll: {
- aResult = new QAction(QIcon(":pictures/button_ok.png"), "", theParent);
- aResult->setToolTip("Apply");
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok.png"),
+ "Apply" /*empty to show error*/, aParent);
}
break;
case Abort:
case AbortAll: {
- aResult = new QAction(QIcon(":pictures/button_cancel.png"), "", theParent);
- aResult->setToolTip("Cancel");
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_cancel.png"), "Cancel",
+ aParent);
if (theId == Abort) {
aResult->setShortcut(QKeySequence(Qt::Key_Escape));
}
}
break;
case Help: {
- aResult = new QAction(QIcon(":pictures/button_help.png"), "", theParent);
- aResult->setToolTip("Help");
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_help.png"), "Help",
+ aParent);
}
break;
case Preview: {
- aResult = new QAction("See preview", theParent);
- aResult->setToolTip("Compute preview");
+ aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), aParent, 0, 0, "Compute preview");
+ aResult->setStatusTip(aResult->toolTip());
}
break;
default: