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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • widgets
keditlistwidget.cpp
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) 2000, 2002 Carsten Pfeiffer <pfeiffer@kde.org>
4  (C) 2010 Sebastian Trueg <trueg@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "keditlistwidget.h"
23 
24 #include <QtCore/QStringList>
25 #include <QtGui/QKeyEvent>
26 #include <QtGui/QLabel>
27 #include <QtGui/QLayout>
28 #include <QtGui/QListView>
29 
30 #include <kcombobox.h>
31 #include <kdebug.h>
32 #include <kdialog.h>
33 #include <klineedit.h>
34 #include <klocale.h>
35 #include <knotification.h>
36 #include <kpushbutton.h>
37 
38 #include <assert.h>
39 
40 class KEditListWidgetPrivate
41 {
42 public:
43  KEditListWidgetPrivate( KEditListWidget* parent )
44  : lineEdit(0),
45  editingWidget(0),
46  q(parent) {
47  }
48  QListView *listView;
49  QPushButton *servUpButton, *servDownButton;
50  QPushButton *servNewButton, *servRemoveButton;
51  KLineEdit *lineEdit;
52  QWidget* editingWidget;
53  QVBoxLayout* mainLayout;
54  QVBoxLayout* btnsLayout;
55  QStringListModel *model;
56 
57  bool checkAtEntering;
58  KEditListWidget::Buttons buttons;
59 
60  void init( bool check = false, KEditListWidget::Buttons buttons = KEditListWidget::All,
61  QWidget *representationWidget = 0 );
62  void setEditor( KLineEdit* lineEdit, QWidget* representationWidget = 0 );
63  void updateButtonState();
64  QModelIndex selectedIndex();
65 
66 private:
67  KEditListWidget* q;
68 };
69 
70 
71 void KEditListWidgetPrivate::init( bool check, KEditListWidget::Buttons newButtons,
72  QWidget *representationWidget )
73 {
74  checkAtEntering = check;
75 
76  servNewButton = servRemoveButton = servUpButton = servDownButton = 0L;
77  q->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
78  QSizePolicy::Preferred));
79 
80  mainLayout = new QVBoxLayout(q);
81 
82  QHBoxLayout* subLayout = new QHBoxLayout;
83  btnsLayout = new QVBoxLayout;
84  btnsLayout->addStretch();
85 
86  model = new QStringListModel();
87  listView = new QListView(q);
88  listView->setModel(model);
89 
90  subLayout->addWidget(listView);
91  subLayout->addLayout(btnsLayout);
92 
93  mainLayout->insertLayout(1, subLayout);
94 
95  setEditor( lineEdit, representationWidget );
96 
97  buttons = 0;
98  q->setButtons( newButtons );
99 
100  q->connect(listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
101  SLOT(slotSelectionChanged(QItemSelection,QItemSelection)));
102 }
103 
104 
105 void KEditListWidgetPrivate::setEditor( KLineEdit* newLineEdit, QWidget* representationWidget )
106 {
107  if (editingWidget != lineEdit &&
108  editingWidget != representationWidget) {
109  delete editingWidget;
110  }
111  if (lineEdit != newLineEdit) {
112  delete lineEdit;
113  }
114  lineEdit = newLineEdit ? newLineEdit : new KLineEdit(q);
115  editingWidget = representationWidget ?
116  representationWidget : lineEdit;
117 
118  if ( representationWidget )
119  representationWidget->setParent(q);
120 
121  mainLayout->insertWidget(0,editingWidget);
122 
123  lineEdit->setTrapReturnKey(true);
124  lineEdit->installEventFilter(q);
125 
126  q->connect(lineEdit,SIGNAL(textChanged(QString)),SLOT(typedSomething(QString)));
127  q->connect(lineEdit,SIGNAL(returnPressed()),SLOT(addItem()));
128 
129  // maybe supplied lineedit has some text already
130  q->typedSomething( lineEdit->text() );
131 
132 
133  // fix tab ordering
134  q->setTabOrder(editingWidget, listView);
135  QWidget* w = listView;
136  if (servNewButton) {
137  q->setTabOrder(w,servNewButton);
138  w = servNewButton;
139  }
140  if (servRemoveButton) {
141  q->setTabOrder(w,servRemoveButton);
142  w = servRemoveButton;
143  }
144  if (servUpButton) {
145  q->setTabOrder(w,servUpButton);
146  w = servUpButton;
147  }
148  if (servDownButton) {
149  q->setTabOrder(w,servDownButton);
150  w = servDownButton;
151  }
152 }
153 
154 
155 void KEditListWidgetPrivate::updateButtonState()
156 {
157  QModelIndex index = selectedIndex();
158  if (servUpButton) {
159  servUpButton->setEnabled(index.isValid());
160  }
161  if (servDownButton) {
162  servDownButton->setEnabled(index.isValid());
163  }
164  if (servRemoveButton) {
165  servRemoveButton->setEnabled(index.isValid());
166  }
167 }
168 
169 QModelIndex KEditListWidgetPrivate::selectedIndex()
170 {
171  QItemSelectionModel *selection = listView->selectionModel();
172  const QModelIndexList selectedIndexes = selection->selectedIndexes();
173  if ( !selectedIndexes.isEmpty() && selectedIndexes[0].isValid() )
174  return selectedIndexes[0];
175  else
176  return QModelIndex();
177 }
178 
179 
180 class KEditListWidget::CustomEditorPrivate
181 {
182 public:
183  CustomEditorPrivate(KEditListWidget::CustomEditor *q):
184  q(q),
185  representationWidget(0),
186  lineEdit(0) {}
187 
188  KEditListWidget::CustomEditor *q;
189  QWidget *representationWidget;
190  KLineEdit *lineEdit;
191 };
192 
193 KEditListWidget::CustomEditor::CustomEditor()
194  : d(new CustomEditorPrivate(this))
195 {
196 }
197 
198 KEditListWidget::CustomEditor::CustomEditor( QWidget *repWidget, KLineEdit *edit )
199  : d(new CustomEditorPrivate(this))
200 {
201  d->representationWidget = repWidget;
202  d->lineEdit = edit;
203 }
204 
205 KEditListWidget::CustomEditor::CustomEditor( KComboBox *combo )
206  : d(new CustomEditorPrivate(this))
207 {
208  d->representationWidget = combo;
209  d->lineEdit = qobject_cast<KLineEdit*>( combo->lineEdit() );
210  Q_ASSERT( d->lineEdit );
211 }
212 
213 KEditListWidget::CustomEditor::~CustomEditor()
214 {
215  delete d;
216 }
217 
218 void KEditListWidget::CustomEditor::setRepresentationWidget( QWidget *repWidget )
219 {
220  d->representationWidget = repWidget;
221 }
222 
223 void KEditListWidget::CustomEditor::setLineEdit( KLineEdit *edit )
224 {
225  d->lineEdit = edit;
226 }
227 
228 QWidget *KEditListWidget::CustomEditor::representationWidget() const
229 {
230  return d->representationWidget;
231 }
232 
233 KLineEdit *KEditListWidget::CustomEditor::lineEdit() const
234 {
235  return d->lineEdit;
236 }
237 
238 KEditListWidget::KEditListWidget(QWidget *parent)
239  : QWidget(parent), d(new KEditListWidgetPrivate(this))
240 {
241  d->init();
242 }
243 
244 KEditListWidget::KEditListWidget(const CustomEditor& custom,
245  QWidget *parent,
246  bool checkAtEntering,
247  Buttons buttons)
248  :QWidget(parent), d(new KEditListWidgetPrivate(this))
249 {
250  d->lineEdit = custom.lineEdit();
251  d->init( checkAtEntering, buttons, custom.representationWidget() );
252 }
253 
254 KEditListWidget::~KEditListWidget()
255 {
256  delete d;
257 }
258 
259 void KEditListWidget::setCustomEditor( const CustomEditor& editor )
260 {
261  d->setEditor( editor.lineEdit(), editor.representationWidget() );
262 }
263 
264 QListView *KEditListWidget::listView() const
265 {
266  return d->listView;
267 }
268 
269 KLineEdit *KEditListWidget::lineEdit() const
270 {
271  return d->lineEdit;
272 }
273 
274 QPushButton *KEditListWidget::addButton() const
275 {
276  return d->servNewButton;
277 }
278 
279 QPushButton *KEditListWidget::removeButton() const
280 {
281  return d->servRemoveButton;
282 }
283 
284 QPushButton *KEditListWidget::upButton() const
285 {
286  return d->servUpButton;
287 }
288 
289 QPushButton *KEditListWidget::downButton() const
290 {
291  return d->servDownButton;
292 }
293 
294 int KEditListWidget::count() const
295 {
296  return int(d->model->rowCount());
297 }
298 
299 void KEditListWidget::setButtons( Buttons buttons )
300 {
301  if ( d->buttons == buttons )
302  return;
303 
304  if ( ( buttons & Add ) && !d->servNewButton ) {
305  d->servNewButton = new KPushButton(KIcon("list-add"), i18n("&Add"), this);
306  d->servNewButton->setEnabled(false);
307  d->servNewButton->show();
308  connect(d->servNewButton, SIGNAL(clicked()), SLOT(addItem()));
309 
310  d->btnsLayout->insertWidget(0, d->servNewButton);
311  } else if ( ( buttons & Add ) == 0 && d->servNewButton ) {
312  delete d->servNewButton;
313  d->servNewButton = 0;
314  }
315 
316  if ( ( buttons & Remove ) && !d->servRemoveButton ) {
317  d->servRemoveButton = new KPushButton(KIcon("list-remove"), i18n("&Remove"), this);
318  d->servRemoveButton->setEnabled(false);
319  d->servRemoveButton->show();
320  connect(d->servRemoveButton, SIGNAL(clicked()), SLOT(removeItem()));
321 
322  d->btnsLayout->insertWidget(1, d->servRemoveButton);
323  } else if ( ( buttons & Remove ) == 0 && d->servRemoveButton ) {
324  delete d->servRemoveButton;
325  d->servRemoveButton = 0;
326  }
327 
328  if ( ( buttons & UpDown ) && !d->servUpButton ) {
329  d->servUpButton = new KPushButton(KIcon("arrow-up"), i18n("Move &Up"), this);
330  d->servUpButton->setEnabled(false);
331  d->servUpButton->show();
332  connect(d->servUpButton, SIGNAL(clicked()), SLOT(moveItemUp()));
333 
334  d->servDownButton = new KPushButton(KIcon("arrow-down"), i18n("Move &Down"), this);
335  d->servDownButton->setEnabled(false);
336  d->servDownButton->show();
337  connect(d->servDownButton, SIGNAL(clicked()), SLOT(moveItemDown()));
338 
339  d->btnsLayout->insertWidget(2, d->servUpButton);
340  d->btnsLayout->insertWidget(3, d->servDownButton);
341  } else if ( ( buttons & UpDown ) == 0 && d->servUpButton ) {
342  delete d->servUpButton; d->servUpButton = 0;
343  delete d->servDownButton; d->servDownButton = 0;
344  }
345 
346  d->buttons = buttons;
347 }
348 
349 void KEditListWidget::setCheckAtEntering(bool check)
350 {
351  d->checkAtEntering = check;
352 }
353 
354 bool KEditListWidget::checkAtEntering()
355 {
356  return d->checkAtEntering;
357 }
358 
359 void KEditListWidget::typedSomething(const QString& text)
360 {
361  if(currentItem() >= 0) {
362  if(currentText() != d->lineEdit->text())
363  {
364  // IMHO changeItem() shouldn't do anything with the value
365  // of currentItem() ... like changing it or emitting signals ...
366  // but TT disagree with me on this one (it's been that way since ages ... grrr)
367  bool block = d->listView->signalsBlocked();
368  d->listView->blockSignals( true );
369  QModelIndex currentIndex = d->selectedIndex();
370  if ( currentIndex.isValid() )
371  d->model->setData(currentIndex,text);
372  d->listView->blockSignals( block );
373  emit changed();
374  }
375  }
376 
377  if ( !d->servNewButton )
378  return;
379 
380  if ( !d->lineEdit->hasAcceptableInput() ) {
381  d->servNewButton->setEnabled(false);
382  return;
383  }
384 
385  if (!d->checkAtEntering)
386  d->servNewButton->setEnabled(!text.isEmpty());
387  else
388  {
389  if (text.isEmpty())
390  {
391  d->servNewButton->setEnabled(false);
392  }
393  else
394  {
395  QStringList list = d->model->stringList();
396  bool enable = !list.contains( text, Qt::CaseSensitive );
397  d->servNewButton->setEnabled( enable );
398  }
399  }
400 }
401 
402 void KEditListWidget::moveItemUp()
403 {
404  if (!d->listView->isEnabled())
405  {
406  KNotification::beep();
407  return;
408  }
409 
410  QModelIndex index = d->selectedIndex();
411  if ( index.isValid() ) {
412  if (index.row() == 0) {
413  KNotification::beep();
414  return;
415  }
416 
417  QModelIndex aboveIndex = d->model->index( index.row() - 1, index.column() );
418 
419  QString tmp = d->model->data( aboveIndex, Qt::DisplayRole ).toString();
420  d->model->setData( aboveIndex, d->model->data( index, Qt::DisplayRole ) );
421  d->model->setData( index, tmp );
422 
423  d->listView->selectionModel()->select(index, QItemSelectionModel::Deselect);
424  d->listView->selectionModel()->select(aboveIndex, QItemSelectionModel::Select);
425  }
426 
427  emit changed();
428 }
429 
430 void KEditListWidget::moveItemDown()
431 {
432  if (!d->listView->isEnabled())
433  {
434  KNotification::beep();
435  return;
436  }
437 
438  QModelIndex index = d->selectedIndex();
439  if ( index.isValid() ) {
440  if (index.row() == d->model->rowCount() - 1) {
441  KNotification::beep();
442  return;
443  }
444 
445  QModelIndex belowIndex = d->model->index( index.row() + 1, index.column() );
446 
447  QString tmp = d->model->data( belowIndex, Qt::DisplayRole ).toString();
448  d->model->setData( belowIndex, d->model->data( index, Qt::DisplayRole ) );
449  d->model->setData( index, tmp );
450 
451  d->listView->selectionModel()->select(index, QItemSelectionModel::Deselect);
452  d->listView->selectionModel()->select(belowIndex, QItemSelectionModel::Select);
453  }
454 
455  emit changed();
456 }
457 
458 void KEditListWidget::addItem()
459 {
460  // when checkAtEntering is true, the add-button is disabled, but this
461  // slot can still be called through Key_Return/Key_Enter. So we guard
462  // against this.
463  if ( !d->servNewButton || !d->servNewButton->isEnabled() )
464  return;
465 
466  QModelIndex currentIndex = d->selectedIndex();
467 
468  const QString& currentTextLE=d->lineEdit->text();
469  bool alreadyInList(false);
470  //if we didn't check for dupes at the inserting we have to do it now
471  if (!d->checkAtEntering)
472  {
473  // first check current item instead of dumb iterating the entire list
474  if ( currentIndex.isValid() ) {
475  if ( d->model->data( currentIndex, Qt::DisplayRole ).toString() == currentTextLE )
476  alreadyInList = true;
477  }
478  else
479  {
480  alreadyInList = d->model->stringList().contains( currentTextLE, Qt::CaseSensitive );
481  }
482  }
483  if ( d->servNewButton )
484  d->servNewButton->setEnabled(false);
485 
486  bool block = d->lineEdit->signalsBlocked();
487  d->lineEdit->blockSignals(true);
488  d->lineEdit->clear();
489  d->lineEdit->blockSignals(block);
490 
491  d->listView->selectionModel()->setCurrentIndex(currentIndex, QItemSelectionModel::Deselect);
492 
493  if (!alreadyInList)
494  {
495  block = d->listView->signalsBlocked();
496 
497  if ( currentIndex.isValid() ) {
498  d->model->setData(currentIndex, currentTextLE );
499  } else {
500  QStringList lst;
501  lst<<currentTextLE;
502  lst<<d->model->stringList();
503  d->model->setStringList(lst);
504  }
505  emit changed();
506  emit added( currentTextLE ); // TODO: pass the index too
507  }
508 
509  d->updateButtonState();
510 }
511 
512 int KEditListWidget::currentItem() const
513 {
514  QModelIndex selectedIndex = d->selectedIndex();
515  if ( selectedIndex.isValid() )
516  return selectedIndex.row();
517  else
518  return -1;
519 }
520 
521 void KEditListWidget::removeItem()
522 {
523  QModelIndex currentIndex = d->selectedIndex();
524  if ( !currentIndex.isValid() )
525  return;
526 
527  if ( currentIndex.row() >= 0 )
528  {
529  QString removedText = d->model->data( currentIndex, Qt::DisplayRole ).toString();
530 
531  d->model->removeRows( currentIndex.row(), 1 );
532 
533  d->listView->selectionModel()->clear();
534 
535  emit changed();
536 
537  emit removed( removedText );
538  }
539 
540  d->updateButtonState();
541 }
542 
543 void KEditListWidget::enableMoveButtons(const QModelIndex &newIndex, const QModelIndex&)
544 {
545  int index = newIndex.row();
546 
547  // Update the lineEdit when we select a different line.
548  if(currentText() != d->lineEdit->text())
549  d->lineEdit->setText(currentText());
550 
551  bool moveEnabled = d->servUpButton && d->servDownButton;
552 
553  if (moveEnabled )
554  {
555  if (d->model->rowCount() <= 1)
556  {
557  d->servUpButton->setEnabled(false);
558  d->servDownButton->setEnabled(false);
559  }
560  else if (index == (d->model->rowCount() - 1))
561  {
562  d->servUpButton->setEnabled(true);
563  d->servDownButton->setEnabled(false);
564  }
565  else if (index == 0)
566  {
567  d->servUpButton->setEnabled(false);
568  d->servDownButton->setEnabled(true);
569  }
570  else
571  {
572  d->servUpButton->setEnabled(true);
573  d->servDownButton->setEnabled(true);
574  }
575  }
576 
577  if ( d->servRemoveButton )
578  d->servRemoveButton->setEnabled(true);
579 }
580 
581 void KEditListWidget::clear()
582 {
583  d->lineEdit->clear();
584  d->model->setStringList( QStringList() );
585  emit changed();
586 }
587 
588 void KEditListWidget::insertStringList(const QStringList& list, int index)
589 {
590  QStringList content = d->model->stringList();
591  if ( index < 0 )
592  content += list;
593  else
594  for ( int i = 0, j = index; i < list.count(); ++i, ++j )
595  content.insert( j, list[ i ] );
596 
597  d->model->setStringList( content );
598 }
599 
600 void KEditListWidget::insertItem(const QString& text, int index)
601 {
602  QStringList list = d->model->stringList();
603 
604  if ( index < 0 )
605  list.append( text );
606  else
607  list.insert( index, text );
608 
609  d->model->setStringList(list);
610 }
611 
612 QString KEditListWidget::text(int index) const
613 {
614  const QStringList list = d->model->stringList();
615 
616  return list[ index ];
617 }
618 
619 QString KEditListWidget::currentText() const
620 {
621  QModelIndex index = d->selectedIndex();
622  if ( !index.isValid() )
623  return QString();
624  else
625  return text( index.row() );
626 }
627 
628 QStringList KEditListWidget::items() const
629 {
630  return d->model->stringList();
631 }
632 
633 void KEditListWidget::setItems(const QStringList& items)
634 {
635  d->model->setStringList(items);
636 }
637 
638 KEditListWidget::Buttons KEditListWidget::buttons() const
639 {
640  return d->buttons;
641 }
642 
643 void KEditListWidget::slotSelectionChanged( const QItemSelection&, const QItemSelection& )
644 {
645  d->updateButtonState();
646  QModelIndex index = d->selectedIndex();
647  enableMoveButtons(index, QModelIndex());
648  if (index.isValid()) {
649  d->lineEdit->setFocus( Qt::OtherFocusReason );
650  }
651 }
652 
653 bool KEditListWidget::eventFilter( QObject* o, QEvent* e )
654 {
655  if (o == d->lineEdit && e->type() == QEvent::KeyPress ) {
656  QKeyEvent* keyEvent = (QKeyEvent*)e;
657  if (keyEvent->key() == Qt::Key_Down ||
658  keyEvent->key() == Qt::Key_Up) {
659  return ((QObject*)d->listView)->event(e);
660  }
661  }
662 
663  return false;
664 }
665 
666 #include "keditlistwidget.moc"
kdialog.h
i18n
QString i18n(const char *text)
kcombobox.h
KPushButton
A QPushButton with drag-support and KGuiItem support.
Definition: kpushbutton.h:46
QItemSelectionModel
KEditListWidget::insertItem
void insertItem(const QString &text, int index=-1)
See Q3ListBox::insertItem()
Definition: keditlistwidget.cpp:600
KEditListWidget::UpDown
Definition: keditlistwidget.h:93
kdebug.h
KEditListWidget::currentItem
int currentItem() const
See Q3ListBox::currentItem()
Definition: keditlistwidget.cpp:512
KEditListWidget::CustomEditor::~CustomEditor
virtual ~CustomEditor()
Definition: keditlistwidget.cpp:213
KEditListWidget
An editable listbox.
Definition: keditlistwidget.h:48
KEditListWidget::Add
Definition: keditlistwidget.h:91
KEditListWidget::CustomEditor::setLineEdit
void setLineEdit(KLineEdit *edit)
Definition: keditlistwidget.cpp:223
KEditListWidget::addButton
QPushButton * addButton() const
Return a pointer to the Add button.
Definition: keditlistwidget.cpp:274
QWidget
KEditListWidget::~KEditListWidget
virtual ~KEditListWidget()
Definition: keditlistwidget.cpp:254
QPushButton
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::CustomEditor::representationWidget
virtual QWidget * representationWidget() const
Definition: keditlistwidget.cpp:228
QString
KEditListWidget::CustomEditor::setRepresentationWidget
void setRepresentationWidget(QWidget *repWidget)
Definition: keditlistwidget.cpp:218
KEditListWidget::All
Definition: keditlistwidget.h:94
QObject
klocale.h
KEditListWidget::items
QStringList items() const
KEditListWidget::buttons
Buttons buttons() const
Returns which buttons are visible.
knotification.h
KEditListWidget::changed
void changed()
KEditListWidget::text
QString text(int index) const
See Q3ListBox::text()
Definition: keditlistwidget.cpp:612
KStandardAction::Deselect
Definition: kstandardaction.h:133
KEditListWidget::currentText
QString currentText() const
See Q3ListBox::currentText()
Definition: keditlistwidget.cpp:619
KEditListWidget::removeButton
QPushButton * removeButton() const
Return a pointer to the Remove button.
Definition: keditlistwidget.cpp:279
KEditListWidget::CustomEditor
Custom editor class.
Definition: keditlistwidget.h:63
QStringList
KEditListWidget::setButtons
void setButtons(Buttons buttons)
Specifies which buttons should be visible.
Definition: keditlistwidget.cpp:299
KIcon
A wrapper around QIcon that provides KDE icon features.
Definition: kicon.h:40
KNotification::beep
static void beep(const QString &reason=QString(), QWidget *widget=0L)
This is a simple substitution for QApplication::beep()
Definition: knotification.cpp:352
KEditListWidget::upButton
QPushButton * upButton() const
Return a pointer to the Up button.
Definition: keditlistwidget.cpp:284
KEditListWidget::setCheckAtEntering
void setCheckAtEntering(bool check)
If check is true, after every character you type in the line edit KEditListWidget will enable or disa...
Definition: keditlistwidget.cpp:349
kpushbutton.h
KEditListWidget::setCustomEditor
void setCustomEditor(const CustomEditor &editor)
Allows to use a custom editing widget instead of the standard KLineEdit widget.
Definition: keditlistwidget.cpp:259
QListView
KEditListWidget::eventFilter
bool eventFilter(QObject *o, QEvent *e)
Reimplented for interal reasons.
Definition: keditlistwidget.cpp:653
KLineEdit
An enhanced QLineEdit widget for inputting text.
Definition: klineedit.h:149
KEditListWidget::lineEdit
KLineEdit * lineEdit() const
Return a pointer to the embedded KLineEdit.
Definition: keditlistwidget.cpp:269
KEditListWidget::Remove
Definition: keditlistwidget.h:92
KEditListWidget::CustomEditor::CustomEditor
CustomEditor()
Definition: keditlistwidget.cpp:193
KEditListWidget::KEditListWidget
KEditListWidget(QWidget *parent=0)
Create an editable listbox.
Definition: keditlistwidget.cpp:238
KComboBox
An enhanced combo box.
Definition: kcombobox.h:148
KEditListWidget::setItems
void setItems(const QStringList &items)
Clears the listbox and sets the contents to items.
Definition: keditlistwidget.cpp:633
KEditListWidget::checkAtEntering
bool checkAtEntering()
Returns true if check at entering is enabled.
KEditListWidget::KEditListWidgetPrivate
friend class KEditListWidgetPrivate
Definition: keditlistwidget.h:255
KEditListWidget::listView
QListView * listView() const
Return a pointer to the embedded QListView.
Definition: keditlistwidget.cpp:264
KEditListWidget::CustomEditor::lineEdit
virtual KLineEdit * lineEdit() const
Definition: keditlistwidget.cpp:233
klineedit.h
keditlistwidget.h
KEditListWidget::count
int count() const
See Q3ListBox::count()
Definition: keditlistwidget.cpp:294
KEditListWidget::clear
void clear()
Clears both the listbox and the line edit.
Definition: keditlistwidget.cpp:581
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::insertStringList
void insertStringList(const QStringList &list, int index=-1)
See Q3ListBox::insertStringList()
Definition: keditlistwidget.cpp:588
KEditListWidget::downButton
QPushButton * downButton() const
Return a pointer to the Down button.
Definition: keditlistwidget.cpp:289
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:14 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • 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