• 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
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  mainLayout->setMargin(0);
82 
83  QHBoxLayout* subLayout = new QHBoxLayout;
84  btnsLayout = new QVBoxLayout;
85  btnsLayout->addStretch();
86 
87  model = new QStringListModel();
88  listView = new QListView(q);
89  listView->setModel(model);
90 
91  subLayout->addWidget(listView);
92  subLayout->addLayout(btnsLayout);
93 
94  mainLayout->insertLayout(1, subLayout);
95 
96  setEditor( lineEdit, representationWidget );
97 
98  buttons = 0;
99  q->setButtons( newButtons );
100 
101  q->connect(listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
102  SLOT(slotSelectionChanged(QItemSelection,QItemSelection)));
103 }
104 
105 
106 void KEditListWidgetPrivate::setEditor( KLineEdit* newLineEdit, QWidget* representationWidget )
107 {
108  if (editingWidget != lineEdit &&
109  editingWidget != representationWidget) {
110  delete editingWidget;
111  }
112  if (lineEdit != newLineEdit) {
113  delete lineEdit;
114  }
115  lineEdit = newLineEdit ? newLineEdit : new KLineEdit(q);
116  editingWidget = representationWidget ?
117  representationWidget : lineEdit;
118 
119  if ( representationWidget )
120  representationWidget->setParent(q);
121 
122  mainLayout->insertWidget(0,editingWidget);
123 
124  lineEdit->setTrapReturnKey(true);
125  lineEdit->installEventFilter(q);
126 
127  q->connect(lineEdit,SIGNAL(textChanged(QString)),SLOT(typedSomething(QString)));
128  q->connect(lineEdit,SIGNAL(returnPressed()),SLOT(addItem()));
129 
130  // maybe supplied lineedit has some text already
131  q->typedSomething( lineEdit->text() );
132 
133 
134  // fix tab ordering
135  q->setTabOrder(editingWidget, listView);
136  QWidget* w = listView;
137  if (servNewButton) {
138  q->setTabOrder(w,servNewButton);
139  w = servNewButton;
140  }
141  if (servRemoveButton) {
142  q->setTabOrder(w,servRemoveButton);
143  w = servRemoveButton;
144  }
145  if (servUpButton) {
146  q->setTabOrder(w,servUpButton);
147  w = servUpButton;
148  }
149  if (servDownButton) {
150  q->setTabOrder(w,servDownButton);
151  w = servDownButton;
152  }
153 }
154 
155 
156 void KEditListWidgetPrivate::updateButtonState()
157 {
158  QModelIndex index = selectedIndex();
159  if (servUpButton) {
160  servUpButton->setEnabled(index.isValid());
161  }
162  if (servDownButton) {
163  servDownButton->setEnabled(index.isValid());
164  }
165  if (servRemoveButton) {
166  servRemoveButton->setEnabled(index.isValid());
167  }
168 }
169 
170 QModelIndex KEditListWidgetPrivate::selectedIndex()
171 {
172  QItemSelectionModel *selection = listView->selectionModel();
173  const QModelIndexList selectedIndexes = selection->selectedIndexes();
174  if ( !selectedIndexes.isEmpty() && selectedIndexes[0].isValid() )
175  return selectedIndexes[0];
176  else
177  return QModelIndex();
178 }
179 
180 
181 class KEditListWidget::CustomEditorPrivate
182 {
183 public:
184  CustomEditorPrivate(KEditListWidget::CustomEditor *q):
185  q(q),
186  representationWidget(0),
187  lineEdit(0) {}
188 
189  KEditListWidget::CustomEditor *q;
190  QWidget *representationWidget;
191  KLineEdit *lineEdit;
192 };
193 
194 KEditListWidget::CustomEditor::CustomEditor()
195  : d(new CustomEditorPrivate(this))
196 {
197 }
198 
199 KEditListWidget::CustomEditor::CustomEditor( QWidget *repWidget, KLineEdit *edit )
200  : d(new CustomEditorPrivate(this))
201 {
202  d->representationWidget = repWidget;
203  d->lineEdit = edit;
204 }
205 
206 KEditListWidget::CustomEditor::CustomEditor( KComboBox *combo )
207  : d(new CustomEditorPrivate(this))
208 {
209  d->representationWidget = combo;
210  d->lineEdit = qobject_cast<KLineEdit*>( combo->lineEdit() );
211  Q_ASSERT( d->lineEdit );
212 }
213 
214 KEditListWidget::CustomEditor::~CustomEditor()
215 {
216  delete d;
217 }
218 
219 void KEditListWidget::CustomEditor::setRepresentationWidget( QWidget *repWidget )
220 {
221  d->representationWidget = repWidget;
222 }
223 
224 void KEditListWidget::CustomEditor::setLineEdit( KLineEdit *edit )
225 {
226  d->lineEdit = edit;
227 }
228 
229 QWidget *KEditListWidget::CustomEditor::representationWidget() const
230 {
231  return d->representationWidget;
232 }
233 
234 KLineEdit *KEditListWidget::CustomEditor::lineEdit() const
235 {
236  return d->lineEdit;
237 }
238 
239 KEditListWidget::KEditListWidget(QWidget *parent)
240  : QWidget(parent), d(new KEditListWidgetPrivate(this))
241 {
242  d->init();
243 }
244 
245 KEditListWidget::KEditListWidget(const CustomEditor& custom,
246  QWidget *parent,
247  bool checkAtEntering,
248  Buttons buttons)
249  :QWidget(parent), d(new KEditListWidgetPrivate(this))
250 {
251  d->lineEdit = custom.lineEdit();
252  d->init( checkAtEntering, buttons, custom.representationWidget() );
253 }
254 
255 KEditListWidget::~KEditListWidget()
256 {
257  delete d;
258 }
259 
260 void KEditListWidget::setCustomEditor( const CustomEditor& editor )
261 {
262  d->setEditor( editor.lineEdit(), editor.representationWidget() );
263 }
264 
265 QListView *KEditListWidget::listView() const
266 {
267  return d->listView;
268 }
269 
270 KLineEdit *KEditListWidget::lineEdit() const
271 {
272  return d->lineEdit;
273 }
274 
275 QPushButton *KEditListWidget::addButton() const
276 {
277  return d->servNewButton;
278 }
279 
280 QPushButton *KEditListWidget::removeButton() const
281 {
282  return d->servRemoveButton;
283 }
284 
285 QPushButton *KEditListWidget::upButton() const
286 {
287  return d->servUpButton;
288 }
289 
290 QPushButton *KEditListWidget::downButton() const
291 {
292  return d->servDownButton;
293 }
294 
295 int KEditListWidget::count() const
296 {
297  return int(d->model->rowCount());
298 }
299 
300 void KEditListWidget::setButtons( Buttons buttons )
301 {
302  if ( d->buttons == buttons )
303  return;
304 
305  if ( ( buttons & Add ) && !d->servNewButton ) {
306  d->servNewButton = new KPushButton(KIcon("list-add"), i18n("&Add"), this);
307  d->servNewButton->setEnabled(false);
308  d->servNewButton->show();
309  connect(d->servNewButton, SIGNAL(clicked()), SLOT(addItem()));
310 
311  d->btnsLayout->insertWidget(0, d->servNewButton);
312  } else if ( ( buttons & Add ) == 0 && d->servNewButton ) {
313  delete d->servNewButton;
314  d->servNewButton = 0;
315  }
316 
317  if ( ( buttons & Remove ) && !d->servRemoveButton ) {
318  d->servRemoveButton = new KPushButton(KIcon("list-remove"), i18n("&Remove"), this);
319  d->servRemoveButton->setEnabled(false);
320  d->servRemoveButton->show();
321  connect(d->servRemoveButton, SIGNAL(clicked()), SLOT(removeItem()));
322 
323  d->btnsLayout->insertWidget(1, d->servRemoveButton);
324  } else if ( ( buttons & Remove ) == 0 && d->servRemoveButton ) {
325  delete d->servRemoveButton;
326  d->servRemoveButton = 0;
327  }
328 
329  if ( ( buttons & UpDown ) && !d->servUpButton ) {
330  d->servUpButton = new KPushButton(KIcon("arrow-up"), i18n("Move &Up"), this);
331  d->servUpButton->setEnabled(false);
332  d->servUpButton->show();
333  connect(d->servUpButton, SIGNAL(clicked()), SLOT(moveItemUp()));
334 
335  d->servDownButton = new KPushButton(KIcon("arrow-down"), i18n("Move &Down"), this);
336  d->servDownButton->setEnabled(false);
337  d->servDownButton->show();
338  connect(d->servDownButton, SIGNAL(clicked()), SLOT(moveItemDown()));
339 
340  d->btnsLayout->insertWidget(2, d->servUpButton);
341  d->btnsLayout->insertWidget(3, d->servDownButton);
342  } else if ( ( buttons & UpDown ) == 0 && d->servUpButton ) {
343  delete d->servUpButton; d->servUpButton = 0;
344  delete d->servDownButton; d->servDownButton = 0;
345  }
346 
347  d->buttons = buttons;
348 }
349 
350 void KEditListWidget::setCheckAtEntering(bool check)
351 {
352  d->checkAtEntering = check;
353 }
354 
355 bool KEditListWidget::checkAtEntering()
356 {
357  return d->checkAtEntering;
358 }
359 
360 void KEditListWidget::typedSomething(const QString& text)
361 {
362  if(currentItem() >= 0) {
363  if(currentText() != d->lineEdit->text())
364  {
365  // IMHO changeItem() shouldn't do anything with the value
366  // of currentItem() ... like changing it or emitting signals ...
367  // but TT disagree with me on this one (it's been that way since ages ... grrr)
368  bool block = d->listView->signalsBlocked();
369  d->listView->blockSignals( true );
370  QModelIndex currentIndex = d->selectedIndex();
371  if ( currentIndex.isValid() )
372  d->model->setData(currentIndex,text);
373  d->listView->blockSignals( block );
374  emit changed();
375  }
376  }
377 
378  if ( !d->servNewButton )
379  return;
380 
381  if ( !d->lineEdit->hasAcceptableInput() ) {
382  d->servNewButton->setEnabled(false);
383  return;
384  }
385 
386  if (!d->checkAtEntering)
387  d->servNewButton->setEnabled(!text.isEmpty());
388  else
389  {
390  if (text.isEmpty())
391  {
392  d->servNewButton->setEnabled(false);
393  }
394  else
395  {
396  QStringList list = d->model->stringList();
397  bool enable = !list.contains( text, Qt::CaseSensitive );
398  d->servNewButton->setEnabled( enable );
399  }
400  }
401 }
402 
403 void KEditListWidget::moveItemUp()
404 {
405  if (!d->listView->isEnabled())
406  {
407  KNotification::beep();
408  return;
409  }
410 
411  QModelIndex index = d->selectedIndex();
412  if ( index.isValid() ) {
413  if (index.row() == 0) {
414  KNotification::beep();
415  return;
416  }
417 
418  QModelIndex aboveIndex = d->model->index( index.row() - 1, index.column() );
419 
420  QString tmp = d->model->data( aboveIndex, Qt::DisplayRole ).toString();
421  d->model->setData( aboveIndex, d->model->data( index, Qt::DisplayRole ) );
422  d->model->setData( index, tmp );
423 
424  d->listView->selectionModel()->select(index, QItemSelectionModel::Deselect);
425  d->listView->selectionModel()->select(aboveIndex, QItemSelectionModel::Select);
426  }
427 
428  emit changed();
429 }
430 
431 void KEditListWidget::moveItemDown()
432 {
433  if (!d->listView->isEnabled())
434  {
435  KNotification::beep();
436  return;
437  }
438 
439  QModelIndex index = d->selectedIndex();
440  if ( index.isValid() ) {
441  if (index.row() == d->model->rowCount() - 1) {
442  KNotification::beep();
443  return;
444  }
445 
446  QModelIndex belowIndex = d->model->index( index.row() + 1, index.column() );
447 
448  QString tmp = d->model->data( belowIndex, Qt::DisplayRole ).toString();
449  d->model->setData( belowIndex, d->model->data( index, Qt::DisplayRole ) );
450  d->model->setData( index, tmp );
451 
452  d->listView->selectionModel()->select(index, QItemSelectionModel::Deselect);
453  d->listView->selectionModel()->select(belowIndex, QItemSelectionModel::Select);
454  }
455 
456  emit changed();
457 }
458 
459 void KEditListWidget::addItem()
460 {
461  // when checkAtEntering is true, the add-button is disabled, but this
462  // slot can still be called through Key_Return/Key_Enter. So we guard
463  // against this.
464  if ( !d->servNewButton || !d->servNewButton->isEnabled() )
465  return;
466 
467  QModelIndex currentIndex = d->selectedIndex();
468 
469  const QString& currentTextLE=d->lineEdit->text();
470  bool alreadyInList(false);
471  //if we didn't check for dupes at the inserting we have to do it now
472  if (!d->checkAtEntering)
473  {
474  // first check current item instead of dumb iterating the entire list
475  if ( currentIndex.isValid() ) {
476  if ( d->model->data( currentIndex, Qt::DisplayRole ).toString() == currentTextLE )
477  alreadyInList = true;
478  }
479  else
480  {
481  alreadyInList = d->model->stringList().contains( currentTextLE, Qt::CaseSensitive );
482  }
483  }
484  if ( d->servNewButton )
485  d->servNewButton->setEnabled(false);
486 
487  bool block = d->lineEdit->signalsBlocked();
488  d->lineEdit->blockSignals(true);
489  d->lineEdit->clear();
490  d->lineEdit->blockSignals(block);
491 
492  d->listView->selectionModel()->setCurrentIndex(currentIndex, QItemSelectionModel::Deselect);
493 
494  if (!alreadyInList)
495  {
496  block = d->listView->signalsBlocked();
497 
498  if ( currentIndex.isValid() ) {
499  d->model->setData(currentIndex, currentTextLE );
500  } else {
501  QStringList lst;
502  lst<<currentTextLE;
503  lst<<d->model->stringList();
504  d->model->setStringList(lst);
505  }
506  emit changed();
507  emit added( currentTextLE ); // TODO: pass the index too
508  }
509 
510  d->updateButtonState();
511 }
512 
513 int KEditListWidget::currentItem() const
514 {
515  QModelIndex selectedIndex = d->selectedIndex();
516  if ( selectedIndex.isValid() )
517  return selectedIndex.row();
518  else
519  return -1;
520 }
521 
522 void KEditListWidget::removeItem()
523 {
524  QModelIndex currentIndex = d->selectedIndex();
525  if ( !currentIndex.isValid() )
526  return;
527 
528  if ( currentIndex.row() >= 0 )
529  {
530  QString removedText = d->model->data( currentIndex, Qt::DisplayRole ).toString();
531 
532  d->model->removeRows( currentIndex.row(), 1 );
533 
534  d->listView->selectionModel()->clear();
535 
536  emit changed();
537 
538  emit removed( removedText );
539  }
540 
541  d->updateButtonState();
542 }
543 
544 void KEditListWidget::enableMoveButtons(const QModelIndex &newIndex, const QModelIndex&)
545 {
546  int index = newIndex.row();
547 
548  // Update the lineEdit when we select a different line.
549  if(currentText() != d->lineEdit->text())
550  d->lineEdit->setText(currentText());
551 
552  bool moveEnabled = d->servUpButton && d->servDownButton;
553 
554  if (moveEnabled )
555  {
556  if (d->model->rowCount() <= 1)
557  {
558  d->servUpButton->setEnabled(false);
559  d->servDownButton->setEnabled(false);
560  }
561  else if (index == (d->model->rowCount() - 1))
562  {
563  d->servUpButton->setEnabled(true);
564  d->servDownButton->setEnabled(false);
565  }
566  else if (index == 0)
567  {
568  d->servUpButton->setEnabled(false);
569  d->servDownButton->setEnabled(true);
570  }
571  else
572  {
573  d->servUpButton->setEnabled(true);
574  d->servDownButton->setEnabled(true);
575  }
576  }
577 
578  if ( d->servRemoveButton )
579  d->servRemoveButton->setEnabled(true);
580 }
581 
582 void KEditListWidget::clear()
583 {
584  d->lineEdit->clear();
585  d->model->setStringList( QStringList() );
586  emit changed();
587 }
588 
589 void KEditListWidget::insertStringList(const QStringList& list, int index)
590 {
591  QStringList content = d->model->stringList();
592  if ( index < 0 )
593  content += list;
594  else
595  for ( int i = 0, j = index; i < list.count(); ++i, ++j )
596  content.insert( j, list[ i ] );
597 
598  d->model->setStringList( content );
599 }
600 
601 void KEditListWidget::insertItem(const QString& text, int index)
602 {
603  QStringList list = d->model->stringList();
604 
605  if ( index < 0 )
606  list.append( text );
607  else
608  list.insert( index, text );
609 
610  d->model->setStringList(list);
611 }
612 
613 QString KEditListWidget::text(int index) const
614 {
615  const QStringList list = d->model->stringList();
616 
617  return list[ index ];
618 }
619 
620 QString KEditListWidget::currentText() const
621 {
622  QModelIndex index = d->selectedIndex();
623  if ( !index.isValid() )
624  return QString();
625  else
626  return text( index.row() );
627 }
628 
629 QStringList KEditListWidget::items() const
630 {
631  return d->model->stringList();
632 }
633 
634 void KEditListWidget::setItems(const QStringList& items)
635 {
636  d->model->setStringList(items);
637 }
638 
639 KEditListWidget::Buttons KEditListWidget::buttons() const
640 {
641  return d->buttons;
642 }
643 
644 void KEditListWidget::slotSelectionChanged( const QItemSelection&, const QItemSelection& )
645 {
646  d->updateButtonState();
647  QModelIndex index = d->selectedIndex();
648  enableMoveButtons(index, QModelIndex());
649  if (index.isValid()) {
650  d->lineEdit->setFocus( Qt::OtherFocusReason );
651  }
652 }
653 
654 bool KEditListWidget::eventFilter( QObject* o, QEvent* e )
655 {
656  if (o == d->lineEdit && e->type() == QEvent::KeyPress ) {
657  QKeyEvent* keyEvent = (QKeyEvent*)e;
658  if (keyEvent->key() == Qt::Key_Down ||
659  keyEvent->key() == Qt::Key_Up) {
660  return ((QObject*)d->listView)->event(e);
661  }
662  }
663 
664  return false;
665 }
666 
667 #include "keditlistwidget.moc"
kdialog.h
i18n
QString i18n(const char *text)
QModelIndex
kcombobox.h
KPushButton
A QPushButton with drag-support and KGuiItem support.
Definition: kpushbutton.h:46
QEvent
QWidget
QEvent::type
Type type() const
KEditListWidget::insertItem
void insertItem(const QString &text, int index=-1)
See Q3ListBox::insertItem()
Definition: keditlistwidget.cpp:601
KEditListWidget::UpDown
Definition: keditlistwidget.h:93
kdebug.h
KEditListWidget::currentItem
int currentItem() const
See Q3ListBox::currentItem()
Definition: keditlistwidget.cpp:513
KEditListWidget::CustomEditor::~CustomEditor
virtual ~CustomEditor()
Definition: keditlistwidget.cpp:214
KEditListWidget
An editable listbox.
Definition: keditlistwidget.h:48
KEditListWidget::Add
Definition: keditlistwidget.h:91
KEditListWidget::CustomEditor::setLineEdit
void setLineEdit(KLineEdit *edit)
Definition: keditlistwidget.cpp:224
KEditListWidget::addButton
QPushButton * addButton() const
Return a pointer to the Add button.
Definition: keditlistwidget.cpp:275
QSizePolicy
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
KEditListWidget::~KEditListWidget
virtual ~KEditListWidget()
Definition: keditlistwidget.cpp:255
QHBoxLayout
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:229
KEditListWidget::CustomEditor::setRepresentationWidget
void setRepresentationWidget(QWidget *repWidget)
Definition: keditlistwidget.cpp:219
KEditListWidget::All
Definition: keditlistwidget.h:94
klocale.h
QWidget::setParent
void setParent(QWidget *parent)
KEditListWidget::items
QStringList items() const
KEditListWidget::buttons
Buttons buttons() const
Returns which buttons are visible.
QListView
knotification.h
KEditListWidget::changed
void changed()
KEditListWidget::text
QString text(int index) const
See Q3ListBox::text()
Definition: keditlistwidget.cpp:613
KStandardAction::Deselect
Definition: kstandardaction.h:133
QModelIndex::isValid
bool isValid() const
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
KEditListWidget::currentText
QString currentText() const
See Q3ListBox::currentText()
Definition: keditlistwidget.cpp:620
KEditListWidget::removeButton
QPushButton * removeButton() const
Return a pointer to the Remove button.
Definition: keditlistwidget.cpp:280
KEditListWidget::CustomEditor
Custom editor class.
Definition: keditlistwidget.h:63
QObject
QWidget::setTabOrder
void setTabOrder(QWidget *first, QWidget *second)
QString::isEmpty
bool isEmpty() const
QItemSelectionModel::selectedIndexes
QModelIndexList selectedIndexes() const
KEditListWidget::setButtons
void setButtons(Buttons buttons)
Specifies which buttons should be visible.
Definition: keditlistwidget.cpp:300
QModelIndex::row
int row() const
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
QVBoxLayout
KEditListWidget::upButton
QPushButton * upButton() const
Return a pointer to the Up button.
Definition: keditlistwidget.cpp:285
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:350
QString
QStringListModel
QStringList
QKeyEvent::key
int key() const
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:260
QItemSelection
QComboBox::lineEdit
QLineEdit * lineEdit() const
KEditListWidget::eventFilter
bool eventFilter(QObject *o, QEvent *e)
Reimplented for interal reasons.
Definition: keditlistwidget.cpp:654
QKeyEvent
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:270
KEditListWidget::Remove
Definition: keditlistwidget.h:92
QBoxLayout::addStretch
void addStretch(int stretch)
KEditListWidget::CustomEditor::CustomEditor
CustomEditor()
Definition: keditlistwidget.cpp:194
QList::insert
void insert(int i, const T &value)
KEditListWidget::KEditListWidget
KEditListWidget(QWidget *parent=0)
Create an editable listbox.
Definition: keditlistwidget.cpp:239
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:634
QModelIndex::column
int column() const
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:265
QPushButton
KEditListWidget::CustomEditor::lineEdit
virtual KLineEdit * lineEdit() const
Definition: keditlistwidget.cpp:234
klineedit.h
keditlistwidget.h
QItemSelectionModel
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KEditListWidget::count
int count() const
See Q3ListBox::count()
Definition: keditlistwidget.cpp:295
QObject::parent
QObject * parent() const
QWidget::event
virtual bool event(QEvent *event)
KEditListWidget::clear
void clear()
Clears both the listbox and the line edit.
Definition: keditlistwidget.cpp:582
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:589
KEditListWidget::downButton
QPushButton * downButton() const
Return a pointer to the Down button.
Definition: keditlistwidget.cpp:290
QBoxLayout::addLayout
void addLayout(QLayout *layout, int stretch)
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