OpenMS
|
A widget which shows a list of text items, which can be filtered. More...
#include <OpenMS/VISUAL/MISC/FilterableList.h>
Public Slots | |
void | setItems (const QStringList &items) |
void | setBlacklistItems (const QStringList &blacklist_items) |
void | addBlackListItems (const QStringList &additional_blacklist_items) |
void | removeBlackListItems (const QStringList &outdated_blacklist_items) |
Signals | |
void | filterChanged (const QString &filter_text) |
emitted when the user has edited the filter More... | |
void | itemDoubleClicked (QListWidgetItem *item) |
emitted when this item was double clicked More... | |
Public Member Functions | |
FilterableList (QWidget *parent) | |
C'tor. More... | |
~FilterableList () | |
QStringList | getSelectedItems () const |
get the currently selected items of all visible items, i.e. must pass the filter and be selected More... | |
QStringList | getAllVisibleItems () const |
get all items which are visible (i.e. excludes the ones which are hidden by the filter) More... | |
Private Slots | |
void | filterEdited_ (const QString &filter_text) |
void | updateInternalList_ () |
void | updateVisibleList_ () |
update shown items, based on current items_wo_bl_ and current filter More... | |
Private Attributes | |
Ui::FilterableList * | ui_ |
QStringList | items_ |
full list of items to show; when filtered only a subset is shown More... | |
QSet< QString > | blacklist_ |
blacklisted items, which are never shown, even if in items_ ; More... | |
QStringList | items_wo_bl_ |
items from item_ with blacklisted items removed More... | |
A widget which shows a list of text items, which can be filtered.
A text field serves as filter expression (unix wildcard regEx support - see https://doc.qt.io/archives/qt-5.10/qregexp.html#wildcard-matching), which hides any items in the list which do not match the currently typed text.
You can also specify a blacklist of items which should never be shown, even though they are in the list. This is useful for only showing items which are not yet chosen elsewhere. Make sure all blacklist items are actually valid text items, which are contained in the list and can actually be blacklisted. Otherwise an exception is thrown.
To query the currently selected items, use getSelectedItems() or connect to the 'itemDoubleClicked()' signal.
|
explicit |
C'tor.
~FilterableList | ( | ) |
|
slot |
adds items to a blacklist, i.e. they are not shown, even if they are in the item list
Exception::InvalidValue | if any of additional_blacklist_items is not contained in current items |
|
signal |
emitted when the user has edited the filter
|
privateslot |
internally invoked when the filter was changed by the user emits 'filterChanged' signal and updates the current list of visible items
QStringList getAllVisibleItems | ( | ) | const |
get all items which are visible (i.e. excludes the ones which are hidden by the filter)
QStringList getSelectedItems | ( | ) | const |
get the currently selected items of all visible items, i.e. must pass the filter and be selected
|
signal |
emitted when this item was double clicked
|
slot |
removes items from blacklist, which should not be shown, even if they are in the item list
Exception::InvalidValue | if any of outdated_blacklist_items is not contained in current blacklist |
|
slot |
sets items of a blacklist, i.e. they are not shown, even if they are in the item list
Exception::InvalidValue | if any of blacklist_items is not contained in current items |
|
slot |
Provide new items to the widget. Be careful if blacklisted items have already been set. If in doubt, clear blacklisted items first to avoid an exception.
Exception::InvalidValue | if any of the internal blacklist_items_ is not contained in the given items |
|
privateslot |
recompute items_wo_bl_
, whenever items_ or blacklist_ changed. and call updateVisibleList_()
|
privateslot |
update shown items, based on current items_wo_bl_
and current filter
|
private |
blacklisted items, which are never shown, even if in items_
;
|
private |
full list of items to show; when filtered only a subset is shown
|
private |
items from item_
with blacklisted items removed
|
private |