File: createitemdialog.cpp

package info (click to toggle)
libqinfinity 1.0~beta5-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 648 kB
  • ctags: 694
  • sloc: cpp: 4,943; makefile: 3
file content (51 lines) | stat: -rw-r--r-- 1,129 bytes parent folder | download
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
#include "createitemdialog.h"

#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>

#include "createitemdialog.moc"

CreateItemDialog::CreateItemDialog( const QString &text,
	QWidget *parent )
	: QDialog( parent )
{
	QHBoxLayout *nameLayout = new QHBoxLayout();
	QHBoxLayout *buttonLayout = new QHBoxLayout();
	QVBoxLayout *mainLayout = new QVBoxLayout();
	QLabel *nameLabel = new QLabel( text );
	itemEdit = new QLineEdit();
	cancelButton = new QPushButton( "cancel" );
	okButton = new QPushButton( "ok" );

	nameLayout->addWidget( nameLabel );
	nameLayout->addWidget( itemEdit );
	buttonLayout->addWidget( cancelButton );
	buttonLayout->addWidget( okButton );
	mainLayout->addLayout( nameLayout );
	mainLayout->addLayout( buttonLayout );
	setLayout( mainLayout );
	
	connect( okButton, SIGNAL(clicked(bool)),
		this, SLOT(ok()) );
	connect( cancelButton, SIGNAL(clicked(bool)),
		this, SLOT(cancel()) );
}

QString CreateItemDialog::itemName() const
{
	return itemEdit->text();
}

void CreateItemDialog::cancel()
{
	done(0);
}

void CreateItemDialog::ok()
{
	done(0);
}