X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FXGUI%2FXGUI_Command.cpp;h=ffd6ab103f7338b833a05020b60e635534532867;hb=aa07c7e0e3410522a1464d1863d1052c96edb7aa;hp=5ec79621fd4abcbbd44c5270f9b9c28d4a5bc12e;hpb=e1f8fb3cfc1ee565db16fbbd9fe6f65121c4577c;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Command.cpp b/src/XGUI/XGUI_Command.cpp index 5ec79621f..ffd6ab103 100644 --- a/src/XGUI/XGUI_Command.cpp +++ b/src/XGUI/XGUI_Command.cpp @@ -2,14 +2,14 @@ #include -XGUI_Command::XGUI_Command(const QString& theId, QObject * parent) - : QWidgetAction(parent), myId(theId) +XGUI_Command::XGUI_Command(const QString& theId, QObject * parent, bool isCheckable) + : QWidgetAction(parent), myId(theId), myCheckable(isCheckable) { } XGUI_Command::XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, - QObject* parent) - : QWidgetAction(parent), myId(theId) + QObject* parent, bool isCheckable) + : QWidgetAction(parent), myId(theId), myCheckable(isCheckable) { setIcon(icon); setText(text); @@ -22,21 +22,26 @@ XGUI_Command::~XGUI_Command() QWidget* XGUI_Command::createWidget(QWidget* theParent) { if (theParent->inherits("XGUI_MenuGroupPanel")) { - QPushButton* aBtn = new QPushButton(theParent); - aBtn->setIcon(icon()); - aBtn->setText(text()); + QPushButton* aButton = new QPushButton(theParent); + aButton->setIcon(icon()); + aButton->setText(text()); + aButton->setStyleSheet("text-align: left"); QKeySequence aKeys = shortcut(); QString aToolTip = toolTip(); if (!aKeys.isEmpty()) aToolTip = aToolTip + " (" + aKeys.toString() + ")"; if (!aToolTip.isEmpty()) - aBtn->setToolTip(aToolTip); + aButton->setToolTip(aToolTip); - aBtn->addAction(this); - connect(aBtn, SIGNAL(clicked()), this, SLOT(trigger())); - aBtn->setFlat(true); - aBtn->setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT); - return aBtn; + aButton->addAction(this); + connect(aButton, SIGNAL(clicked()), this, SLOT(trigger())); + connect(this, SIGNAL(toggled(bool)), aButton, SLOT(setChecked(bool))); + aButton->setFlat(true); + aButton->setCheckable(myCheckable); + this->setCheckable(myCheckable); + aButton->setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT); + + return aButton; } return QWidgetAction::createWidget(theParent); } @@ -58,5 +63,15 @@ void XGUI_Command::disable() void XGUI_Command::connectTo(const QObject* theResiver, const char* theSlot) { - connect(this, SIGNAL(triggered()), theResiver, theSlot); + connect(this, SIGNAL(triggered()), theResiver, theSlot); +} + +const QStringList& XGUI_Command::unblockableCommands() const +{ + return myUnblockableCommands; +} + +void XGUI_Command::setUnblockableCommands(const QStringList& myUnblockableCommands) +{ + this->myUnblockableCommands = myUnblockableCommands; }