1 #include "STD_CloseDlg.h"
3 #include <qpushbutton.h>
4 #include <qhbuttongroup.h>
7 #include <qmessagebox.h>
11 //================================================================================
13 * \brief creates a Close dialog box
14 * \param parent a parent widget
15 * \param modal bool argument, if true the dialog box is a modal dialog box
16 * \param f style flags
19 //================================================================================
21 STD_CloseDlg::STD_CloseDlg ( QWidget * parent, bool modal, WFlags f )
22 : QDialog ( parent, "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
24 setSizeGripEnabled ( TRUE ) ;
25 setCaption( tr( "CLOSE_DLG_CAPTION" ) );
27 QVBoxLayout* m_vbL = new QVBoxLayout( this );
28 m_vbL->setMargin( 11 ); m_vbL->setSpacing( 6 );
30 QLabel* m_lIcon = new QLabel (this, "m_lDescr");
31 QPixmap pm = QMessageBox::standardIcon( QMessageBox::Warning );
32 m_lIcon->setPixmap( pm );
33 m_lIcon->setScaledContents( false );
34 m_lIcon->setAlignment( Qt::AlignCenter );
36 QLabel* m_lDescr = new QLabel (this, "m_lDescr");
37 m_lDescr->setText ( tr ("CLOSE_DLG_DESCRIPTION") );
38 m_lDescr->setAlignment( Qt::AlignCenter );
39 m_lDescr->setMinimumHeight( m_lDescr->sizeHint().height()*5 );
40 m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
42 QHBoxLayout* m_hl1 = new QHBoxLayout();
43 m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
44 m_hl1->addWidget( m_lIcon );
45 m_hl1->addWidget( m_lDescr );
47 m_pb1 = new QPushButton( tr ("CLOSE_DLG_SAVE_CLOSE"), this );
48 m_pb2 = new QPushButton( tr ("CLOSE_DLG_CLOSE"), this );
49 m_pb3 = new QPushButton( tr ("CLOSE_DLG_UNLOAD"), this );
50 m_pb4 = new QPushButton( tr ("BUT_CANCEL"), this );
52 QGridLayout* m_hl2 = new QGridLayout();
53 m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
54 m_hl2->addWidget( m_pb1, 0, 0 );
55 m_hl2->addWidget( m_pb2, 0, 1 );
56 m_hl2->addWidget( m_pb3, 0, 2 );
57 m_hl2->addColSpacing( 3, 10 );
58 m_hl2->setColStretch( 3, 5 );
59 m_hl2->addWidget( m_pb4, 0, 4 );
61 m_vbL->addLayout( m_hl1 );
62 m_vbL->addLayout( m_hl2 );
64 connect( m_pb1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
65 connect( m_pb2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
66 connect( m_pb3, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
67 connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) );
70 //================================================================================
72 * \brief reaction on clicked(pressed) button
74 //================================================================================
76 void STD_CloseDlg::onButtonClicked()
78 QPushButton* btn = ( QPushButton* )sender();