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