KHistoryCombo Class Reference
A combobox which implements a history like a unix shell. A combobox for offering a history and completion. More...
#include <kcombobox.h>
Inheritance diagram for KHistoryCombo:

Public Slots | |
void | addToHistory (const QString &item) |
Adds an item to the end of the history list and to the completion list. | |
void | clearHistory () |
Clears the history and the completion list. | |
Signals | |
void | cleared () |
Emitted when the history was cleared by the entry in the popup menu. | |
Public Member Functions | |
KHistoryCombo (QWidget *parent=0L, const char *name=0L) | |
Constructs a "read-write" combobox. | |
KHistoryCombo (bool useCompletion, QWidget *parent=0L, const char *name=0L) | |
Same as the previous constructor, but additionally has the option to specify whether you want to let KHistoryCombo handle completion or not. | |
~KHistoryCombo () | |
Destructs the combo, the completion-object and the pixmap-provider. | |
void | setHistoryItems (QStringList items) |
Inserts items into the combobox. | |
void | setHistoryItems (QStringList items, bool setCompletionList) |
Inserts items into the combobox. | |
QStringList | historyItems () const |
Returns the list of history items. | |
bool | removeFromHistory (const QString &item) |
Removes all items named item . | |
void | setPixmapProvider (KPixmapProvider *prov) |
Sets a pixmap provider, so that items in the combobox can have a pixmap. | |
KPixmapProvider * | pixmapProvider () const |
void | reset () |
Resets the current position of the up/down history. | |
Protected Member Functions | |
virtual void | keyPressEvent (QKeyEvent *) |
Handling key-events, the shortcuts to rotate the items. | |
virtual void | wheelEvent (QWheelEvent *ev) |
Handling wheel-events, to rotate the items. | |
void | insertItems (const QStringList &items) |
Inserts items into the combo, honouring pixmapProvider() Does not update the completionObject. | |
bool | useCompletion () const |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
A combobox which implements a history like a unix shell. A combobox for offering a history and completion.You can navigate through all the items by using the Up or Down arrows (configurable of course). Additionally, weighted completion is available. So you should load and save the completion list to preserve the weighting between sessions.
KHistoryCombo obeys the HISTCONTROL environment variable to determine whether duplicates in the history should be tolerated in addToHistory() or not. During construction of KHistoryCombo, duplicates will be disabled when HISTCONTROL is set to "ignoredups" or "ignoreboth". Otherwise, duplicates are enabled by default.
- Author:
- Carsten Pfeiffer <pfeiffer@kde.org>
Definition at line 535 of file kcombobox.h.
Constructor & Destructor Documentation
|
Constructs a "read-write" combobox. A read-only history combobox doesn't make much sense, so it is only available as read-write. Completion will be used automatically for the items in the combo. The insertion-policy is set to NoInsertion, you have to add the items yourself via the slot addToHistory. If you want every item added, use
|
|
Same as the previous constructor, but additionally has the option to specify whether you want to let KHistoryCombo handle completion or not.
If set to Definition at line 363 of file kcombobox.cpp. References KStdAccel::name(). |
|
Destructs the combo, the completion-object and the pixmap-provider.
Definition at line 391 of file kcombobox.cpp. |
Member Function Documentation
|
Inserts
Definition at line 583 of file kcombobox.h. |
|
Inserts
Set
Definition at line 396 of file kcombobox.cpp. References QComboBox::clear(), QComboBox::clearEdit(), KCompletionBase::completionObject(), KCompletion::Insertion, insertItems(), QComboBox::maxCount(), KCompletion::setItems(), KCompletion::setOrder(), useCompletion(), and KCompletion::Weighted. |
|
Returns the list of history items. Empty, when this is not a read-write combobox.
Definition at line 418 of file kcombobox.cpp. References QComboBox::count(), and QComboBox::text(). Referenced by setPixmapProvider(). |
|
Removes all items named
Definition at line 489 of file kcombobox.cpp. References KCompletionBase::completionObject(), QComboBox::count(), QComboBox::currentText(), QString::isEmpty(), KCompletion::removeItem(), QComboBox::removeItem(), QComboBox::setEditText(), QComboBox::text(), and useCompletion(). |
|
Sets a pixmap provider, so that items in the combobox can have a pixmap. KPixmapProvider is just an abstract class with the one pure virtual method KPixmapProvider::pixmapFor(). This method is called whenever an item is added to the KHistoryComboBox. Implement it to return your own custom pixmaps, or use the KURLPixmapProvider from libkio, which uses KMimeType::pixmapForURL to resolve icons.
Set
Definition at line 615 of file kcombobox.cpp. References QComboBox::clear(), QComboBox::count(), historyItems(), and insertItems(). |
|
Definition at line 666 of file kcombobox.h. |
|
Resets the current position of the up/down history. Call this when you manually call setCurrentItem() or clearEdit(). Definition at line 672 of file kcombobox.h. |
|
Adds an item to the end of the history list and to the completion list. If maxCount() is reached, the first item of the list will be removed.
If the last inserted item is the same as
If duplicatesEnabled() is false, any equal existing item will be removed before Note: By using this method and not the Q and KComboBox insertItem() methods, you make sure that the combobox stays in sync with the completion. It would be annoying if completion would give an item not in the combobox, and vice versa.
Definition at line 443 of file kcombobox.cpp. References KCompletion::addItem(), KCompletionBase::completionObject(), KComboBox::contains(), QComboBox::count(), QComboBox::currentItem(), QComboBox::duplicatesEnabled(), QComboBox::insertItem(), QString::isEmpty(), QComboBox::maxCount(), KPixmapProvider::pixmapFor(), KCompletion::removeItem(), QComboBox::removeItem(), KComboBox::setCurrentItem(), KIcon::SizeSmall, QComboBox::text(), and useCompletion(). |
|
Clears the history and the completion list.
Definition at line 427 of file kcombobox.cpp. References KCompletion::clear(), QComboBox::clear(), KCompletionBase::completionObject(), and useCompletion(). |
|
Emitted when the history was cleared by the entry in the popup menu.
|
|
Handling key-events, the shortcuts to rotate the items.
Definition at line 575 of file kcombobox.cpp. References KStdAccel::isEqual(). |
|
Handling wheel-events, to rotate the items.
Reimplemented from KComboBox. Definition at line 590 of file kcombobox.cpp. References QWheelEvent::accept(), QWheelEvent::delta(), QComboBox::listBox(), and QApplication::sendEvent(). |
|
Inserts Note: duplicatesEnabled() is not honored here. Called from setHistoryItems() and setPixmapProvider() Definition at line 633 of file kcombobox.cpp. References QComboBox::insertItem(), QString::isEmpty(), KPixmapProvider::pixmapFor(), and KIcon::SizeSmall. Referenced by setHistoryItems(), and setPixmapProvider(). |
|
Definition at line 731 of file kcombobox.h. References KCompletionBase::compObj(). Referenced by addToHistory(), clearHistory(), removeFromHistory(), and setHistoryItems(). |
The documentation for this class was generated from the following files: