Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QCategorySelector widget allows users to select categories for filtering or for applying to an item. More...
#include <QCategorySelector>
Inherits QWidget.
The QCategorySelector widget allows users to select categories for filtering or for applying to an item.
QCategorySelector is a widget that shows categories the user can choose from. Its appearance and behavior are determined by flags given to the constructor. Control over the categories that are visible is achieved via the select...() functions.
QCategorySelector automatically updates when the system's categories are changed. It provides an interface for the user to add/edit/delete user categories.
QCategorySelector is typically used as a QCategorySelector::Filter or QCategorySelector::Editor;
Here's an example of using it as a filter.
MyWidget::MyWidget() { QCategorySelector *sel = new QCategorySelector( "myappscope", QCategorySelector::Filter ); connect( sel, SIGNAL(filterSelected(QCategoryFilter)), this, SLOT(filterCategories(QCategoryFilter)) ); QSettings settings("mycompany", "myapp"); QCategoryFilter f; f.readConfig( settings, "filter" ); sel->selectFilter( f ); } void MyWidget::filterCategories( const QCategoryFilter &filter ) { QSettings settings("mycompany", "myapp"); filter.writeConfig( settings, "filter" ); foreach ( item, itemList ) item->setVisible( filter.accepted( item->categories() ) ); }
Here's an example of using QCategorySelector an editor.
MyWidget::MyWidget( MyRecord *item ) { QCategorySelector *sel = new QCategorySelector( "myappscope", QCategorySelector::Editor ); sel->selectCategories( item->categories() ); connect( sel, SIGNAL(categoriesSelected(QList<QString>)), item, SLOT(setCategories(QList<QString>)) ); }
See also Categories.
Constant | Value | Description |
---|---|---|
QCategorySelector::IncludeAll | 0x04 | Include the All categories option. |
QCategorySelector::IncludeUnfiled | 0x08 | Include the Unfiled categories option. |
QCategorySelector::SingleSelection | 0x80 | Allow selection of a single category. The default is to allow combinations of categories. |
QCategorySelector::ListView | 0x10 | Display as a list view. |
QCategorySelector::ComboView | 0x20 | Display as a combo box. Note that this will encourage exclusive selection of categories. |
QCategorySelector::DialogView | 0x40 | Display as a button that opens a dialog containing a list view. |
QCategorySelector::Filter | IncludeAll | IncludeUnfiled | Alias for IncludeAll|IncludeUnfiled. |
QCategorySelector::Editor | IncludeUnfiled | Alias for IncludeUnfiled. |
QCategorySelector::ViewMask | ListView | ComboView | DialogView | Masks the view selection flags. |
The list view looks like this.
[Missing image qcategoryselector-list.png]
The combo box looks like this.
[Missing image qcategoryselector-combo-down.png]
[Missing image qcategoryselector-combo-up.png]
The button looks like this.
[Missing image qcategoryselector-button.png]
The ContentFlags type is a typedef for QFlags<ContentFlag>. It stores an OR combination of ContentFlag values.
Constructs a QCategorySelector as an editor widget with the given parent.
Constructs a QCategorySelector with the given parent. Unless it is null, scope limits the categories that can be seen. The flags in f determine the apperance and behavior of the QCategorySelector.
Destroys a QCategorySelector.
This signal is emitted when the selected categories changes. The selected categories are indicated by list.
Note that this function does not indicate if All or Unfiled is selected. Use filterSelected() to determine if these items are selected.
This signal is emitted when the selected categories changes. The selected categories are indicated by filter.
See also QCategoryFilter::requiredCategories().
Selects the All entry (all categories are selected).
Selects the categories with identifiers in the comma-separated list categoryids.
This is an overloaded member function, provided for convenience.
Selects the categories with identifiers in list categoryids.
Selects the categories specified by filter.
Selects the Unfiled entry (no categories are selected).
Returns the list of selected categories.
Note that this function does not indicate if All or Unfiled is selected. Use selectedFilter() to determine if these items are selected.
Returns the QCategoryFilter that indicates the selected categories.
See also QCategoryFilter::requiredCategories().
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |