]> SALOME platform Git repositories - modules/geom.git/blob - src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx
Salome HOME
0021684: EDF 2221 : Display the arguments and the name of the operations
[modules/geom.git] / src / AdvancedGUI / AdvancedGUI_PipeTShapeDlg.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "AdvancedGUI_PipeTShapeDlg.h"
21
22 #include <DlgRef.h>
23 #include <GeometryGUI.h>
24 #include <GEOMBase.h>
25
26 #include <SUIT_Session.h>
27 #include <SUIT_ResourceMgr.h>
28 #include <SUIT_OverrideCursor.h>
29 #include <LightApp_SelectionMgr.h>
30 #include <SalomeApp_Application.h>
31 #include <SalomeApp_Tools.h>
32
33 // OCCT Includes
34 #include <BRep_Tool.hxx>
35 #include <TopTools_IndexedMapOfShape.hxx>
36 #include <TopoDS_Shape.hxx>
37 #include <TopoDS.hxx>
38 #include <TopExp.hxx>
39 #include <TColStd_IndexedMapOfInteger.hxx>
40 #include <gp_Pnt.hxx>
41
42 #include <QTabWidget>
43
44 #include <GEOMImpl_Types.hxx>
45
46 //=================================================================================
47 // Constructor
48 //=================================================================================
49 AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
50   : GEOMBase_Skeleton(theGeometryGUI, parent, false)
51 {
52   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
53   //QPixmap imageOp  = aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE"));
54   QPixmap imageSel = aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"));
55   QPixmap imageImp = aResMgr->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT"));
56   imagePipeTShape  = aResMgr->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
57   imageReduction   = aResMgr->loadPixmap("GEOM", tr("IMG_PIPETSHAPE_SECT"));
58
59   setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
60
61   /***************************************************************/
62   mainFrame()->GroupConstructors->setAttribute(Qt::WA_DeleteOnClose);
63   mainFrame()->GroupConstructors->close();
64
65   QTabWidget* aTabWidget = new QTabWidget (centralWidget());
66
67   QGridLayout* myMainLayout = new QGridLayout (centralWidget());
68   myMainLayout->setMargin(0);
69   myMainLayout->setSpacing(6);
70
71   // Main parameters
72   QGroupBox* GroupMain = new QGroupBox();
73   QGridLayout* layoutGroupMain = new QGridLayout (GroupMain);
74
75   MainTubeGroupParams = new DlgRef_3Spin();
76   MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE"));
77   MainTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
78   MainTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
79   MainTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
80   MainTubeGroupParams->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); // ??
81
82   IncidentTubeGroupParams = new DlgRef_3Spin();
83   IncidentTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_IPIPE"));
84   IncidentTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
85   IncidentTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
86   IncidentTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
87
88   ChamferGroupParams = new DlgRef_2Spin();
89   ChamferGroupParams->GroupBox1->setCheckable(true);
90   ChamferGroupParams->GroupBox1->setChecked(false);
91   ChamferGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_CHAMFER"));
92   ChamferGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_H"));
93   ChamferGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_W"));
94
95   FilletGroupParams = new DlgRef_1Spin();
96   FilletGroupParams->GroupBox1->setCheckable(true);
97   FilletGroupParams->GroupBox1->setChecked(false);
98   FilletGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_FILLET"));
99   FilletGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
100
101   HexMeshCheckBox = new QCheckBox();
102   HexMeshCheckBox->setText(tr("GEOM_PIPE_TSHAPE_HEX"));
103   HexMeshCheckBox->setChecked(true);
104
105   LabelImgPipeTShape = new QLabel();
106   LabelImgPipeTShape->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
107   LabelImgPipeTShape->setAlignment(Qt::AlignCenter);
108   LabelImgPipeTShape->setMinimumSize(300, 300);
109
110   layoutGroupMain->addWidget(MainTubeGroupParams, 0, 0, 1, 1);
111   layoutGroupMain->addWidget(IncidentTubeGroupParams, 1, 0, 1, 1);
112   layoutGroupMain->addWidget(ChamferGroupParams, 2, 0, 1, 1);
113   layoutGroupMain->addWidget(FilletGroupParams, 3, 0, 1, 1);
114   layoutGroupMain->addWidget(HexMeshCheckBox, 4, 0, 1, 1);
115
116   layoutGroupMain->addWidget(LabelImgPipeTShape, 0, 1, 5, 1);
117   layoutGroupMain->setColumnStretch(1, 1); // stretch of column 0 is supposed 0 by default
118
119   // Thickness reduction parameters
120   QGroupBox* GroupReduct = new QGroupBox();
121   QGridLayout* layoutGroupReduct = new QGridLayout (GroupReduct);
122
123   LReductionGroupParams = new AdvancedGUI_4Spin();
124   LReductionGroupParams->GroupBox1->setCheckable(true);
125   LReductionGroupParams->GroupBox1->setChecked(false);
126   LReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_LEFT_TR"));
127   LReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("L"));
128   LReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("L"));
129   LReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("L"));
130   LReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("L"));
131
132   RReductionGroupParams = new AdvancedGUI_4Spin();
133   RReductionGroupParams->GroupBox1->setCheckable(true);
134   RReductionGroupParams->GroupBox1->setChecked(false);
135   RReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_RIGHT_TR"));
136   RReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("R"));
137   RReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("R"));
138   RReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("R"));
139   RReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("R"));
140
141   IReductionGroupParams = new AdvancedGUI_4Spin();
142   IReductionGroupParams->GroupBox1->setCheckable(true);
143   IReductionGroupParams->GroupBox1->setChecked(false);
144   IReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_INCI_TR"));
145   IReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("I"));
146   IReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("I"));
147   IReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("I"));
148   IReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("I"));
149
150   LabelImgReduction = new QLabel();
151   LabelImgReduction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
152   LabelImgReduction->setAlignment(Qt::AlignCenter);
153   LabelImgReduction->setMinimumSize(300, 300);
154
155   layoutGroupReduct->addWidget(LReductionGroupParams->GroupBox1, 0, 0, 1, 1);
156   layoutGroupReduct->addWidget(RReductionGroupParams->GroupBox1, 1, 0, 1, 1);
157   layoutGroupReduct->addWidget(IReductionGroupParams->GroupBox1, 2, 0, 1, 1);
158
159   layoutGroupReduct->addWidget(LabelImgReduction, 0, 1, 3, 1);
160   layoutGroupReduct->setColumnStretch(1, 1); // stretch of column 0 is supposed 0 by default
161
162   // Position parameters
163   QGroupBox* GroupPos = new QGroupBox();
164   QVBoxLayout* layoutGroupPos = new QVBoxLayout (GroupPos);
165
166   JunctionPointsSel = new DlgRef_6Sel();
167   JunctionPointsSel->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_POSITION"));
168   JunctionPointsSel->GroupBox1->setCheckable(true);
169   JunctionPointsSel->GroupBox1->setChecked(false);
170   JunctionPointsSel->PushButton1->setIcon(imageSel);
171   JunctionPointsSel->LineEdit1->setReadOnly(true);
172   JunctionPointsSel->LineEdit1->setText("");
173   JunctionPointsSel->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P1"));
174
175   JunctionPointsSel->PushButton2->setIcon(imageSel);
176   JunctionPointsSel->LineEdit2->setReadOnly(true);
177   JunctionPointsSel->LineEdit2->setText("");
178   JunctionPointsSel->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P2"));
179
180   JunctionPointsSel->PushButton3->setIcon(imageSel);
181   JunctionPointsSel->LineEdit3->setReadOnly(true);
182   JunctionPointsSel->LineEdit3->setText("");
183   JunctionPointsSel->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P3"));
184
185   JunctionPointsSel->PushButton4->setIcon(imageImp);
186   JunctionPointsSel->LineEdit4->setReadOnly(true);
187   JunctionPointsSel->LineEdit4->setText("");
188   JunctionPointsSel->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"));
189
190   JunctionPointsSel->PushButton5->setIcon(imageImp);
191   JunctionPointsSel->LineEdit5->setReadOnly(true);
192   JunctionPointsSel->LineEdit5->setText("");
193   JunctionPointsSel->TextLabel5->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"));
194
195   JunctionPointsSel->PushButton6->setAttribute(Qt::WA_DeleteOnClose);
196   JunctionPointsSel->PushButton6->close();
197   JunctionPointsSel->LineEdit6->setAttribute(Qt::WA_DeleteOnClose);
198   JunctionPointsSel->LineEdit6->close();
199   JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
200   JunctionPointsSel->TextLabel6->close();
201
202   layoutGroupPos->addWidget(JunctionPointsSel);
203   layoutGroupPos->addStretch();
204
205   //aTabWidget->addTab(GroupMain, imageOp, tr("GEOM_PIPETSHAPE_GROUPMAIN"));
206   aTabWidget->addTab(GroupMain, tr("GEOM_PIPETSHAPE_GROUPMAIN"));
207   aTabWidget->addTab(GroupReduct, tr("GEOM_PIPETSHAPE_GROUPREDUCT"));
208   aTabWidget->addTab(GroupPos, tr("GEOM_PIPETSHAPE_GROUPPOS"));
209
210   myMainLayout->addWidget(aTabWidget, 0, 0, 1, 1);
211   connect(aTabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
212   /***************************************************************/
213
214   setHelpFileName("create_pipetshape_page.html");
215
216   Init();
217 }
218
219 //=================================================================================
220 // Destructor
221 //=================================================================================
222 AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() {
223   // no need to delete child widgets, Qt does it all for us
224 }
225
226 //=================================================================================
227 // function : Init()
228 // purpose  :
229 //=================================================================================
230 void AdvancedGUI_PipeTShapeDlg::Init()
231 {
232   // Get setting of step value from file configuration
233   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
234   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
235   double minValue = Precision::Approximation();
236
237   myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
238   myOkPoint1 = myOkPoint2 = myOkPoint3 = false;
239
240   pipeTShapeGroupObjects.clear();
241
242   // min, max, step and decimals for spin boxes
243   initSpinBox(MainTubeGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
244   initSpinBox(MainTubeGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision");
245   initSpinBox(MainTubeGroupParams->SpinBox_DZ, minValue, COORD_MAX, step, "length_precision");
246   initSpinBox(IncidentTubeGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
247   initSpinBox(IncidentTubeGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision");
248   initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, minValue, COORD_MAX, step, "length_precision");
249   initSpinBox(ChamferGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
250   initSpinBox(ChamferGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision");
251   initSpinBox(FilletGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
252
253   initSpinBox(LReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision");
254   initSpinBox(LReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision");
255   initSpinBox(LReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision");
256   initSpinBox(LReductionGroupParams->SpinBox4, 0.,       COORD_MAX, step, "length_precision");
257
258   initSpinBox(RReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision");
259   initSpinBox(RReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision");
260   initSpinBox(RReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision");
261   initSpinBox(RReductionGroupParams->SpinBox4, 0.,       COORD_MAX, step, "length_precision");
262
263   initSpinBox(IReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision");
264   initSpinBox(IReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision");
265   initSpinBox(IReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision");
266   initSpinBox(IReductionGroupParams->SpinBox4, 0.,       COORD_MAX, step, "length_precision");
267
268   // init variables
269   MainTubeGroupParams->SpinBox_DX->setValue(80);
270   MainTubeGroupParams->SpinBox_DY->setValue(20);
271   MainTubeGroupParams->SpinBox_DZ->setValue(200);
272   IncidentTubeGroupParams->SpinBox_DX->setValue(50);
273   IncidentTubeGroupParams->SpinBox_DY->setValue(20);
274   IncidentTubeGroupParams->SpinBox_DZ->setValue(200);
275   ChamferGroupParams->SpinBox_DX->setValue(20);
276   ChamferGroupParams->SpinBox_DY->setValue(10);
277   FilletGroupParams->SpinBox_DX->setValue(20);
278
279   LReductionGroupParams->SpinBox1->setValue(60);
280   LReductionGroupParams->SpinBox2->setValue(30);
281   LReductionGroupParams->SpinBox3->setValue(40);
282   LReductionGroupParams->SpinBox4->setValue(20);
283
284   RReductionGroupParams->SpinBox1->setValue(60);
285   RReductionGroupParams->SpinBox2->setValue(30);
286   RReductionGroupParams->SpinBox3->setValue(40);
287   RReductionGroupParams->SpinBox4->setValue(20);
288
289   IReductionGroupParams->SpinBox1->setValue(40);
290   IReductionGroupParams->SpinBox2->setValue(10);
291   IReductionGroupParams->SpinBox3->setValue(30);
292   IReductionGroupParams->SpinBox4->setValue(15);
293
294   CssNormal = QString("QDoubleSpinBox {");
295   CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet());
296   CssNormal.append("}");
297   CssNormal.append("\nQPushButton {");
298   CssNormal.append(JunctionPointsSel->PushButton4->styleSheet());
299   CssNormal.append("}");
300   CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}";
301   CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}";
302
303   showOnlyPreviewControl();
304
305   // Signal/slot connections
306   connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
307   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
308   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
309   //connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
310   // ValueChangedInSpinBox
311   connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
312   connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
313   connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
314   connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
315   connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
316   connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
317   connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
318   connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
319   connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
320   // ChamferOrFillet
321   connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
322   connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
323   // Thickness reduction:
324   //   Left
325   connect(LReductionGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(processPreview()));
326   connect(LReductionGroupParams->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
327   connect(LReductionGroupParams->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
328   connect(LReductionGroupParams->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
329   connect(LReductionGroupParams->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
330   //   Right
331   connect(RReductionGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(processPreview()));
332   connect(RReductionGroupParams->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
333   connect(RReductionGroupParams->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
334   connect(RReductionGroupParams->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
335   connect(RReductionGroupParams->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
336   //   Incident pipe
337   connect(IReductionGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(processPreview()));
338   connect(IReductionGroupParams->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
339   connect(IReductionGroupParams->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
340   connect(IReductionGroupParams->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
341   connect(IReductionGroupParams->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
342   // Position
343   connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool)));
344   connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
345   connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
346   connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
347   // ApplyNewDimensions
348   connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
349   connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
350   connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*)));
351   //@@ put additional signal/slot connections here @@//
352
353   initName(tr("GEOM_PIPE_TSHAPE"));
354
355   qApp->processEvents();
356   updateGeometry();
357   resize(minimumSizeHint());
358
359   updateLabelImgPipeTShape();
360   LabelImgReduction->setPixmap(imageReduction.scaled(LabelImgReduction->size(),
361                                                      Qt::KeepAspectRatio,
362                                                      Qt::SmoothTransformation));
363   processPreview();
364 }
365
366 //=================================================================================
367 // function : currentChanged()
368 // purpose  : Tab widget management
369 //=================================================================================
370 void AdvancedGUI_PipeTShapeDlg::currentChanged (int tabId)
371 {
372   if (tabId == 0 || tabId == 1)
373     resizeEvent(NULL);
374 }
375
376 //=================================================================================
377 // function : ApplyNewDimensions()
378 // purpose  :
379 //=================================================================================
380 void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions()
381 {
382   QPushButton* send = (QPushButton*) sender();
383
384   bool ok = false;
385   double newVal;
386   if (send == JunctionPointsSel->PushButton4) {
387     if (!JunctionPointsSel->LineEdit4->text().isEmpty()) {
388       newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok);
389       if (ok) {
390         disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
391         MainTubeGroupParams->SpinBox_DZ->setValue(newVal);
392         connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
393         MainTubeGroupParams->SpinBox_DZ->setToolTip("");
394         MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
395         CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
396         processPreview();
397       }
398     }
399   }
400   else if (send == JunctionPointsSel->PushButton5) {
401     if (!JunctionPointsSel->LineEdit5->text().isEmpty()) {
402       newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok);
403       if (ok) {
404         disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
405         IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal);
406         connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
407         IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
408         IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
409         CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
410         processPreview();
411       }
412     }
413   }
414 }
415
416 //=================================================================================
417 // function : UpdatePicture()
418 // purpose  :
419 //=================================================================================
420 void AdvancedGUI_PipeTShapeDlg::UpdatePicture (QWidget* old, QWidget* now)
421 {
422   if (ChamferGroupParams->GroupBox1->isChecked())
423     if (now == MainTubeGroupParams->SpinBox_DX)
424       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1"));
425     else if (now == MainTubeGroupParams->SpinBox_DY)
426       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1"));
427     else if (now == MainTubeGroupParams->SpinBox_DZ)
428       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1"));
429     else if (now == IncidentTubeGroupParams->SpinBox_DX)
430       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2"));
431     else if (now == IncidentTubeGroupParams->SpinBox_DY)
432       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2"));
433     else if (now == IncidentTubeGroupParams->SpinBox_DZ)
434       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2"));
435     else if (now == ChamferGroupParams->SpinBox_DX)
436       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H"));
437     else if (now == ChamferGroupParams->SpinBox_DY)
438       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W"));
439     else
440       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
441   else if (FilletGroupParams->GroupBox1->isChecked())
442     if (now == MainTubeGroupParams->SpinBox_DX)
443       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1"));
444     else if (now == MainTubeGroupParams->SpinBox_DY)
445       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1"));
446     else if (now == MainTubeGroupParams->SpinBox_DZ)
447       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1"));
448     else if (now == IncidentTubeGroupParams->SpinBox_DX)
449       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2"));
450     else if (now == IncidentTubeGroupParams->SpinBox_DY)
451       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2"));
452     else if (now == IncidentTubeGroupParams->SpinBox_DZ)
453       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2"));
454     else if (now == FilletGroupParams->SpinBox_DX)
455       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF"));
456     else
457       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
458   else
459     if (now == MainTubeGroupParams->SpinBox_DX)
460       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1"));
461     else if (now == MainTubeGroupParams->SpinBox_DY)
462       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1"));
463     else if (now == MainTubeGroupParams->SpinBox_DZ)
464       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1"));
465     else if (now == IncidentTubeGroupParams->SpinBox_DX)
466       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2"));
467     else if (now == IncidentTubeGroupParams->SpinBox_DY)
468       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2"));
469     else if (now == IncidentTubeGroupParams->SpinBox_DZ)
470       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2"));
471     else
472       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
473
474   updateLabelImgPipeTShape();
475 }
476
477 //=================================================================================
478 // function : SetPosition()
479 // purpose  :
480 //=================================================================================
481 void AdvancedGUI_PipeTShapeDlg::SetPosition (bool isChecked)
482 {
483   if (isChecked) {
484     erasePreview();
485     JunctionPointsSel->LineEdit4->setText("");
486     JunctionPointsSel->LineEdit5->setText("");
487     //connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(
488     //SelectionIntoArgument()));
489     JunctionPointsSel->PushButton1->click();
490     SelectionIntoArgument();
491   }
492   else {
493     disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
494     JunctionPointsSel->LineEdit4->setText("");
495     JunctionPointsSel->LineEdit5->setText("");
496     processPreview();
497   }
498 }
499
500 //=================================================================================
501 // function : ValueChangedInSpinBox()
502 // purpose  :
503 //=================================================================================
504 void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox (double newValue)
505 {
506   if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
507     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
508   processPreview();
509 }
510
511 //=================================================================================
512 // function : SelectionIntoArgument()
513 // purpose  : Called when selection as changed or other case
514 //=================================================================================
515 void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument()
516 {
517   erasePreview();
518   //myEditCurrentArgument->setText("");
519
520   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
521   SALOME_ListIO aSelList;
522   aSelMgr->selectedObjects(aSelList);
523
524   if (aSelList.Extent() != 1) {
525     if (myEditCurrentArgument == JunctionPointsSel->LineEdit1)
526       myOkPoint1 = false;
527     else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2)
528       myOkPoint2 = false;
529     else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3)
530       myOkPoint3 = false;
531     return;
532     myEditCurrentArgument->setText("");
533   }
534
535   // nbSel == 1
536   if (aSelList.Extent() == 1) {
537     Handle(SALOME_InteractiveObject) anIO = aSelList.First();
538     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO);
539     if (!CORBA::is_nil(aSelectedObject)) {
540       QString aName = GEOMBase::GetName(aSelectedObject);
541       TopoDS_Shape aShape;
542       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
543
544         TColStd_IndexedMapOfInteger aMap;
545         aSelMgr->GetIndexes(anIO, aMap);
546         if (aMap.Extent() == 1) { // Local Selection
547           int anIndex = aMap(1);
548           aName += QString(":vertex_%1").arg(anIndex);
549
550           //Find SubShape Object in Father
551           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
552
553           if (aFindedObject->_is_nil()) { // Object not found in study
554             GEOM::GEOM_IShapesOperations_var aShapesOp =
555               getGeomEngine()->GetIShapesOperations(getStudyId());
556             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
557           }
558           else {
559             aSelectedObject = aFindedObject; // get Object from study
560           }
561           GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
562         } else { // Global Selection
563           if (aShape.ShapeType() != TopAbs_VERTEX) {
564             aSelectedObject = GEOM::GEOM_Object::_nil();
565             aName = "";
566           }
567         }
568       }
569
570       if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
571         return;
572       }
573       myEditCurrentArgument->setText(aName);
574       if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
575         myPoint1 = aSelectedObject;
576         myOkPoint1 = true;
577         if (!myOkPoint2)
578           JunctionPointsSel->PushButton2->click();
579       } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
580         myPoint2 = aSelectedObject;
581         myOkPoint2 = true;
582         if (!myOkPoint3)
583           JunctionPointsSel->PushButton3->click();
584       } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
585         myPoint3 = aSelectedObject;
586         myOkPoint3 = true;
587         if (!myOkPoint1)
588           JunctionPointsSel->PushButton1->click();
589       }
590     }
591   }
592
593   if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
594     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
595     processPreview();
596   }
597 }
598
599 //=================================================================================
600 // function : SetEditCurrentArgument()
601 // purpose  :
602 //=================================================================================
603 void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument()
604 {
605   QPushButton* send = (QPushButton*) sender();
606
607   if (send == JunctionPointsSel->PushButton1) {
608     myEditCurrentArgument = JunctionPointsSel->LineEdit1;
609     JunctionPointsSel->PushButton2->setDown(false);
610     JunctionPointsSel->LineEdit2->setEnabled(false);
611     JunctionPointsSel->PushButton3->setDown(false);
612     JunctionPointsSel->LineEdit3->setEnabled(false);
613   }
614   else if (send == JunctionPointsSel->PushButton2) {
615     myEditCurrentArgument = JunctionPointsSel->LineEdit2;
616     JunctionPointsSel->PushButton1->setDown(false);
617     JunctionPointsSel->LineEdit1->setEnabled(false);
618     JunctionPointsSel->PushButton3->setDown(false);
619     JunctionPointsSel->LineEdit3->setEnabled(false);
620   }
621   else if (send == JunctionPointsSel->PushButton3) {
622     myEditCurrentArgument = JunctionPointsSel->LineEdit3;
623     JunctionPointsSel->PushButton1->setDown(false);
624     JunctionPointsSel->LineEdit1->setEnabled(false);
625     JunctionPointsSel->PushButton2->setDown(false);
626     JunctionPointsSel->LineEdit2->setEnabled(false);
627   }
628
629   // enable line edit
630   myEditCurrentArgument->setEnabled(true);
631   myEditCurrentArgument->setFocus();
632   myEditCurrentArgument->setText("");
633   // after setFocus(), because it will be setDown(false) when loses focus
634   send->setDown(true);
635
636   JunctionPointsSel->LineEdit4->setText("");
637   JunctionPointsSel->LineEdit5->setText("");
638
639   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
640   //globalSelection(GEOM_POINT);
641   globalSelection(); // close local contexts, if any
642   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
643   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
644           this, SLOT(SelectionIntoArgument()));
645 }
646
647 //=================================================================================
648 // function : SetDoubleSpinBoxStep()
649 // purpose  : Double spin box management
650 //=================================================================================
651 void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep (double step)
652 {
653   MainTubeGroupParams->SpinBox_DX->setSingleStep(step);
654   MainTubeGroupParams->SpinBox_DY->setSingleStep(step);
655   MainTubeGroupParams->SpinBox_DZ->setSingleStep(step);
656   IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step);
657   IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step);
658   IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step);
659   ChamferGroupParams->SpinBox_DX->setSingleStep(step);
660   ChamferGroupParams->SpinBox_DY->setSingleStep(step);
661   FilletGroupParams->SpinBox_DX->setSingleStep(step);
662
663   LReductionGroupParams->SpinBox1->setSingleStep(step);
664   LReductionGroupParams->SpinBox2->setSingleStep(step);
665   LReductionGroupParams->SpinBox3->setSingleStep(step);
666   LReductionGroupParams->SpinBox4->setSingleStep(step);
667
668   RReductionGroupParams->SpinBox1->setSingleStep(step);
669   RReductionGroupParams->SpinBox2->setSingleStep(step);
670   RReductionGroupParams->SpinBox3->setSingleStep(step);
671   RReductionGroupParams->SpinBox4->setSingleStep(step);
672
673   IReductionGroupParams->SpinBox1->setSingleStep(step);
674   IReductionGroupParams->SpinBox2->setSingleStep(step);
675   IReductionGroupParams->SpinBox3->setSingleStep(step);
676   IReductionGroupParams->SpinBox4->setSingleStep(step);
677 }
678
679 //=================================================================================
680 // function : ClickOnOk()
681 // purpose  :
682 //=================================================================================
683 void AdvancedGUI_PipeTShapeDlg::ClickOnOk()
684 {
685   setIsApplyAndClose( true );
686   if (ClickOnApply())
687     ClickOnCancel();
688 }
689
690 //=================================================================================
691 // function : ClickOnApply()
692 // purpose  :
693 //=================================================================================
694 bool AdvancedGUI_PipeTShapeDlg::ClickOnApply()
695 {
696   if (!onAccept())
697     return false;
698
699   initName();
700
701   if (!isApplyAndClose())
702     processPreview();
703   return true;
704 }
705
706 //=================================================================================
707 // function : ActivateThisDialog()
708 // purpose  :
709 //=================================================================================
710 void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog()
711 {
712   GEOMBase_Skeleton::ActivateThisDialog();
713   //globalSelection( GEOM_POINT);
714   //connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
715   //        currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
716   if (myOkPoint1 && myOkPoint2 && myOkPoint3)
717     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
718   processPreview();
719 }
720
721 //=================================================================================
722 // function : enterEvent [REDEFINED]
723 // purpose  :
724 //=================================================================================
725 void AdvancedGUI_PipeTShapeDlg::enterEvent (QEvent*)
726 {
727   if (!mainFrame()->GroupButtons->isEnabled())
728     ActivateThisDialog();
729 }
730
731 //=================================================================================
732 // function : resizeEvent [REDEFINED]
733 // purpose  :
734 //=================================================================================
735 void AdvancedGUI_PipeTShapeDlg::resizeEvent (QResizeEvent */*event*/)
736 {
737   QSize scaledSize1 = imagePipeTShape.size();
738   scaledSize1.scale(LabelImgPipeTShape->size(), Qt::KeepAspectRatio);
739   if (!LabelImgPipeTShape->pixmap() || scaledSize1 != LabelImgPipeTShape->pixmap()->size())
740     updateLabelImgPipeTShape();
741
742   QSize scaledSize2 = imageReduction.size();
743   scaledSize2.scale(LabelImgReduction->size(), Qt::KeepAspectRatio);
744   if (!LabelImgReduction->pixmap() || scaledSize2 != LabelImgReduction->pixmap()->size())
745     LabelImgReduction->setPixmap(imageReduction.scaled(LabelImgReduction->size(),
746                                                        Qt::KeepAspectRatio,
747                                                        Qt::SmoothTransformation));
748 }
749
750 //=================================================================================
751 // function : updateLabelImgPipeTShape
752 // purpose  :
753 //=================================================================================
754 void AdvancedGUI_PipeTShapeDlg::updateLabelImgPipeTShape()
755 {
756   LabelImgPipeTShape->setPixmap(imagePipeTShape.scaled(LabelImgPipeTShape->size(),
757                                                        Qt::KeepAspectRatio,
758                                                        Qt::SmoothTransformation));
759 }
760
761 //=================================================================================
762 // function : ChamferOrFillet()
763 // purpose  :
764 //=================================================================================
765 void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet (bool)
766 {
767   QGroupBox* send = (QGroupBox*) sender();
768
769   if (send == ChamferGroupParams->GroupBox1) {
770     if (send->isChecked()) {
771       disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
772       FilletGroupParams->GroupBox1->setChecked(false);
773       connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
774       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
775     }
776     else
777       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
778
779     updateLabelImgPipeTShape();
780     if (myOkPoint1 && myOkPoint2 && myOkPoint3)
781       CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
782     processPreview();
783   }
784   else if (send == FilletGroupParams->GroupBox1) {
785     if (send->isChecked()) {
786       disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
787       ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
788       connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
789       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
790     }
791     else
792       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
793
794     updateLabelImgPipeTShape();
795     if (myOkPoint1 && myOkPoint2 && myOkPoint3)
796       CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
797     processPreview();
798   }
799 }
800
801 //=================================================================================
802 // function : DisplayPreview()
803 // purpose  :
804 //=================================================================================
805 void AdvancedGUI_PipeTShapeDlg::DisplayPreview (const bool activate, const bool update,
806                                                 const bool toRemoveFromEngine, const double lineWidth,
807                                                 const int displayMode, const int color)
808 {
809   QString msg;
810   if (!isValid(msg)) {
811     erasePreview(update);
812     return;
813   }
814
815   erasePreview(false);
816
817   try {
818     SUIT_OverrideCursor wc;
819     ObjectList objects;
820     bool hexMeshState = HexMeshCheckBox->isChecked();
821     HexMeshCheckBox->setChecked(false);
822     if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
823       wc.suspend();
824     }
825     else {
826       ObjectList::iterator it = objects.begin();
827       GEOM::GEOM_Object_var obj = *it;
828       displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
829       if (toRemoveFromEngine)
830         obj->UnRegister();
831     }
832     HexMeshCheckBox->setChecked(hexMeshState);
833   } catch (const SALOME::SALOME_Exception& e) {
834     SalomeApp_Tools::QtCatchCorbaException(e);
835   }
836
837   if (update)
838     updateViewer();
839 }
840
841 //=================================================================================
842 // function : createOperation
843 // purpose  :
844 //=================================================================================
845 GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation()
846 {
847   return getGeomEngine()->GetIAdvancedOperations(getStudyId());
848 }
849
850 //=================================================================================
851 // function : isValid
852 // purpose  :
853 //=================================================================================
854 bool AdvancedGUI_PipeTShapeDlg::isValid (QString& msg)
855 {
856   bool ok = true;
857
858   ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
859   ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
860   ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
861   ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
862   ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
863   ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
864   ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
865   ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
866   ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
867
868   if (LReductionGroupParams->GroupBox1->isChecked()) {
869     ok = LReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok;
870     ok = LReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok;
871     ok = LReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok;
872     ok = LReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok;
873   }
874   if (RReductionGroupParams->GroupBox1->isChecked()) {
875     ok = RReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok;
876     ok = RReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok;
877     ok = RReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok;
878     ok = RReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok;
879   }
880   if (IReductionGroupParams->GroupBox1->isChecked()) {
881     ok = IReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok;
882     ok = IReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok;
883     ok = IReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok;
884     ok = IReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok;
885   }
886
887   ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
888   ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
889   ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
890   ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
891   ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
892   ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
893   ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
894   ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
895   ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
896
897   if (JunctionPointsSel->GroupBox1->isChecked())
898     ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
899
900   return ok;
901 }
902
903 //=================================================================================
904 // function : CheckCompatiblePosition()
905 // purpose  :
906 //=================================================================================
907 bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition
908      (GEOM::GEOM_Object_var theP1, GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3,
909       double theTolerance)
910 {
911   MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
912   IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
913   JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
914   JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
915
916   CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
917   CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
918
919   JunctionPointsSel->LineEdit4->setText("");
920   JunctionPointsSel->LineEdit5->setText("");
921
922   MainTubeGroupParams->SpinBox_DZ->setToolTip("");
923   IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
924
925   TopoDS_Shape aShape;
926   gp_Pnt P1, P2, P3;
927   if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
928     P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
929   else
930     return false;
931
932   if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
933     P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
934   else
935     return false;
936
937   if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
938     P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
939   else
940     return false;
941
942   double d12 = P1.Distance(P2);
943   double d13 = P1.Distance(P3);
944   double d23 = P2.Distance(P3);
945
946   if (Abs(d12) <= Precision::Confusion()) {
947     //SetErrorCode("Junctions points P1 and P2 are identical");
948     return false;
949   }
950   if (Abs(d13) <= Precision::Confusion()) {
951     //SetErrorCode("Junctions points P1 and P3 are identical");
952     return false;
953   }
954   if (Abs(d23) <= Precision::Confusion()) {
955     //SetErrorCode("Junctions points P2 and P3 are identical");
956     return false;
957   }
958
959   long double newL1 = 0.5 * d12;
960   long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
961
962   JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
963   JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
964
965   if (fabs(newL1 - theL1) > Precision::Approximation()) {
966     if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
967         (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
968       disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
969       MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
970       connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged(double)),
971               this, SLOT(ValueChangedInSpinBox(double)));
972       MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
973       MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
974       JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable);
975     }
976     else {
977       MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
978       MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
979       JunctionPointsSel->PushButton4->setStyleSheet(CssRefused);
980     }
981   }
982   else {
983     MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
984     JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
985   }
986
987   if (fabs(newL2 - theL2) > Precision::Approximation()) {
988     if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
989         (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
990       disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
991       IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
992       connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
993       IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
994       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
995       JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable);
996     }
997     else {
998       IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
999       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
1000       JunctionPointsSel->PushButton5->setStyleSheet(CssRefused);
1001     }
1002   }
1003   else {
1004     IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
1005     JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
1006   }
1007
1008   return true;
1009 }
1010
1011 //=================================================================================
1012 // function : execute
1013 // purpose  :
1014 //=================================================================================
1015 bool AdvancedGUI_PipeTShapeDlg::execute (ObjectList& objects)
1016 {
1017   if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
1018     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
1019
1020   return executeNoCheck(objects);
1021 }
1022
1023 //=================================================================================
1024 // function : executeNoCheck
1025 // purpose  :
1026 //=================================================================================
1027 bool AdvancedGUI_PipeTShapeDlg::executeNoCheck (ObjectList& objects)
1028 {
1029   bool res = false;
1030
1031   //   GEOM::GEOM_Object_var anObj;
1032   GEOM::ListOfGO_var anObj;
1033
1034   GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
1035
1036   //@@ retrieve input values from the widgets here @@//
1037   CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
1038   CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
1039   CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
1040   CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
1041   CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
1042   CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
1043   CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
1044   CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
1045   CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
1046   CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
1047
1048   // Thickness reductions
1049   CORBA::Double theRL = 0., theWL = 0., theLtransL = 0., theLthinL = 0.;
1050   CORBA::Double theRR = 0., theWR = 0., theLtransR = 0., theLthinR = 0.;
1051   CORBA::Double theRI = 0., theWI = 0., theLtransI = 0., theLthinI = 0.;
1052
1053   if (LReductionGroupParams->GroupBox1->isChecked()) {
1054     theRL = LReductionGroupParams->SpinBox1->value();
1055     theWL = LReductionGroupParams->SpinBox2->value();
1056     theLtransL = LReductionGroupParams->SpinBox3->value();
1057     theLthinL = LReductionGroupParams->SpinBox4->value();
1058   }
1059   if (RReductionGroupParams->GroupBox1->isChecked()) {
1060     theRR = RReductionGroupParams->SpinBox1->value();
1061     theWR = RReductionGroupParams->SpinBox2->value();
1062     theLtransR = RReductionGroupParams->SpinBox3->value();
1063     theLthinR = RReductionGroupParams->SpinBox4->value();
1064   }
1065   if (IReductionGroupParams->GroupBox1->isChecked()) {
1066     theRI = IReductionGroupParams->SpinBox1->value();
1067     theWI = IReductionGroupParams->SpinBox2->value();
1068     theLtransI = IReductionGroupParams->SpinBox3->value();
1069     theLthinI = IReductionGroupParams->SpinBox4->value();
1070   }
1071
1072   //if (JunctionPointsSel->GroupBox1->isChecked()) {
1073   //  CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
1074   //  theL1 = MainTubeGroupParams->SpinBox_DZ->value();
1075   //  theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
1076   //}
1077
1078   // call engine function
1079   if (ChamferGroupParams->GroupBox1->isChecked()) {
1080     if (JunctionPointsSel->GroupBox1->isChecked())
1081       anObj = anOper->MakePipeTShapeTRChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
1082                                                           theRL, theWL, theLtransL, theLthinL,
1083                                                           theRR, theWR, theLtransR, theLthinR,
1084                                                           theRI, theWI, theLtransI, theLthinI,
1085                                                           theH, theW, theHexMesh, myPoint1, myPoint2, myPoint3);
1086     else
1087       anObj = anOper->MakePipeTShapeTRChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
1088                                               theRL, theWL, theLtransL, theLthinL,
1089                                               theRR, theWR, theLtransR, theLthinR,
1090                                               theRI, theWI, theLtransI, theLthinI,
1091                                               theH, theW, theHexMesh);
1092   }
1093   else if (FilletGroupParams->GroupBox1->isChecked()) {
1094     if (JunctionPointsSel->GroupBox1->isChecked())
1095       anObj = anOper->MakePipeTShapeTRFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
1096                                                          theRL, theWL, theLtransL, theLthinL,
1097                                                          theRR, theWR, theLtransR, theLthinR,
1098                                                          theRI, theWI, theLtransI, theLthinI,
1099                                                          theRF, theHexMesh, myPoint1, myPoint2, myPoint3);
1100     else
1101       anObj = anOper->MakePipeTShapeTRFillet(theR1, theW1, theL1, theR2, theW2, theL2,
1102                                              theRL, theWL, theLtransL, theLthinL,
1103                                              theRR, theWR, theLtransR, theLthinR,
1104                                              theRI, theWI, theLtransI, theLthinI,
1105                                              theRF, theHexMesh);
1106   }
1107   else {
1108     if (JunctionPointsSel->GroupBox1->isChecked())
1109       anObj = anOper->MakePipeTShapeTRWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
1110                                                    theRL, theWL, theLtransL, theLthinL,
1111                                                    theRR, theWR, theLtransR, theLthinR,
1112                                                    theRI, theWI, theLtransI, theLthinI,
1113                                                    theHexMesh, myPoint1, myPoint2, myPoint3);
1114     else
1115       anObj = anOper->MakePipeTShapeTR(theR1, theW1, theL1, theR2, theW2, theL2,
1116                                        theRL, theWL, theLtransL, theLthinL,
1117                                        theRR, theWR, theLtransR, theLthinR,
1118                                        theRI, theWI, theLtransI, theLthinI,
1119                                        theHexMesh);
1120   }
1121
1122   res = anObj->length();
1123   if (!res)
1124     return false;
1125
1126   //res = !anObj->_is_nil();
1127   if (res && !IsPreview()) {
1128     QStringList aParameters;
1129     //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
1130     aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
1131     aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
1132     aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
1133     aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
1134     aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
1135     aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
1136
1137     if (ChamferGroupParams->GroupBox1->isChecked()) { // Chamfer parameter
1138       aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
1139       aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
1140     }
1141     if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
1142       aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
1143
1144     // Thickness reductions
1145     if (LReductionGroupParams->GroupBox1->isChecked()) {
1146       aParameters << LReductionGroupParams->SpinBox1->text();
1147       aParameters << LReductionGroupParams->SpinBox2->text();
1148       aParameters << LReductionGroupParams->SpinBox3->text();
1149       aParameters << LReductionGroupParams->SpinBox4->text();
1150     }
1151     else {
1152       aParameters << "0" << "0" << "0" << "0";
1153     }
1154     if (RReductionGroupParams->GroupBox1->isChecked()) {
1155       aParameters << RReductionGroupParams->SpinBox1->text();
1156       aParameters << RReductionGroupParams->SpinBox2->text();
1157       aParameters << RReductionGroupParams->SpinBox3->text();
1158       aParameters << RReductionGroupParams->SpinBox4->text();
1159     }
1160     else {
1161       aParameters << "0" << "0" << "0" << "0";
1162     }
1163     if (IReductionGroupParams->GroupBox1->isChecked()) {
1164       aParameters << IReductionGroupParams->SpinBox1->text();
1165       aParameters << IReductionGroupParams->SpinBox2->text();
1166       aParameters << IReductionGroupParams->SpinBox3->text();
1167       aParameters << IReductionGroupParams->SpinBox4->text();
1168     }
1169     else {
1170       aParameters << "0" << "0" << "0" << "0";
1171     }
1172
1173     if (aParameters.count() > 0)
1174       anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
1175   }
1176
1177   objects.push_back(anObj[0]._retn());
1178   pipeTShapeGroupObjects.clear();
1179   for (int i = 1, n = anObj->length(); i < n; i++) {
1180     pipeTShapeGroupObjects.push_back(anObj[i]._retn());
1181   }
1182
1183   return objects.size() > 0;
1184 }
1185
1186 //=================================================================================
1187 // function : restoreSubShapes
1188 // purpose  :
1189 //=================================================================================
1190 void AdvancedGUI_PipeTShapeDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
1191                                                   SALOMEDS::SObject_ptr theSObject)
1192 {
1193   SALOMEDS::GenericAttribute_var anAttr;
1194   if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
1195     return;
1196
1197   SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
1198   CORBA::String_var anIORso = anAttrIOR->Value();
1199
1200   // get Object from SObject
1201   GEOM::GEOM_Object_var theFather =
1202     GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
1203   if (CORBA::is_nil(theFather))
1204     return;
1205
1206   ObjectList::iterator it = pipeTShapeGroupObjects.begin();
1207
1208   for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
1209     getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);
1210   }
1211 }
1212
1213 //=================================================================================
1214 // function : processPreview()
1215 // purpose  : Display preview if CheckBoxPreview is checked
1216 //=================================================================================
1217 void AdvancedGUI_PipeTShapeDlg::processPreview()
1218 {
1219   if (mainFrame()->CheckBoxPreview->isChecked())
1220     DisplayPreview();
1221   else
1222     erasePreview(true);
1223 }
1224
1225 //=================================================================================
1226 // function : AdvancedGUI_4Spin
1227 // purpose  :
1228 //=================================================================================
1229 AdvancedGUI_4Spin::AdvancedGUI_4Spin()
1230 {
1231   GroupBox1 = new QGroupBox ();
1232
1233   gridLayout1 = new QGridLayout (GroupBox1);
1234   gridLayout1->setSpacing(6);
1235   gridLayout1->setContentsMargins(11, 11, 11, 11);
1236   gridLayout1->setHorizontalSpacing(6);
1237   gridLayout1->setVerticalSpacing(6);
1238   gridLayout1->setContentsMargins(9, 9, 9, 9);
1239
1240   TextLabel1 = new QLabel (GroupBox1);
1241   TextLabel2 = new QLabel (GroupBox1);
1242   TextLabel3 = new QLabel (GroupBox1);
1243   TextLabel4 = new QLabel (GroupBox1);
1244
1245   SpinBox1 = new SalomeApp_DoubleSpinBox (GroupBox1);
1246   SpinBox2 = new SalomeApp_DoubleSpinBox (GroupBox1);
1247   SpinBox3 = new SalomeApp_DoubleSpinBox (GroupBox1);
1248   SpinBox4 = new SalomeApp_DoubleSpinBox (GroupBox1);
1249
1250   SpinBox1->setMinimumWidth(60);
1251   SpinBox2->setMinimumWidth(60);
1252   SpinBox3->setMinimumWidth(60);
1253   SpinBox4->setMinimumWidth(60);
1254
1255   gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1);
1256   gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1);
1257   gridLayout1->addWidget(TextLabel3, 2, 0, 1, 1);
1258   gridLayout1->addWidget(TextLabel4, 3, 0, 1, 1);
1259
1260   gridLayout1->addWidget(SpinBox1, 0, 1, 1, 1);
1261   gridLayout1->addWidget(SpinBox2, 1, 1, 1, 1);
1262   gridLayout1->addWidget(SpinBox3, 2, 1, 1, 1);
1263   gridLayout1->addWidget(SpinBox4, 3, 1, 1, 1);
1264 }
1265
1266 //=================================================================================
1267 // function : ~AdvancedGUI_4Spin()
1268 // purpose  : Destroys the object and frees any allocated resources
1269 //=================================================================================
1270 AdvancedGUI_4Spin::~AdvancedGUI_4Spin()
1271 {
1272   // no need to delete child widgets, Qt does it all for us
1273 }