libyui-qt
2.42.4
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
YQComboBox.h
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YQComboBox.h
20
21
Author: Stefan Hundhammer <sh@suse.de>
22
23
/-*/
24
25
26
#ifndef YQComboBox_h
27
#define YQComboBox_h
28
29
#include <QFrame>
30
#include <yui/YComboBox.h>
31
32
class
YQWidgetCaption
;
33
class
QComboBox;
34
class
QY2CharValidator
;
35
36
37
class
YQComboBox
:
public
QFrame,
public
YComboBox
38
{
39
Q_OBJECT
40
41
public
:
42
/**
43
* Constructor.
44
**/
45
YQComboBox
( YWidget * parent,
const
std::string & label,
bool
editable );
46
47
/**
48
* Destructor.
49
**/
50
~YQComboBox
();
51
52
/**
53
* Add one item. This widget assumes ownership of the item object and will
54
* delete it in its destructor.
55
*
56
* Reimplemented from YComboBox.
57
**/
58
virtual
void
addItem
( YItem * item );
59
60
/**
61
* Delete all items.
62
*
63
* Reimplemented from YSelectionWidget.
64
**/
65
virtual
void
deleteAllItems
();
66
67
/**
68
* Change the label text.
69
*
70
* Reimplemented from YSelectionWidget.
71
**/
72
virtual
void
setLabel
(
const
std::string & label );
73
74
/**
75
* Change the valid input characters.
76
*
77
* Reimplemented from YComboBox.
78
**/
79
virtual
void
setValidChars
(
const
std::string & validChars );
80
81
/**
82
* Specify the amount of characters which can be inserted.
83
*
84
* Reimplemented from YComboBox.
85
**/
86
virtual
void
setInputMaxLength
(
int
numberOfChars );
87
88
/**
89
* Returns 'true' if the given text is valid according to the current
90
* setting of ValidChars.
91
**/
92
bool
isValidText
(
const
QString & txt )
const
;
93
94
/**
95
* Set enabled / disabled state.
96
*
97
* Reimplemented from YWidget.
98
**/
99
virtual
void
setEnabled
(
bool
enabled );
100
101
/**
102
* Preferred width of the widget.
103
*
104
* Reimplemented from YWidget.
105
**/
106
virtual
int
preferredWidth
();
107
108
/**
109
* Preferred height of the widget.
110
*
111
* Reimplemented from YWidget.
112
**/
113
virtual
int
preferredHeight
();
114
115
/**
116
* Set the new size of the widget.
117
*
118
* Reimplemented from YWidget.
119
**/
120
virtual
void
setSize
(
int
newWidth,
int
newHeight );
121
122
/**
123
* Accept the keyboard focus.
124
**/
125
virtual
bool
setKeyboardFocus
();
126
127
128
protected
slots:
129
130
/**
131
* Tells the ui that an item has been selected. This is only
132
* interesting if the `notify option is set.
133
**/
134
void
slotSelected
(
int
i );
135
136
/**
137
* Tells the ui that the user has edited the text ( if the
138
* 'editable' option is set ).
139
* This is only interesting if the `notify option is set.
140
**/
141
void
textChanged
( QString );
142
143
144
protected
:
145
146
/**
147
* Return this ComboBox's current value as text.
148
*
149
* Called internally from value(), selectedItem() and related.
150
*
151
* Implemented from YComboBox.
152
**/
153
virtual
std::string
text
();
154
155
/**
156
*
157
* Set this ComboBox's current value as text.
158
*
159
* Called internally whenever the content is to change
160
* programmatically. Don't call setValue() or selectItem() from here.
161
*
162
* Implemented from YComboBox.
163
**/
164
virtual
void
setText
(
const
std::string & newText );
165
166
167
//
168
// Data members
169
//
170
171
YQWidgetCaption
* _caption;
172
QComboBox * _qt_comboBox;
173
QY2CharValidator
* _validator;
174
};
175
176
177
#endif // YQLabel_h
src
YQComboBox.h
Generated by
1.8.3