libyui-qt
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 <shundhammer@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:
45  YQComboBox( YWidget * parent, const std::string & label, bool editable );
46 
50  ~YQComboBox();
51 
58  virtual void addItem( YItem * item );
59 
65  virtual void deleteAllItems();
66 
72  virtual void setLabel( const std::string & label );
73 
79  virtual void setValidChars( const std::string & validChars );
80 
86  virtual void setInputMaxLength( int numberOfChars );
87 
92  bool isValidText( const QString & txt ) const;
93 
99  virtual void setEnabled( bool enabled );
100 
106  virtual int preferredWidth();
107 
113  virtual int preferredHeight();
114 
120  virtual void setSize( int newWidth, int newHeight );
121 
125  virtual bool setKeyboardFocus();
126 
127 
128 protected slots:
129 
134  void slotSelected( int i );
135 
141  void textChanged( QString );
142 
143 
144 protected:
145 
153  virtual std::string text();
154 
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
Definition: YQComboBox.h:37
virtual void setValidChars(const std::string &validChars)
Definition: YQComboBox.cc:179
virtual std::string text()
Definition: YQComboBox.cc:111
virtual void setLabel(const std::string &label)
Definition: YQComboBox.cc:172
void textChanged(QString)
Definition: YQComboBox.cc:238
virtual void setEnabled(bool enabled)
Definition: YQComboBox.cc:270
~YQComboBox()
Definition: YQComboBox.cc:105
YQComboBox(YWidget *parent, const std::string &label, bool editable)
Definition: YQComboBox.cc:50
virtual void addItem(YItem *item)
Definition: YQComboBox.cc:140
virtual void deleteAllItems()
Definition: YQComboBox.cc:163
void slotSelected(int i)
Definition: YQComboBox.cc:224
virtual bool setKeyboardFocus()
Definition: YQComboBox.cc:278
virtual int preferredWidth()
Definition: YQComboBox.cc:252
Definition: YQWidgetCaption.h:38
virtual void setSize(int newWidth, int newHeight)
Definition: YQComboBox.cc:264
virtual int preferredHeight()
Definition: YQComboBox.cc:258
virtual void setInputMaxLength(int numberOfChars)
Definition: YQComboBox.cc:245
virtual void setText(const std::string &newText)
Definition: YQComboBox.cc:117
Definition: QY2CharValidator.h:34
bool isValidText(const QString &txt) const
Definition: YQComboBox.cc:212