2 // File : VisuGUI_SelVectCompDlg.cxx
3 // Created : Wed Aug 01 10:23:06 2001
4 // Author : Laurent CORNABE & Hubert ROLLAND
7 // Copyright : PRINCIPIA
10 #include "VisuGUI_SelVectCompDlg.h"
16 VisuGUI_SelVectCompDlg::VisuGUI_SelVectCompDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
17 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
20 setName( "VisuGUI_SelVectCompDlg" );
21 setCaption( tr( "Vector Field" ) );
22 setSizeGripEnabled( true );
24 QVBoxLayout* TopLayout = new QVBoxLayout( this );
25 TopLayout->setSpacing( 6 );
26 TopLayout->setMargin( 11 );
28 Comment1_2 = new QLabel( tr( "Select a component of the vector, or modulus," ), this, "Comment1_2" );
29 Comment1_2->setAlignment( AlignCenter );
31 Comment2_2 = new QLabel( tr( "to be displayed as a scalar result" ), this, "Comment2_2" );
32 Comment2_2->setAlignment( AlignCenter );
34 SelComp = new QButtonGroup( this, "SelComp" );
35 SelComp->setColumnLayout(0, Qt::Vertical );
36 SelComp->layout()->setSpacing( 0 );
37 SelComp->layout()->setMargin( 0 );
38 QGridLayout* SelCompLayout = new QGridLayout( SelComp->layout() );
39 SelCompLayout->setAlignment( Qt::AlignTop );
40 SelCompLayout->setSpacing( 6 );
41 SelCompLayout->setMargin( 11 );
43 Comp1 = new QRadioButton( tr( "Component 1" ), SelComp, "Comp1" );
44 SelCompLayout->addWidget( Comp1, 0, 0 );
46 Modulus = new QRadioButton( tr( "Modulus" ), SelComp, "Modulus" );
47 Modulus->setChecked( TRUE );
48 SelCompLayout->addWidget( Modulus, 0, 1 );
50 Comp2 = new QRadioButton( tr( "Component 2" ), SelComp, "Comp2" );
51 SelCompLayout->addWidget( Comp2, 1, 0 );
53 Comp3 = new QRadioButton( tr( "Component 3" ), SelComp, "Comp3" );
54 SelCompLayout->addWidget( Comp3, 2, 0 );
56 GroupButtons = new QGroupBox( this, "GroupButtons" );
57 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
58 GroupButtons->setTitle( tr( "" ) );
59 GroupButtons->setColumnLayout(0, Qt::Vertical );
60 GroupButtons->layout()->setSpacing( 0 );
61 GroupButtons->layout()->setMargin( 0 );
62 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
63 GroupButtonsLayout->setAlignment( Qt::AlignTop );
64 GroupButtonsLayout->setSpacing( 6 );
65 GroupButtonsLayout->setMargin( 11 );
67 buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
68 buttonOk->setAutoDefault( TRUE );
69 buttonOk->setDefault( TRUE );
70 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
71 GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
72 buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
73 buttonCancel->setAutoDefault( TRUE );
74 GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
76 TopLayout->addWidget( Comment1_2, 0, 0 );
77 TopLayout->addWidget( Comment2_2, 1, 0 );
78 TopLayout->addWidget( SelComp, 2, 0 );
79 TopLayout->addWidget( GroupButtons, 3, 0 );
81 // signals and slots connections
82 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
83 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
89 VisuGUI_SelVectCompDlg::~VisuGUI_SelVectCompDlg()
96 int VisuGUI_SelVectCompDlg::whatIsChecked()
99 if ( Modulus->isChecked() )
101 else if ( Comp1->isChecked() )
103 else if ( Comp2->isChecked() )
105 else if ( Comp3->isChecked() )