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

KDEUI

  • kdeui
  • widgets
keditlistwidget.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 (C) 2010 Sebastian Trueg <trueg@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEDITLISTWIDGET_H
22#define KEDITLISTWIDGET_H
23
24#include <kdeui_export.h>
25
26#include <QtGui/QWidget>
27#include <QtGui/QStringListModel>
28
29class KLineEdit;
30class KComboBox;
31class QListView;
32class QPushButton;
33
34class KEditListWidgetPrivate;
48class KDEUI_EXPORT KEditListWidget : public QWidget
49{
50 Q_OBJECT
51
52 Q_FLAGS( Buttons )
53 Q_PROPERTY( Buttons buttons READ buttons WRITE setButtons )
54 Q_PROPERTY( QStringList items READ items WRITE setItems NOTIFY changed USER true )
55 Q_PROPERTY( bool checkAtEntering READ checkAtEntering WRITE setCheckAtEntering )
56
57public:
58 class CustomEditorPrivate;
59
63 class KDEUI_EXPORT CustomEditor
64 {
65 public:
66 CustomEditor();
67 CustomEditor( QWidget *repWidget, KLineEdit *edit );
68 CustomEditor( KComboBox *combo );
69 virtual ~CustomEditor();
70
71 void setRepresentationWidget( QWidget *repWidget );
72 void setLineEdit( KLineEdit *edit );
73
74 virtual QWidget *representationWidget() const;
75 virtual KLineEdit *lineEdit() const;
76
77 private:
78 friend class CustomEditorPrivate;
79 CustomEditorPrivate *const d;
80
81 Q_DISABLE_COPY(CustomEditor)
82 };
83
84 public:
85
90 enum Button {
91 Add = 0x0001,
92 Remove = 0x0002,
93 UpDown = 0x0004,
94 All = Add | Remove | UpDown
95 };
96
97 Q_DECLARE_FLAGS( Buttons, Button )
98
99
102 explicit KEditListWidget(QWidget *parent = 0);
103
115 KEditListWidget( const CustomEditor &customEditor,
116 QWidget *parent = 0,
117 bool checkAtEntering = false,
118 Buttons buttons = All );
119
120 virtual ~KEditListWidget();
121
125 QListView* listView() const;
129 KLineEdit* lineEdit() const;
133 QPushButton* addButton() const;
137 QPushButton* removeButton() const;
141 QPushButton* upButton() const;
145 QPushButton* downButton() const;
146
150 int count() const;
154 void insertStringList(const QStringList& list, int index=-1);
158 void insertItem(const QString& text, int index=-1);
162 void clear();
166 QString text(int index) const;
170 int currentItem() const;
174 QString currentText() const;
175
179 QStringList items() const;
180
184 void setItems(const QStringList& items);
185
189 Buttons buttons() const;
190
194 void setButtons( Buttons buttons );
195
207 void setCheckAtEntering(bool check);
208
212 bool checkAtEntering();
213
223 void setCustomEditor( const CustomEditor& editor );
224
228 bool eventFilter( QObject* o, QEvent* e );
229
230 Q_SIGNALS:
231 void changed();
232
237 void added( const QString & text );
238
243 void removed( const QString & text );
244
245 private Q_SLOTS:
246 void moveItemUp();
247 void moveItemDown();
248 void addItem();
249 void removeItem();
250 void enableMoveButtons(const QModelIndex&, const QModelIndex&);
251 void typedSomething(const QString& text);
252 void slotSelectionChanged( const QItemSelection& selected, const QItemSelection& deselected );
253
254 private:
255 friend class KEditListWidgetPrivate;
256 KEditListWidgetPrivate* const d;
257
258 Q_DISABLE_COPY(KEditListWidget)
259};
260
261Q_DECLARE_OPERATORS_FOR_FLAGS(KEditListWidget::Buttons)
262
263#endif
KComboBox
An enhanced combo box.
Definition: kcombobox.h:149
KEditListWidget::CustomEditor
Custom editor class.
Definition: keditlistwidget.h:64
KEditListWidget
An editable listbox.
Definition: keditlistwidget.h:49
KEditListWidget::removed
void removed(const QString &text)
This signal is emitted when the user removes a string from the list, the parameter is the removed str...
KEditListWidget::changed
void changed()
KEditListWidget::added
void added(const QString &text)
This signal is emitted when the user adds a new string to the list, the parameter is the added string...
KEditListWidget::checkAtEntering
bool checkAtEntering()
Returns true if check at entering is enabled.
KEditListWidget::Button
Button
Enumeration of the buttons, the listbox offers.
Definition: keditlistwidget.h:90
KLineEdit
An enhanced QLineEdit widget for inputting text.
Definition: klineedit.h:150
QListView
QObject
QPushButton
QWidget
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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