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 QKeySequence aKeys = shortcut();
29 QString aToolTip = toolTip();
31 aToolTip = aToolTip + " (" + aKeys.toString() + ")";
32 if (!aToolTip.isEmpty())
33 aBtn->setToolTip(aToolTip);
35 aBtn->addAction(this);
36 connect(aBtn, SIGNAL(clicked()), this, SLOT(trigger()));
38 aBtn->setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT);
41 return QWidgetAction::createWidget(theParent);
44 bool XGUI_Command::enabled() const
49 void XGUI_Command::enable()
54 void XGUI_Command::disable()
59 void XGUI_Command::connectTo(const QObject* theResiver, const char* theSlot)
61 connect(this, SIGNAL(triggered()), theResiver, theSlot);