setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
QWidget* aContent = new QWidget(this);
- QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
- aMainLay->setContentsMargins(3, 3, 3, 3);
+ myMainLayout = new QVBoxLayout(aContent);
+ myMainLayout->setContentsMargins(3, 3, 3, 3);
this->setWidget(aContent);
QFrame* aFrm = new QFrame(aContent);
aFrm->setFrameShape(QFrame::Panel);
QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
aBtnLay->setContentsMargins(0, 0, 0, 0);
- aMainLay->addWidget(aFrm);
+ myMainLayout->addWidget(aFrm);
QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
aBtn->setFlat(true);
aBtnLay->addWidget(aBtn);
myCustomWidget = new QWidget(aContent);
- aMainLay->addWidget(myCustomWidget);
- aMainLay->addStretch(1);
+ myMainLayout->addWidget(myCustomWidget);
+ myMainLayout->addStretch(1);
aBtn->installEventFilter(this);
}
{
}
+void XGUI_PropertyPanel::cleanContent()
+{
+ myWidgets.clear();
+
+ QLayoutItem* aItem = myMainLayout->takeAt(myMainLayout->count() - 1);
+ delete aItem;
+
+ myMainLayout->removeWidget(myCustomWidget);
+ delete myCustomWidget;
+
+ myCustomWidget = new QWidget(widget());
+ myMainLayout->addWidget(myCustomWidget);
+ myMainLayout->addStretch(1);
+}
+
void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets)
{
myWidgets = theWidgets;
#include <QList>
class QKeyEvent;
+class QVBoxLayout;
class XGUI_EXPORT XGUI_PropertyPanel: public QDockWidget
{
QWidget* contentWidget();
void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
+ void cleanContent();
+
+protected:
virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
public slots:
QWidget* myCustomWidget;
QList<ModuleBase_ModelWidget*> myWidgets;
+
+ QVBoxLayout* myMainLayout;
};
#endif /* XGUI_PROPERTYPANEL_H_ */
//An operation passed by message. Start it, process and commit.
const Config_PointerMessage* aPartSetMsg = dynamic_cast<const Config_PointerMessage*>(theMessage);
if (aPartSetMsg) {
+ // Clear previous content
+ myPropertyPanel->cleanContent();
ModuleBase_Operation* anOperation =
(ModuleBase_Operation*)(aPartSetMsg->pointer());