1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : GEOMBase_aWarningDlg.cxx
25 // Author : Dmitry Matveitchev
27 // $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOMBase/GEOMBase_aWarningDlg.cxx
29 #include "GEOMBase_aWarningDlg.h"
31 #include <qgroupbox.h>
33 #include <qpushbutton.h>
36 #include <qvalidator.h>
38 #include <qscrollview.h>
44 GEOMBase_aWarningDlg::GEOMBase_aWarningDlg( QWidget* parent, const char* name, const QString theText, int theNum )
45 :QDialog( parent, name )
50 resize(296, (120 + (14*theNum)) );
53 setCaption(name); /* appears on the title bar */
54 setSizeGripEnabled(TRUE);
56 QGridLayout* topLayout = new QGridLayout(this);
57 topLayout->setSpacing(6);
58 topLayout->setMargin(11);
60 QGroupBox* mainGrp = new QGroupBox(this, "mainGrp");
61 mainGrp->setColumnLayout(0, Qt::Vertical);
62 mainGrp->layout()->setSpacing(0);
63 mainGrp->layout()->setMargin(0);
65 QGridLayout* mainGrpLayout = new QGridLayout(mainGrp->layout());
66 mainGrpLayout->setAlignment(Qt::AlignTop);
67 mainGrpLayout ->setSpacing(6);
68 mainGrpLayout->setMargin(11);
69 topLayout->addWidget(mainGrp, 0, 0);
71 QLabel* TextLabel = new QLabel(mainGrp, "TextLabel");
72 TextLabel->setText( QObject::tr( "GEOM_REALLY_DELETE" ).arg( theNum ) );
73 mainGrpLayout->addWidget(TextLabel, 0, 0);
75 QScrollView* viewer = new QScrollView (mainGrp, "viewer");
76 viewer->setResizePolicy( QScrollView::AutoOneFit );
77 QLabel* TextLabel1 = new QLabel(viewer, "TextLabel1");
78 TextLabel1->setText( theText );
79 TextLabel1->setAlignment(Qt::AlignTop);
80 viewer->addChild(TextLabel1);
81 mainGrpLayout->addWidget(viewer, 1, 0);
85 QGroupBox* btnGrp = new QGroupBox(this, "btnGrp");
86 btnGrp->setColumnLayout(0, Qt::Vertical);
87 btnGrp->layout()->setSpacing(0);
88 btnGrp->layout()->setMargin(0);
89 QGridLayout* btnGrpLayout = new QGridLayout(btnGrp->layout());
90 btnGrpLayout->setAlignment(Qt::AlignTop);
91 btnGrpLayout->setSpacing(6);
92 btnGrpLayout->setMargin(11);
93 topLayout->addWidget(btnGrp, 1, 0);
96 myButtonOk = new QPushButton(btnGrp, "buttonOk");
97 myButtonOk->setText(tr("GEOM_BUT_YES"));
98 myButtonOk->setAutoDefault(TRUE);
99 btnGrpLayout->addWidget(myButtonOk, 0, 0);
101 btnGrpLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
104 myButtonCancel = new QPushButton(btnGrp, "buttonCancel");
105 myButtonCancel->setText(tr("GEOM_BUT_NO"));
106 myButtonCancel->setAutoDefault(TRUE);
107 myButtonCancel->setDefault(TRUE);
108 btnGrpLayout->addWidget(myButtonCancel, 0, 2);
110 /* signals and slots connections */
111 connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept()));
112 connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
116 //======================================================================================
117 // function : ~GEOMBase_aWarningDlg() destructor
118 // purpose : Destroys the object and frees any allocated resources
119 //======================================================================================
120 GEOMBase_aWarningDlg::~GEOMBase_aWarningDlg()
122 // no need to delete child widgets, Qt does it all for us