2 // File : SALOMEGUI_TrihedronSizeDlg.cxx
3 // Created : Fri Mar 22 16:34:27 2002
4 // Author : Nicolas REJNERI
7 // Copyright : Open CASCADE 2002
10 #include "SALOMEGUI_TrihedronSizeDlg.h"
12 #include <qbuttongroup.h>
14 #include <qpushbutton.h>
18 #define MARGIN_SIZE 11
19 #define SPACING_SIZE 6
20 #define MIN_SPIN_WIDTH 100
23 * Constructs a modal SALOMEGUI_TrihedronSizeDlg which is a child of 'parent'
26 SALOMEGUI_TrihedronSizeDlg::SALOMEGUI_TrihedronSizeDlg( QWidget* parent )
27 : QDialog( parent, "SALOMEGUI_TrihedronSizeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
29 setCaption( tr( "MEN_TRIHEDRON" ) );
30 setSizeGripEnabled( true );
32 QGridLayout* topLayout = new QGridLayout( this );
33 topLayout->setSpacing( SPACING_SIZE );
34 topLayout->setMargin( MARGIN_SIZE );
36 QGroupBox* trihedronGrp = new QGroupBox( this, "trihedronGrp" );
37 trihedronGrp->setColumnLayout( 0, Qt::Vertical );
38 trihedronGrp->layout()->setSpacing( 0 );
39 trihedronGrp->layout()->setMargin( 0 );
40 QGridLayout* trihedronGrpLayout = new QGridLayout( trihedronGrp->layout() );
41 trihedronGrpLayout->setAlignment( Qt::AlignTop );
42 trihedronGrpLayout->setSpacing( SPACING_SIZE );
43 trihedronGrpLayout->setMargin( MARGIN_SIZE );
45 QHBoxLayout* aBtnLayout = new QHBoxLayout;
46 aBtnLayout->setSpacing( SPACING_SIZE );
47 aBtnLayout->setMargin( 0 );
49 QPushButton* buttonOk = new QPushButton( this, "buttonOk" );
50 buttonOk->setText( tr( "BUT_OK" ) );
51 buttonOk->setAutoDefault( TRUE );
52 buttonOk->setDefault( TRUE );
54 QPushButton* buttonCancel = new QPushButton( this, "buttonCancel" );
55 buttonCancel->setText( tr( "BUT_CANCEL" ) );
56 buttonCancel->setAutoDefault( TRUE );
58 QLabel* TextLabel = new QLabel( trihedronGrp, "TextLabel" );
59 TextLabel->setText( tr( "MEN_TRIHEDRON_SIZE" ) );
61 SpinBox = new QSpinBox( 1, 999999999, 1, trihedronGrp, "SpinBox" );
62 SpinBox->setValue( 100 );
63 SpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
64 SpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
66 trihedronGrpLayout->addWidget(TextLabel, 0, 0);
67 trihedronGrpLayout->addWidget(SpinBox, 0, 1);
69 aBtnLayout->addWidget( buttonOk );
70 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
71 aBtnLayout->addWidget( buttonCancel );
73 topLayout->addWidget( trihedronGrp, 0, 0 );
74 topLayout->addLayout( aBtnLayout, 1, 0 );
76 // signals and slots connections
77 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
78 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
82 * Destroys the object and frees any allocated resources
84 SALOMEGUI_TrihedronSizeDlg::~SALOMEGUI_TrihedronSizeDlg()
86 // no need to delete child widgets, Qt does it all for us
90 Sets start trihedron size
92 void SALOMEGUI_TrihedronSizeDlg::setTrihedronSize(const int size)
94 SpinBox->setValue(size);
100 int SALOMEGUI_TrihedronSizeDlg::getTrihedronSize()
102 return SpinBox->value();