X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_MenuGroupPanel.cpp;h=f268c369122f0d70094eb6546747a7b1d506d71c;hb=4224f4dbe7ceaefe74b5d6b79a5840a9f5df2d7a;hp=00d131278ca54b0036977d42da2d37a1bac2587f;hpb=309c6241144204b2a2c1cf23cb68f037833fb983;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_MenuGroupPanel.cpp b/src/XGUI/XGUI_MenuGroupPanel.cpp index 00d131278..f268c3691 100644 --- a/src/XGUI/XGUI_MenuGroupPanel.cpp +++ b/src/XGUI/XGUI_MenuGroupPanel.cpp @@ -7,16 +7,20 @@ #include #include +#include XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent) - : QWidget(parent), myNewRow(0), myNewCol(0), myMaxRow(1) + : QFrame(parent), myNewRow(0), myNewCol(0), myMaxRow(1) { myLayout = new QGridLayout(this); myLayout->setSpacing(0); myLayout->setMargin(0); myLayout->setContentsMargins(0, 0, 0, 0); + setFrameShape(QFrame::NoFrame); } + + void XGUI_MenuGroupPanel::addCommand(XGUI_Command* theAction) { myActions.append(theAction); @@ -31,7 +35,8 @@ void XGUI_MenuGroupPanel::placeWidget(QWidget* theWgt) myNewRow = 0; myNewCol++; } - myLayout->addWidget(theWgt, myNewRow, myNewCol, Qt::AlignLeft); + myLayout->addWidget(theWgt, myNewRow, myNewCol); + myLayout->setRowStretch(myNewRow, 0); myNewRow++; } @@ -57,17 +62,18 @@ void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent) foreach(QWidget* eachWidget, myActionWidget) { placeWidget(eachWidget); } + myLayout->setRowStretch(myMaxRow + 1, 1); } 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()) + if (!theKeys.isEmpty()) { aCommand->setShortcut(theKeys); - + } addCommand(aCommand); return aCommand; } @@ -75,9 +81,9 @@ XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QStrin 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); + foreach (XGUI_Command* aCmd, myActions) { + if (aCmd->data().toString() == theId) + return aCmd; + } return 0; -} \ No newline at end of file +}