Debian Codegraph @

libavqt/okdialog.cpp

raw symbols SCIP
1 #include "okdialog.h"
2 #include "okdialog.moc"
3
4 #include <qlayout.h>
5 #include <qhbox.h>
6 #include <qpushbutton.h>
7
8 QavmOkDialog::QavmOkDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
9 :QDialog( parent, name, modal, fl ), m_bApplyEnabled(false),
10 m_bOkDefault(true)
11 {
12 setCaption( name );
13 m_pGl = new QGridLayout( this, 1, 1 );
14 m_pGl->setMargin( 5 );
15 m_pGl->setSpacing( 5 );
16 }
17
18 void QavmOkDialog::apply()
19 {
20 // to be overloaded
21 }
22
23 int QavmOkDialog::exec()
24 {
25 QGridLayout* tgl = new QGridLayout( 0, 1, 3 );
26 int col = 1;
27 QPushButton* ok = new QPushButton( tr( "&Ok" ), this );
28 if (m_bOkDefault)
29 ok->setDefault( TRUE );
30 else
31 ok->setAutoDefault( TRUE );
32 tgl->addWidget( ok, 0, col++ );
33 if (m_bApplyEnabled)
34 {
35 QPushButton* apply = new QPushButton( tr( "&Apply" ), this );
36 connect( apply, SIGNAL( clicked() ), this, SLOT( apply() ) );
37 tgl->addWidget( apply, 0, col++ );
38 }
39
40 QPushButton* cancel = new QPushButton( tr( "&Cancel" ), this );
41 tgl->addWidget( cancel, 0, col );
42 tgl->setColStretch( 0, 1 );
43
44 m_pGl->addMultiCell( tgl, m_pGl->numRows(), m_pGl->numRows(),
45 0, m_pGl->numCols() - 1 );
46
47 connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
48 connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
49
50 return QDialog::exec();
51 }