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);
27 setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
29 QWidget* aContent = new QWidget(this);
30 QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
31 aMainLay->setContentsMargins(3, 3, 3, 3);
32 this->setWidget(aContent);
34 QFrame* aFrm = new QFrame(aContent);
35 aFrm->setFrameStyle(QFrame::Sunken);
36 aFrm->setFrameShape(QFrame::Panel);
37 QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
38 aBtnLay->setContentsMargins(0, 0, 0, 0);
39 aMainLay->addWidget(aFrm);
41 QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
43 aBtnLay->addWidget(aBtn);
44 aBtnLay->addStretch(1);
45 aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
46 aBtn->setObjectName(XGUI::PROP_PANEL_OK);
48 aBtnLay->addWidget(aBtn);
49 aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
50 aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
52 aBtnLay->addWidget(aBtn);
54 myCustomWidget = new QWidget(aContent);
55 aMainLay->addWidget(myCustomWidget);
56 aMainLay->addStretch(1);
59 XGUI_PropertyPanel::~XGUI_PropertyPanel()
63 void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets)
65 myWidgets = theWidgets;
68 QWidget* XGUI_PropertyPanel::contentWidget()
70 return myCustomWidget;
73 void XGUI_PropertyPanel::updateContentWidget(boost::shared_ptr<ModelAPI_Feature> theFeature)
75 foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
76 eachWidget->restoreValue(theFeature);
78 // the repaint is used here to immediatelly react in GUI to the values change.