#include <iostream>
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)
myNewRow = 0;
myNewCol++;
}
- myLayout->addWidget(theWgt, myNewRow, myNewCol, Qt::AlignLeft);
+ myLayout->addWidget(theWgt, myNewRow, myNewCol);
+ myLayout->setRowStretch(myNewRow, 0);
myNewRow++;
}
myMaxRow = aMaxRow;
myNewRow = 0;
myNewCol = 0;
- foreach(QWidget* eachWidget, myActionWidget) {
+ foreach(QWidget* eachWidget, myActionWidget)
+ {
placeWidget(eachWidget);
}
+ myLayout->setRowStretch(myMaxRow + 1, 1);
}
XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QString& theTitle,
{
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;
}
-
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);
+ foreach (XGUI_Command* aCmd, myActions)
+ {
+ if (aCmd->data().toString() == theId)
+ return aCmd;
+ }
return 0;
}