• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • widgets
keditlistbox.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KEDITLISTBOX_H
21 #define KEDITLISTBOX_H
22 
23 #include <kdeui_export.h>
24 
25 #include <QtGui/QGroupBox>
26 #include <QtGui/QStringListModel>
27 
28 class KLineEdit;
29 class KComboBox;
30 class QListView;
31 class QPushButton;
32 
33 class KEditListBoxPrivate;
39 class KDEUI_EXPORT KEditListBox : public QGroupBox
40 {
41  Q_OBJECT
42 
43  Q_FLAGS( Buttons )
44  Q_PROPERTY( Buttons buttons READ buttons WRITE setButtons )
45  Q_PROPERTY( QStringList items READ items WRITE setItems NOTIFY changed USER true )
46 
47 public:
48  class CustomEditorPrivate;
49 
53  class KDEUI_EXPORT CustomEditor
54  {
55  public:
56  CustomEditor();
57  CustomEditor( QWidget *repWidget, KLineEdit *edit );
58  CustomEditor( KComboBox *combo );
59  virtual ~CustomEditor();
60 
61  void setRepresentationWidget( QWidget *repWidget );
62  void setLineEdit( KLineEdit *edit );
63 
64  virtual QWidget *representationWidget() const;
65  virtual KLineEdit *lineEdit() const;
66 
67  private:
68  friend class CustomEditorPrivate;
69  CustomEditorPrivate *const d;
70 
71  Q_DISABLE_COPY(CustomEditor)
72  };
73 
74  public:
75 
80  enum Button {
81  Add = 0x0001,
82  Remove = 0x0002,
83  UpDown = 0x0004,
84  All = Add | Remove | UpDown
85  };
86 
87  Q_DECLARE_FLAGS( Buttons, Button )
88 
89 
92  explicit KEditListBox(QWidget *parent = 0);
93 
100  explicit KEditListBox(const QString& title, QWidget *parent = 0);
101 
102 // ### KDE5: remove name arguments and simplify (merge?!) constructors
103 
118  explicit KDE_DEPRECATED KEditListBox(QWidget *parent, const char *name,
119  bool checkAtEntering = false, Buttons buttons = All );
128  explicit KDE_DEPRECATED KEditListBox(const QString& title, QWidget *parent,
129  const char *name, bool checkAtEntering = false,
130  Buttons buttons = All );
131 
143  KEditListBox( const QString& title,
144  const CustomEditor &customEditor,
145  QWidget *parent = 0, const char *name = 0,
146  bool checkAtEntering = false, Buttons buttons = All );
147 
148  virtual ~KEditListBox();
149 
153  QListView* listView() const;
157  KLineEdit* lineEdit() const;
161  QPushButton* addButton() const;
165  QPushButton* removeButton() const;
169  QPushButton* upButton() const;
173  QPushButton* downButton() const;
174 
178  int count() const;
182  void insertStringList(const QStringList& list, int index=-1);
186  void insertItem(const QString& text, int index=-1);
190  void clear();
194  QString text(int index) const;
198  int currentItem() const;
202  QString currentText() const;
203 
207  QStringList items() const;
208 
212  void setItems(const QStringList& items);
213 
217  Buttons buttons() const;
218 
222  void setButtons( Buttons buttons );
223 
235  void setCheckAtEntering(bool check);
236 
240  bool checkAtEntering();
241 
253  void setCustomEditor( const CustomEditor& editor );
254 
258  bool eventFilter( QObject* o, QEvent* e );
259 
260  Q_SIGNALS:
261  void changed();
262 
267  void added( const QString & text );
268 
273  void removed( const QString & text );
274 
275  protected Q_SLOTS: // KDE5: make private?
276  void moveItemUp();
277  void moveItemDown();
278  void addItem();
279  void removeItem();
280  void enableMoveButtons(const QModelIndex&, const QModelIndex&);
281  void typedSomething(const QString& text);
282 
283  private Q_SLOTS:
284  void slotSelectionChanged( const QItemSelection& selected, const QItemSelection& deselected );
285 
286  private:
287  friend class KEditListBoxPrivate;
288  KEditListBoxPrivate* const d;
289 
290  Q_DISABLE_COPY(KEditListBox)
291 };
292 
293 Q_DECLARE_OPERATORS_FOR_FLAGS(KEditListBox::Buttons)
294 
295 #endif
QModelIndex
QEvent
QWidget
KStandardGuiItem::Remove
Definition: kstandardguiitem.h:52
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KStandardGuiItem::Add
Definition: kstandardguiitem.h:52
KEditListBox::CustomEditor
Custom editor class.
Definition: keditlistbox.h:53
QListView
QGroupBox
QObject
KStandardAction::clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
Clear the content of the focus widget.
Definition: kstandardaction.cpp:314
QString
QStringList
KEditListBox::Button
Button
Enumeration of the buttons, the listbox offers.
Definition: keditlistbox.h:80
QItemSelection
KEditListBox
An editable listbox.
Definition: keditlistbox.h:39
KLineEdit
An enhanced QLineEdit widget for inputting text.
Definition: klineedit.h:149
KComboBox
An enhanced combo box.
Definition: kcombobox.h:148
kdeui_export.h
QPushButton
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal