Detailed Description
The QContentFilterDialog widget provides a dialog box for selecting content filters.
QContentFilterDialog is based on QContentFilterModel and its contents are defined using a QContentFilterModel::Template.
A content filter dialog may be either single or multiple selection depending on its set model template. The filter selected in a single selection scenario may be retrieved using the selectedFilter() method, and the checkedFilter() method will return the checked filters in a multiple selection scenario. A brief summary of the checked filter's labels may also be retrieved using the checkedLabel() method.
Using a content filter dialog to select an or'ed combination of mime type filters:
QContentFilter selectMimeTypes()
{
QContentFilterDialog dialog(
QContentFilter::MimeType, QString(), QContentFilterModel::CheckList | QContentFilterModel::SelectAll );
dialog.setFilter( QContentFilter( QContent::Document ) );
QtopiaApplication::execDialog( &dialog );
return dialog.checkedFilters();
}
Using a content filter dialog to select a an album filter from a list grouped by artist.
QContentFilter selectAlbum()
{
QContentFilterModel::Template albums( QContent::Album );
QContentFilterModel::Template artists( album, QContent::Artist );
QContentFilterDialog dialog;
dialog.setModelTemplate( artists );
if( QtopiaApplication::execDialog( &dialog ) == QDialog::Accept )
return dialog.selectedFilter();
else
return QContentFilter();
}
See also QContentFilterModel and QContentFilterSelector.
Member Function Documentation
QContentFilterDialog::QContentFilterDialog ( QWidget * parent = 0 )
Constructs a content filter dialog with the parent parent.
QContentFilterDialog::QContentFilterDialog ( const QContentFilterModel::Template & modelTemplate, QWidget * parent = 0 )
Constructs a content filter selector dialog with the parent parent and the initial template modelTemplate.
QContentFilterDialog::QContentFilterDialog ( QContent::Property property, QContentFilterModel::TemplateOptions options = QContentFilterModel::SelectAll, const QStringList & checked = QStringList(), QWidget * parent = 0 )
Constructs a content filter dialog 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 content filter dialog 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 QContentFilterDialog::checkedFilter () const
Returns a filter combining all filters checked by the user.
QString QContentFilterDialog::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 QContentFilterDialog::filter ()
Returns the base filter.
See also setFilter().
Returns the current model template
See also setModelTemplate().
QContentFilter QContentFilterDialog::selectedFilter () const
Returns the filter selected by the user.
void QContentFilterDialog::setFilter ( const QContentFilter & filter )
Sets the base filter.
See also filter().
void QContentFilterDialog::setModelTemplate ( const QContentFilterModel::Template & modelTemplate )
Sets the model template to modelTemplate.
See also modelTemplate().
void QContentFilterDialog::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.