1 #include "XGUI_MainWindow.h"
2 #include "XGUI_MainMenu.h"
3 #include "XGUI_ViewWindow.h"
11 #include <QToolButton>
12 #include <QTreeWidgetItem>
16 #include <QFormLayout>
17 #include <QDoubleSpinBox>
18 #include <QPushButton>
19 #include <QScrollArea>
22 XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) :
23 QMainWindow(parent), myObjectBrowser(0)
25 myMenuBar = new XGUI_MainMenu(this);
27 QDockWidget* aDoc = new QDockWidget(this);
28 aDoc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
29 aDoc->setWindowTitle(tr("OBJECT_BROWSER_TITLE"));
30 myObjectBrowser = new QTreeWidget(aDoc);
31 myObjectBrowser->setColumnCount(1);
32 myObjectBrowser->setHeaderHidden(true);
33 aDoc->setWidget(myObjectBrowser);
34 addDockWidget(Qt::LeftDockWidgetArea, aDoc);
37 aDoc = new QDockWidget(this);
38 aDoc->setFeatures(QDockWidget::AllDockWidgetFeatures | QDockWidget::DockWidgetVerticalTitleBar);
39 aDoc->setMinimumHeight(0);
40 aDoc->setWindowTitle("Console");
41 QTextEdit* aTextEdt = new QTextEdit(aDoc);
42 aTextEdt->setText(">>>");
43 aDoc->setWidget(aTextEdt);
44 aTextEdt->setMinimumHeight(0);
45 addDockWidget(Qt::BottomDockWidgetArea, aDoc);
47 QMdiArea* aMdiArea = new QMdiArea(this);
48 setCentralWidget(aMdiArea);
50 aMdiArea->addSubWindow(new XGUI_ViewWindow(), Qt::FramelessWindowHint);
51 aMdiArea->addSubWindow(new XGUI_ViewWindow(), Qt::FramelessWindowHint);
57 XGUI_MainWindow::~XGUI_MainWindow(void)
61 //******************************************************
62 void XGUI_MainWindow::showObjectBrowser()
64 myObjectBrowser->parentWidget()->show();
67 //******************************************************
68 void XGUI_MainWindow::hideObjectBrowser()
70 myObjectBrowser->parentWidget()->hide();
73 //******************************************************
74 void XGUI_MainWindow::fillObjectBrowser()
77 aNames << "Parameters" << "Constructions";
78 aNames << "Part 1" << "Part 2" << "Part 3";
79 aNames << "Properties";
82 aIcons << ":pictures/params_folder.png";
83 aIcons << ":pictures/constr_folder.png";
84 aIcons << ":pictures/part_ico.png";
85 aIcons << ":pictures/part_ico.png";
86 aIcons << ":pictures/part_ico.png";
87 aIcons << ":pictures/properties.png";
89 QList<QTreeWidgetItem*> aItems;
90 foreach(QString aName, aNames) {
91 QTreeWidgetItem* aItem = new QTreeWidgetItem(myObjectBrowser);
92 aItem->setText(0, aName);
95 for(int i = 0; i < aItems.length(); i++) {
96 aItems[i]->setIcon(0, QIcon(aIcons[i]));
98 myObjectBrowser->addTopLevelItems(aItems);
100 for (int i = 2; i < 5; i++) {
101 QTreeWidgetItem* aItem = new QTreeWidgetItem(aItems[i]);
102 aItem->setText(0, "Parameters");
103 aItem->setIcon(0, QIcon(":pictures/params_folder.png"));
105 aItem = new QTreeWidgetItem(aItems[i]);
106 aItem->setText(0, "Construction");
107 aItem->setIcon(0, QIcon(":pictures/constr_folder.png"));
109 aItem = new QTreeWidgetItem(aItems[i]);
110 aItem->setText(0, "Bodies");
111 aItem->setIcon(0, QIcon(":pictures/part_ico.png"));
113 aItem = new QTreeWidgetItem(aItems[i]);
114 aItem->setText(0, "Features");
115 aItem->setIcon(0, QIcon(":pictures/features.png"));
120 void XGUI_MainWindow::addPropertyPanel()
122 QDockWidget* aPropPanel = new QDockWidget(this);
123 aPropPanel->setWindowTitle("Point");
125 QWidget* aContent = new QWidget(aPropPanel);
126 QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
127 aMainLay->setContentsMargins(3,3,3,3);
128 aPropPanel->setWidget(aContent);
130 /*QWidget* aNameWgt = new QWidget(aContent);
131 QHBoxLayout* aNameLay = new QHBoxLayout(aNameWgt);
132 aNameLay->setContentsMargins(0,0,0,0);
133 aMainLay->addWidget(aNameWgt);
135 aNameLay->addWidget(new QLabel("Name", aNameWgt));
136 aNameLay->addWidget(new QLineEdit(aNameWgt));*/
138 QComboBox* aCombo = new QComboBox(aContent);
139 aCombo->addItem("By coordinates");
140 aMainLay->addWidget(aCombo);
142 QWidget* aGrpBox1 = new QWidget(aContent);
143 //aGrpBox1->setFlat(true);
144 QFormLayout* aFrmLay = new QFormLayout(aGrpBox1);
145 aFrmLay->setContentsMargins(0, 6, 0, 0);
146 aMainLay->addWidget(aGrpBox1);
149 QLabel* aLbl = new QLabel(aGrpBox1);
150 aLbl->setPixmap(QPixmap(":pictures/x_point.png"));
151 aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
153 aLbl = new QLabel(aGrpBox1);
154 aLbl->setPixmap(QPixmap(":pictures/y_point.png"));
155 aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
157 aLbl = new QLabel(aGrpBox1);
158 aLbl->setPixmap(QPixmap(":pictures/z_point.png"));
159 aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
162 /* aGrpBox1 = new QGroupBox("Normal vector", aContent);
163 aGrpBox1->setFlat(true);
164 aFrmLay = new QFormLayout(aGrpBox1);
165 aFrmLay->setContentsMargins(0, 6, 0, 0);
166 aMainLay->addWidget(aGrpBox1);
168 aLbl = new QLabel(aGrpBox1);
169 aLbl->setPixmap(QPixmap(":pictures/x_size.png"));
170 aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
172 aLbl = new QLabel(aGrpBox1);
173 aLbl->setPixmap(QPixmap(":pictures/y_size.png"));
174 aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
176 aLbl = new QLabel(aGrpBox1);
177 aLbl->setPixmap(QPixmap(":pictures/z_size.png"));
178 aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));*/
180 aMainLay->addStretch(1);
182 QFrame* aFrm = new QFrame(aContent);
183 aFrm->setFrameStyle(QFrame::Sunken);
184 aFrm->setFrameShape(QFrame::Panel);
185 QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
186 aBtnLay->setContentsMargins(0, 0, 0, 0);
187 aMainLay->addWidget(aFrm);
189 QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
191 aBtnLay->addWidget(aBtn);
192 aBtnLay->addStretch(1);
193 aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
195 aBtnLay->addWidget(aBtn);
196 aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
198 aBtnLay->addWidget(aBtn);
200 addDockWidget(Qt::RightDockWidgetArea, aPropPanel);