#include <QResizeEvent>
#include <math.h>
+#include <iostream>
XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent)
: QWidget(parent), myNewRow(0), myNewCol(0), myMaxRow(1)
void XGUI_MenuGroupPanel::addCommand(XGUI_Command* theAction)
{
- myActions[theAction] = theAction->requestWidget(this);
- addWidget(myActions[theAction]);
+ myActions.append(theAction);
+ QWidget* aWdg = theAction->requestWidget(this);
+ myActionWidget.append(aWdg);
+ addWidget(aWdg);
}
void XGUI_MenuGroupPanel::placeWidget(QWidget* theWgt)
return;
myMaxRow = aMaxRow;
- QListIterator<QWidget*> aIt(myActions.values());
myNewRow = 0;
myNewCol = 0;
- while(aIt.hasNext()) {
- placeWidget(aIt.next());
+ foreach(QWidget* eachWidget, myActionWidget) {
+ placeWidget(eachWidget);
}
}
XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QString& theTitle,
const QString& theTip, const QIcon& theIcon,
- const QKeySequence& theKeys)
+ const QKeySequence& theKeys, bool isCheckable)
{
- XGUI_Command* aCommand = new XGUI_Command(theId, theIcon, theTitle, this);
+ XGUI_Command* aCommand = new XGUI_Command(theId, theIcon, theTitle, this, isCheckable);
aCommand->setToolTip(theTip);
if (!theKeys.isEmpty())
aCommand->setShortcut(theKeys);
addCommand(aCommand);
return aCommand;
}
+
+
+XGUI_Command* XGUI_MenuGroupPanel::feature(const QString& theId) const
+{
+ QList<XGUI_Command*>::const_iterator aIt;
+ for (aIt = myActions.constBegin(); aIt != myActions.constEnd(); ++aIt)
+ if ((*aIt)->id() == theId)
+ return (*aIt);
+ return 0;
+}