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

KDEUI

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