Salome HOME
Crash on abort of any non-sketch operation.
[modules/shaper.git] / src / XGUI / XGUI_Command.cpp
index 07d0d310f8add811d55e7c3446d1f41b1423416e..1194dc4543785c84b0339555b385dab588506de9 100644 (file)
@@ -4,17 +4,26 @@
 #include <QVariant>
 #include <QDebug>
 
-XGUI_Command::XGUI_Command(const QString& theId, QObject * parent, bool isCheckable)
+XGUI_Command::XGUI_Command(const QString& theId,
+                           const QString& theDocumentKind,
+                           QObject * parent,
+                           bool isCheckable)
     : QWidgetAction(parent),
-      myCheckable(isCheckable)
+      myCheckable(isCheckable),
+      myDocumentKind(theDocumentKind)
 {
   setData(theId);
 }
 
-XGUI_Command::XGUI_Command(const QString& theId, const QIcon& icon, const QString& text,
-                           QObject* parent, bool isCheckable)
+XGUI_Command::XGUI_Command(const QString& theId,
+                           const QString& theDocumentKind,
+                           const QIcon& icon,
+                           const QString& text,
+                           QObject* parent,
+                           bool isCheckable)
     : QWidgetAction(parent),
-      myCheckable(isCheckable)
+      myCheckable(isCheckable),
+      myDocumentKind(theDocumentKind)
 {
   setIcon(icon);
   setText(text);
@@ -25,6 +34,11 @@ XGUI_Command::~XGUI_Command()
 {
 }
 
+const QString& XGUI_Command::documentKind() const
+{
+  return myDocumentKind;
+}
+
 QWidget* XGUI_Command::createWidget(QWidget* theParent)
 {
   if (theParent->inherits("XGUI_MenuGroupPanel")) {
@@ -35,6 +49,7 @@ QWidget* XGUI_Command::createWidget(QWidget* theParent)
     QString aToolTip = toolTip();
     if (!aKeys.isEmpty()) {
       aToolTip = QString("%1 (%2)").arg(aToolTip).arg(aKeys.toString());
+      aButton->setShortcut(aKeys);
     }
     if (!aToolTip.isEmpty()) {
       aButton->setToolTip(aToolTip);
@@ -67,4 +82,4 @@ const QStringList& XGUI_Command::nestedCommands() const
 void XGUI_Command::setNestedCommands(const QStringList& myUnblockableCommands)
 {
   this->myNestedCommands = myUnblockableCommands;
-}
\ No newline at end of file
+}