2 * XGUI_PropertyPanel.cpp
4 * Created on: Apr 29, 2014
8 #include <XGUI_Constants.h>
9 #include <XGUI_PropertyPanel.h>
12 #include <QVBoxLayout>
14 #include <QPushButton>
16 #include <QVBoxLayout>
22 XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent)
24 this->setWindowTitle(tr("Property Panel"));
25 QAction* aViewAct = this->toggleViewAction();
26 this->setObjectName(XGUI::PROP_PANEL);
28 QWidget* aContent = new QWidget(this);
29 QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
30 aMainLay->setContentsMargins(3, 3, 3, 3);
31 this->setWidget(aContent);
33 QFrame* aFrm = new QFrame(aContent);
34 aFrm->setFrameStyle(QFrame::Sunken);
35 aFrm->setFrameShape(QFrame::Panel);
36 QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
37 aBtnLay->setContentsMargins(0, 0, 0, 0);
38 aMainLay->addWidget(aFrm);
40 QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
42 aBtnLay->addWidget(aBtn);
43 aBtnLay->addStretch(1);
44 aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
45 aBtn->setObjectName(XGUI::PROP_PANEL_OK);
47 aBtnLay->addWidget(aBtn);
48 aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
49 aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
51 aBtnLay->addWidget(aBtn);
53 myCustomWidget = new QWidget(aContent);
54 aMainLay->addWidget(myCustomWidget);
55 aMainLay->addStretch(1);
58 XGUI_PropertyPanel::~XGUI_PropertyPanel()
62 void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets)
64 myWidgets = theWidgets;
67 QWidget* XGUI_PropertyPanel::contentWidget()
69 return myCustomWidget;
72 void XGUI_PropertyPanel::updateContentWidget(boost::shared_ptr<ModelAPI_Feature> theFeature)
74 foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
75 eachWidget->restoreValue(theFeature);
77 // the repaint is used here to immediatelly react in GUI to the values change.