X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_MenuGroupPanel.cpp;h=4f4673470417dad3dcb02a3d1ac5f13080df9201;hb=d86c77d1c6210bbe04fbc3e5b00f9e212e1ec930;hp=4be66cee3fa67e95172bcf952f20808488e1c14c;hpb=2a0dd5ede9110d423fbd6b038c0445cb819163a9;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_MenuGroupPanel.cpp b/src/XGUI/XGUI_MenuGroupPanel.cpp index 4be66cee3..4f4673470 100644 --- a/src/XGUI/XGUI_MenuGroupPanel.cpp +++ b/src/XGUI/XGUI_MenuGroupPanel.cpp @@ -7,6 +7,7 @@ #include #include +#include XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent) : QWidget(parent), myNewRow(0), myNewCol(0), myMaxRow(1) @@ -19,8 +20,10 @@ XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent) 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) @@ -50,19 +53,18 @@ void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent) return; myMaxRow = aMaxRow; - QListIterator 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); @@ -70,3 +72,13 @@ XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QStrin addCommand(aCommand); return aCommand; } + + +XGUI_Command* XGUI_MenuGroupPanel::feature(const QString& theId) const +{ + QList::const_iterator aIt; + for (aIt = myActions.constBegin(); aIt != myActions.constEnd(); ++aIt) + if ((*aIt)->id() == theId) + return (*aIt); + return 0; +}