unity.scopes.qt.QCannedQuery

Parameters of a search query. More...

#include <unity/scopes/qt/QCannedQuery.h>

Public Member Functions

 QCannedQuery (QString const &scope_id)
 Creates a query for given scope with empty query string.
 
 QCannedQuery (QString const &scope_id, QString const &query_str, QString const &department_id)
 Creates a query for given scope with specific query string and in given department.
 
void set_department_id (QString const &dep_id)
 Sets or updates the department.
 
void set_query_string (QString const &query_str)
 Sets or updates the query string.
 
void set_filter_state (FilterState const &filter_state)
 Sets filter state.
 
QString scope_id () const
 Returns the scope identifier of this CannedQuery. More...
 
QString department_id () const
 Returns the department id of this CannedQuery. More...
 
QString query_string () const
 Returns the query string of this CannedQuery. More...
 
QString to_uri () const
 Returns a string representation of this CannedQuery object as a URI using scope:// schema. More...
 
FilterState filter_state () const
 Get state of the filters for this CannedQuery. More...
 
bool has_user_data () const
 Checks if user data has been attached to this query. More...
 
QVariant user_data () const
 Get user data attached to this query. More...
 
Copy and assignment

Copy and assignment operators (move and non-move versions) have the usual value semantics.

 QCannedQuery (QCannedQuery const &other)
 
 QCannedQuery (QCannedQuery &&)
 
QCannedQueryoperator= (QCannedQuery const &other)
 
QCannedQueryoperator= (QCannedQuery &&)
 

Static Public Member Functions

static QCannedQuery from_uri (QString const &uri)
 Recreates a CannedQuery object from a scope:// URI. More...
 

Detailed Description

Parameters of a search query.

Holds all parameters of a search query: the target scope id, query string, department id, and state of the filters. Can be converted to/from scope:// uri schema string.

Member Function Documentation

QString QCannedQuery::department_id ( ) const

Returns the department id of this CannedQuery.

Returns
The department id.
FilterState QCannedQuery::filter_state ( ) const

Get state of the filters for this CannedQuery.

Pass this state to methods of specific filter instances (such as unity::scopes::OptionSelectorFilter::active_options())to examine filter state.

Returns
The state of the filters.
QCannedQuery QCannedQuery::from_uri ( QString const &  uri)
static

Recreates a CannedQuery object from a scope:// URI.

Returns
a CannedQuery instance
Exceptions
InvalidArgumentExceptionif the URI cannot be parsed.
bool QCannedQuery::has_user_data ( ) const

Checks if user data has been attached to this query.

Returns
true if data is available.
QString QCannedQuery::query_string ( ) const

Returns the query string of this CannedQuery.

Returns
The query string.
QString QCannedQuery::scope_id ( ) const

Returns the scope identifier of this CannedQuery.

Returns
The scope identifier.
QString QCannedQuery::to_uri ( ) const

Returns a string representation of this CannedQuery object as a URI using scope:// schema.

Returns
The URI for the query.
QVariant QCannedQuery::user_data ( ) const

Get user data attached to this query.

Returns
Data variant
Exceptions
unity::LogicExceptionif data is not available.