2 * XGUI_PropertyPanel.cpp
4 * Created on: Apr 29, 2014
8 #include <XGUI_Constants.h>
9 #include <XGUI_PropertyPanel.h>
11 #include <ModuleBase_PropPanelOperation.h>
14 #include <QVBoxLayout>
16 #include <QPushButton>
18 #include <QVBoxLayout>
24 XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent)
26 this->setWindowTitle(tr("Property Panel"));
27 QAction* aViewAct = this->toggleViewAction();
28 this->setObjectName(XGUI::PROP_PANEL);
30 QWidget* aContent = new QWidget(this);
31 QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
32 aMainLay->setContentsMargins(3, 3, 3, 3);
33 this->setWidget(aContent);
35 QFrame* aFrm = new QFrame(aContent);
36 aFrm->setFrameStyle(QFrame::Sunken);
37 aFrm->setFrameShape(QFrame::Panel);
38 QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
39 aBtnLay->setContentsMargins(0, 0, 0, 0);
40 aMainLay->addWidget(aFrm);
42 QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
44 aBtnLay->addWidget(aBtn);
45 aBtnLay->addStretch(1);
46 aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
47 aBtn->setObjectName(XGUI::PROP_PANEL_OK);
49 aBtnLay->addWidget(aBtn);
50 aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
51 aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
53 aBtnLay->addWidget(aBtn);
55 myCustomWidget = new QWidget(aContent);
56 aMainLay->addWidget(myCustomWidget);
57 aMainLay->addStretch(1);
60 XGUI_PropertyPanel::~XGUI_PropertyPanel()
64 void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets)
66 myWidgets = theWidgets;
69 QWidget* XGUI_PropertyPanel::contentWidget()
71 return myCustomWidget;
74 void XGUI_PropertyPanel::updateContentWidget(boost::shared_ptr<ModelAPI_Feature> theFeature)
76 foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
77 eachWidget->restoreValue(theFeature);