1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/****************************************************************************
** Form implementation generated from reading ui file 'namedialog.ui'
**
** Created: Sat Dec 15 04:36:20 2001
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "namedialog.h"
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a NameDialog which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
NameDialog::NameDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "NameDialog" );
resize( 176, 65 );
setCaption( tr( "Enter A Name" ) );
NameDialogLayout = new QGridLayout( this );
NameDialogLayout->setSpacing( 6 );
NameDialogLayout->setMargin( 5 );
Name = new QLineEdit( this, "Name" );
NameDialogLayout->addMultiCellWidget( Name, 0, 0, 0, 1 );
cancel = new QPushButton( this, "Cancel" );
cancel->setText( tr( "&Cancel" ) );
NameDialogLayout->addWidget( cancel, 1, 1 );
ok = new QPushButton( this, "ok" );
ok->setText( tr( "&Ok" ) );
NameDialogLayout->addWidget( ok, 1, 0 );
connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( Name, SIGNAL(returnPressed () ), this, SLOT(accept() ) );
}
QString NameDialog::go(){
if( exec() ) //pressed OK
return (Name->text());
else //pressed cancel
return QString();
}
|