1 #include "XGUI_Command.h"
5 XGUI_Command::XGUI_Command(const QString& theId, QObject * parent)
6 : QWidgetAction(parent), myId(theId)
10 XGUI_Command::XGUI_Command(const QString& theId, const QIcon& icon, const QString& text,
12 : QWidgetAction(parent), myId(theId)
18 XGUI_Command::~XGUI_Command()
22 QWidget* XGUI_Command::createWidget(QWidget* theParent)
24 if (theParent->inherits("XGUI_MenuGroupPanel")) {
25 QPushButton* aBtn = new QPushButton(theParent);
26 aBtn->setIcon(icon());
27 aBtn->setText(text());
28 aBtn->setStyleSheet("text-align: left");
29 QKeySequence aKeys = shortcut();
30 QString aToolTip = toolTip();
32 aToolTip = aToolTip + " (" + aKeys.toString() + ")";
33 if (!aToolTip.isEmpty())
34 aBtn->setToolTip(aToolTip);
36 aBtn->addAction(this);
37 connect(aBtn, SIGNAL(clicked()), this, SLOT(trigger()));
39 aBtn->setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT);
42 return QWidgetAction::createWidget(theParent);
45 bool XGUI_Command::enabled() const
50 void XGUI_Command::enable()
55 void XGUI_Command::disable()
60 void XGUI_Command::connectTo(const QObject* theResiver, const char* theSlot)
62 connect(this, SIGNAL(triggered()), theResiver, theSlot);