LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LeechCraft::Util::CategorySelector Class Reference

The CategorySelector widget provides a way to select amongst a group of items. More...

#include "categoryselector.h"

+ Inheritance diagram for LeechCraft::Util::CategorySelector:
+ Collaboration diagram for LeechCraft::Util::CategorySelector:

Public Slots

void selectAll ()
 Selects all variants. More...
 
void selectNone ()
 Deselects all variants. More...
 
void setPossibleSelections (QStringList selections)
 Sets possible selections. More...
 
void lineTextChanged (const QString &newText)
 Notifies CategorySelector about logical selection changes. More...
 

Signals

void tagsSelectionChanged (const QStringList &newSelections)
 Indicates that selections have changed. More...
 

Public Member Functions

 CategorySelector (QWidget *parent=0)
 Constructor. More...
 
void SetCaption (const QString &caption)
 Sets the caption of this selector. More...
 
QStringList GetSelections ()
 Gets selected items. More...
 
void SetSelections (const QStringList &subset)
 Selects some of the items. More...
 
UTIL_API QString GetSeparator () const
 Returns the separator for the tags. More...
 
UTIL_API void SetSeparator (const QString &)
 Sets the separator for the tags. More...
 

Protected Member Functions

virtual void moveEvent (QMoveEvent *)
 Checks whether after the move event the selector won't be beoynd the screen. if it would, moves back. More...
 

Detailed Description

The CategorySelector widget provides a way to select amongst a group of items.

The CategorySelector is a QWidget having Qt::Tool window hint. That results in representing this widget as a tool window - usually a small window with smaller than usual title bar and decoration. CategorySelector represents the possible selections as a list of check boxes.

Programmer can set the list of possible choice variants using SetPossibleSelections and get selected items with GetSelections.

CategorySelector emits selectionChanged() signal when user changes his selection. CategorySelector's primary purpose is to help user to select tags using a line edit, so there's a convenience slot lineTextChanged() which could be used to notify CategorySelector about changes of possible categories. There are also convenience slots selectAll() and selectNone() which could be used to mark all and no elements in the list respectively.

Definition at line 62 of file categoryselector.h.

Constructor & Destructor Documentation

CategorySelector::CategorySelector ( QWidget *  parent = 0)

Constructor.

Sets the default window title and window flags (Qt::Tool | Qt::WindowStaysOnTopHint), calculates the default geometry.

Parameters
[in]parentPointer to parent widget.

Definition at line 45 of file categoryselector.cpp.

References selectAll(), and selectNone().

+ Here is the call graph for this function:

Member Function Documentation

QStringList CategorySelector::GetSelections ( )

Gets selected items.

Returns the selected items - a subset of selection variants passed via SetPossibleSelections.

Returns
Selected items.
See Also
SetPossibleSelections

Definition at line 119 of file categoryselector.cpp.

References RoleTag.

QString CategorySelector::GetSeparator ( ) const

Returns the separator for the tags.

The default separator is "; ".

See Also
SetSeparator()

Definition at line 148 of file categoryselector.cpp.

void CategorySelector::lineTextChanged ( const QString &  newText)
slot

Notifies CategorySelector about logical selection changes.

This slot is usually used to notify CategorySelector about selection changes done via a related widget - for example, a line edit with tags.

Parameters
[in]newTextThe text of the line edit.

Definition at line 216 of file categoryselector.cpp.

References SetSelections().

+ Here is the call graph for this function:

void CategorySelector::moveEvent ( QMoveEvent *  e)
protectedvirtual

Checks whether after the move event the selector won't be beoynd the screen. if it would, moves back.

Definition at line 158 of file categoryselector.cpp.

void CategorySelector::selectAll ( )
slot

Selects all variants.

Definition at line 174 of file categoryselector.cpp.

References RoleTag, and tagsSelectionChanged().

Referenced by CategorySelector().

+ Here is the caller graph for this function:

void CategorySelector::selectNone ( )
slot

Deselects all variants.

Definition at line 198 of file categoryselector.cpp.

References tagsSelectionChanged().

Referenced by CategorySelector().

+ Here is the caller graph for this function:

void CategorySelector::SetCaption ( const QString &  caption)

Sets the caption of this selector.

By default, the selector has no caption.

Parameters
[in]captionThe new caption of this selector.

Definition at line 80 of file categoryselector.cpp.

void CategorySelector::setPossibleSelections ( QStringList  selections)
slot

Sets possible selections.

Clears previous selections list, sets new possible selections according to selections parameter. By default, no items are selected.

Parameters
[in]selectionsPossible selections.
See Also
GetSelections

Definition at line 86 of file categoryselector.cpp.

References RoleTag, and tagsSelectionChanged().

void CategorySelector::SetSelections ( const QStringList &  subset)

Selects some of the items.

Selects some of the items presented by elements of the subset list.

This function won't emit selectionChanged() signal.

Parameters
[in]subsetThe list of items to select.

Definition at line 134 of file categoryselector.cpp.

References RoleTag.

Referenced by lineTextChanged().

+ Here is the caller graph for this function:

void CategorySelector::SetSeparator ( const QString &  sep)

Sets the separator for the tags.

This function doesn't update the text in the line edit.

See Also
GetSeparator()

Definition at line 153 of file categoryselector.cpp.

void LeechCraft::Util::CategorySelector::tagsSelectionChanged ( const QStringList &  newSelections)
signal

Indicates that selections have changed.

Parameters
[out]newSelectionsSelected items.

Referenced by selectAll(), selectNone(), and setPossibleSelections().

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files: