Popup menu actions upper parent should be the main application to have visible status tip information in status bar
#include <QApplication>
#include <QClipboard>
#include <QTimer>
+#include <QMainWindow>
#include <memory>
#include <string>
//this->setLayout(aMainLay);
connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged()));
- myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"), this,
- this, SLOT(onCopyItem()));
+ myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"),
+ myWorkshop->desktop(), this, SLOT(onCopyItem()));
myCopyAction->setShortcut(QKeySequence::Copy);
myCopyAction->setEnabled(false);
myListControl->addAction(myCopyAction);
- myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"), this,
- this, SLOT(onDeleteItem()));
+ myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"),
+ myWorkshop->desktop(), this, SLOT(onDeleteItem()));
myDeleteAction->setEnabled(false);
myListControl->addAction(myDeleteAction);
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_ResultParameter.h>
+#include <QMainWindow>
#include <QAction>
#include <QMenu>
#include <QEvent>
{
QAction* aAction;
- aAction = ModuleBase_Tools::createAction(QIcon(), tr("Auxiliary"), this);
+ QWidget* aParent = myModule->workshop()->desktop();
+ aAction = ModuleBase_Tools::createAction(QIcon(), tr("Auxiliary"), aParent);
aAction->setCheckable(true);
addAction("AUXILIARY_CMD", aAction);
- aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), this,
+ aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), aParent,
this, SLOT(onActivatePart(bool)));
myActions["ACTIVATE_PART_CMD"] = aAction;
// Activate PartSet
- aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), this,
+ aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), aParent,
this, SLOT(onActivatePartSet(bool)));
myActions["ACTIVATE_PARTSET_CMD"] = aAction;
- aAction = ModuleBase_Tools::createAction(QIcon(":icons/edit.png"), tr("Edit..."), this,
+ aAction = ModuleBase_Tools::createAction(QIcon(":icons/edit.png"), tr("Edit..."), aParent,
this, SLOT(onEdit(bool)));
myActions["EDIT_CMD"] = aAction;
}
#include <QAction>
+#include <QMainWindow>
#ifdef _DEBUG
#include <iostream>
}
}
-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 = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok.png"),
- "" /*empty to show error*/, theParent);
+ "Apply" /*empty to show error*/, aParent);
}
break;
case Abort:
case AbortAll: {
aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_cancel.png"), "Cancel",
- theParent);
+ aParent);
if (theId == Abort) {
aResult->setShortcut(QKeySequence(Qt::Key_Escape));
}
break;
case Help: {
aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_help.png"), "Help",
- theParent);
+ aParent);
}
break;
case Preview: {
- aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), theParent, 0, 0, "Compute preview");
+ aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), aParent, 0, 0, "Compute preview");
aResult->setStatusTip(aResult->toolTip());
}
break;
//! Return property panel's action like ok, cancel, help.
//! If there is no such action, it will be created.
- QAction* operationStateAction(OperationStateActionId theId, QObject* theParent = 0);
+ QAction* operationStateAction(OperationStateActionId theId);
/// Return an action by the given id, if it was registered in the manager
QAction* action(const QString& theId);
{
ModuleBase_ModelWidget* anActiveWidget = activeWidget();
XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
- QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll);
myAcceptAllToolTip = anAcceptAllAction->toolTip();
QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
}
XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
if (workshop()->isFeatureOfNested(theFeature)) {
- QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll);
bool anEnabled = anError.isEmpty();
anAcceptAllAction->setEnabled(anEnabled);
anAcceptAllAction->setToolTip(!anEnabled ? anError : myAcceptAllToolTip);
XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr();
if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) {
- QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll);
QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations()));
aNestedActList << anAction;
}
if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) {
- QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll, NULL);
+ QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(abortAllOperations()));
aNestedActList << anAction;
}
XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr();
if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) {
- QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll);
QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations()));
aNestedActList << anAction;
}
if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) {
- QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll, NULL);
+ QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(abortAllOperations()));
aNestedActList << anAction;
}