#include <MutuallyExclusiveListWidget.h>
Public Slots | |
| void | selectItems (const QStringList &items) |
| void | removeItems (const QStringList &items) |
Signals | |
| void | itemSelected (const QString &item) |
| void | itemRemoved (const QString &item) |
Public Member Functions | |
| MutuallyExclusiveListWidget (QWidget *pParent=NULL) | |
| virtual | ~MutuallyExclusiveListWidget () |
| void | setAvailableItemsLabel (const QString &label) |
| QString | getAvailableItemsLabel () const |
| void | setAvailableItems (const QStringList &items) |
| QStringList | getAvailableItems () const |
| void | setSelectedItemsLabel (const QString &label) |
| QString | getSelectedItemsLabel () const |
| QStringList | getSelectedItems () const |
Protected Slots | |
| void | addSelectedItem () |
| void | removeSelectedItem () |
The mutually exclusive list widget contains two QListWidget objects: one list to contain available items to select, and another list to contain the ordered set of items selected from the first list. When an item is selected from the available items list it is added to the selected items list and no longer appears in the available items list. Both list widgets are single selection and cannot be sorted.
The widget also contains Add and Remove buttons to transfer items between the two lists, and labels to provide a description of each list.
Definition at line 33 of file MutuallyExclusiveListWidget.h.
| MutuallyExclusiveListWidget::MutuallyExclusiveListWidget | ( | QWidget * | pParent = NULL |
) |
Creates a new mutually exclusive list widget with empty lists and default labels of "Available Items" and "Selected Items".
| pParent | The parent widget. |
| virtual MutuallyExclusiveListWidget::~MutuallyExclusiveListWidget | ( | ) | [virtual] |
Destroys the mutually exclusive list widget.
| void MutuallyExclusiveListWidget::setAvailableItemsLabel | ( | const QString & | label | ) |
Sets the text description of the available items list.
| label | The available items list description. |
| QString MutuallyExclusiveListWidget::getAvailableItemsLabel | ( | ) | const |
Returns the text description of the available items list.
| void MutuallyExclusiveListWidget::setAvailableItems | ( | const QStringList & | items | ) |
Sets the list of available items to select from.
This methods clears the existing contents of both the available items and selected items lists. The method then populates the available items list with the given names. To set initially selected items call selectItems() after calling this method.
| items | The list of available items. |
| QStringList MutuallyExclusiveListWidget::getAvailableItems | ( | ) | const |
Returns the list of remaining available items to select from.
This methods returns only the items in the available items list that have not been selected.
| void MutuallyExclusiveListWidget::setSelectedItemsLabel | ( | const QString & | label | ) |
Sets the text description of the selected items list.
| label | The selected items list description. |
| QString MutuallyExclusiveListWidget::getSelectedItemsLabel | ( | ) | const |
Returns the text description of the selected items list.
| QStringList MutuallyExclusiveListWidget::getSelectedItems | ( | ) | const |
Returns the list of selected items.
| void MutuallyExclusiveListWidget::selectItems | ( | const QStringList & | items | ) | [slot] |
Moves items from the available items list to the selected items list.
| items | The items to move from the available items list to the selected items list. |
| void MutuallyExclusiveListWidget::removeItems | ( | const QStringList & | items | ) | [slot] |
Moves items from the selected items list to the available items list.
| items | The items to move from the selected items list to the available items list. |
| void MutuallyExclusiveListWidget::itemSelected | ( | const QString & | item | ) | [signal] |
A signal that is emitted when an item moves from the available items list to the selected items list.
The signal is emitted when the user clicks the Add button or when the selectItems() method is called. If multiple items are moved as a result of calling selectItems(), the signal is emitted once for each item.
| item | The item that moved from the available items list to the selected items list. |
| void MutuallyExclusiveListWidget::itemRemoved | ( | const QString & | item | ) | [signal] |
A signal that is emitted when an item moves from the selected items list to the available items list.
The signal is emitted when the user clicks the Remove button or when the removeItems() method is called. If multiple items are moved as a result of calling removeItems(), the signal is emitted once for each item.
| item | The item that moved from the selected items list to the available items list. |
| void MutuallyExclusiveListWidget::addSelectedItem | ( | ) | [protected, slot] |
Moves the currently selected item in the available items list to the selected items list.
This method is called automatically when the user clicks the Add button, and should not need to be called explicitly.
| void MutuallyExclusiveListWidget::removeSelectedItem | ( | ) | [protected, slot] |
Moves the currently selected item in the selected items list to the available items list.
This method is called automatically when the user clicks the Remove button, and should not need to be called explicitly.