Detailed Description
The QContentFilterSelector widget allows the user to select filters to refine the visible selection of content on a device.
QContentFilterDialog is based on QContentFilterModel and its contents are defined using a QContentFilterModel::Template.
A content filter selector may be either single or multiple selection depending on its set model template. In a single selection the filterSelected() signal is emitted when a filter is selected. In a multiple selection scenario the checkedFilter() method will return the checked filters and brief summary of the checked filter's labels may also be retrieved using the checkedLabel() method.
Constructing a content filter selector to select a an album filter from a list grouped by artist.
QContentFilterModel::Template albums( QContent::Album );
QContentFilterModel::Template artists( album, QContent::Artist );
QContentFilterSelector *selector = new QContentFilterSelector( this );
selector->setModelTemplate( artists );
connect( selector, SIGNAL(filterSelected(QContentFilter)), this, SLOT(filterSelected(QContentFilter)) );
See also QContentFilterModel and QContentFilterDialog.
Member Function Documentation
QContentFilterSelector::QContentFilterSelector ( QWidget * parent = 0 )
Constructs a filter selector with the parent parent.
QContentFilterSelector::QContentFilterSelector ( const QContentFilterModel::Template & modelTemplate, QWidget * parent = 0 )
Constructs a filter selector widget with the parent parent and the template modelTemplate.
QContentFilterSelector::QContentFilterSelector ( QContent::Property property, QContentFilterModel::TemplateOptions options = QContentFilterModel::SelectAll, const QStringList & checked = QStringList(), QWidget * parent = 0 )
Constructs a filter selector widget parented to parent that lists the possible values of property according to the filter model template options options.
The properties listed in the checked list will be checked by default.
Constructs a filter selector widget parented to parent that lists filters which are of type type and within the given scope according to the filter model template options options.
Any filters with an argument that matches one in the checked list will be checked by default.
QContentFilter QContentFilterSelector::checkedFilter () const
Returns a filter combining all filters checked by the user.
QString QContentFilterSelector::checkedLabel () const
Returns a short summary describing the checked filters, if a single filter is checked the display text for that label is returned concatenated with a list of it's parent filter's display text. If multiple filters are checked then the text 'Multi' is returned concatenated to a list of parents common to all checked filters.
QContentFilter QContentFilterSelector::filter ()
Returns the base filter.
See also setFilter().
void QContentFilterSelector::filterSelected ( const QContentFilter & filter ) [signal]
Signals that a filter has been selected.
This signal is only emitted for filters that are not part of a checklist and have no children.
Returns the model template.
See also setModelTemplate().
void QContentFilterSelector::setFilter ( const QContentFilter & filter )
Sets the base filter.
See also filter().
void QContentFilterSelector::setModelTemplate ( const QContentFilterModel::Template & modelTemplate )
Sets the model template to modelTemplate.
See also modelTemplate().
void QContentFilterSelector::setModelTemplate ( QContent::Property property, QContentFilterModel::TemplateOptions options = QContentFilterModel::SelectAll, const QStringList & checked = QStringList() )
This is an overloaded member function, provided for convenience.
Sets the model template to a list of possible values of property according to the given options.
The properties listed in the checked list will be checked by default.
This is an overloaded member function, provided for convenience.
Set the model template to a list of filters of type type with the specialization scope according to the given options.
Any filters with an argument that matches one in the checked list will be checked by default.