|
1 #include <qlabel.h> |
|
2 #include <qlineedit.h> |
|
3 #include <qstring.h> |
|
4 #include "inputfield.h" |
|
5 |
|
6 |
|
7 InputField::InputField( QWidget *parent, const char *name ) |
|
8 : QHBox( parent, name ) |
|
9 { |
|
10 labelbox = new QLabel( this ); |
|
11 textbox = new QLineEdit( this ); |
|
12 initWidget(); |
|
13 } |
|
14 |
|
15 InputField::InputField( const QString &mylabel, |
|
16 QWidget *parent, const char *name ) : QHBox( parent, name ) |
|
17 { |
|
18 labelbox = new QLabel( mylabel, this ); |
|
19 textbox = new QLineEdit( this ); |
|
20 initWidget(); |
|
21 } |
|
22 |
|
23 InputField::InputField( const QString &mylabel, const QString &mytext, |
|
24 QWidget *parent, const char *name ) : QHBox( parent, name ) |
|
25 { |
|
26 labelbox = new QLabel( mylabel, this ); |
|
27 textbox = new QLineEdit( mytext, this ); |
|
28 initWidget(); |
|
29 } |
|
30 |
|
31 void InputField::initWidget() |
|
32 { |
|
33 // Init widget config |
|
34 setStretchFactor( labelbox, 0 ); |
|
35 setStretchFactor( textbox, 1 ); |
|
36 setSpacing( 10 ); |
|
37 } |
|
38 |
|
39 void InputField::setText(QString &str) |
|
40 { |
|
41 textbox->setText(str); |
|
42 } |
|
43 |
|
44 void InputField::setLabel(QString &str) |
|
45 { |
|
46 labelbox->setText(str); |
|
47 } |
|
48 |
|
49 QString InputField::text() const |
|
50 { |
|
51 return textbox->text(); |
|
52 } |
|
53 |
|
54 QString InputField::label() const |
|
55 { |
|
56 return labelbox->text(); |
|
57 } |
|
58 |
|
59 QLabel* InputField::qLabel() |
|
60 { |
|
61 return labelbox; |
|
62 } |
|
63 |
|
64 QLineEdit* InputField::qLineEdit() |
|
65 { |
|
66 return textbox; |
|
67 } |