unity.scopes.qt.QActionMetadata

Metadata passed to scopes for preview and activation. More...

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

Public Member Functions

 QActionMetadata (QString const &locale, QString const &form_factor)
 Create ActionMetadata with the given locale and form factor. More...
 
void set_scope_data (QVariant const &data)
 Attach arbitrary data to this ActionMetadata. More...
 
QVariant scope_data () const
 Get data attached to this ActionMetadata. More...
 
void set_hint (QString const &key, QVariant const &value)
 Sets a hint. More...
 
QVariantMap hints () const
 Get all hints. More...
 
bool contains_hint (QString const &key) const
 Check if this SearchMetadata has a hint. More...
 
QVariant & operator[] (QString const &key)
 Returns a reference to a hint. More...
 
QVariant const & operator[] (QString const &key) const
 Returns a const reference to a hint. More...
 
Copy and assignment

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

 QActionMetadata (QActionMetadata const &other)
 
 QActionMetadata (QActionMetadata &&)
 
QActionMetadataoperator= (QActionMetadata const &other)
 
QActionMetadataoperator= (QActionMetadata &&)
 

Detailed Description

Metadata passed to scopes for preview and activation.

See also
unity::scopes::qt::QScopeBase::preview, unity::scopes::ScopeBase::activate, unity::scopes::ScopeBase::perform_action

Constructor & Destructor Documentation

unity::scopes::qt::QActionMetadata::QActionMetadata ( QString const &  locale,
QString const &  form_factor 
)

Create ActionMetadata with the given locale and form factor.

Parameters
localelocale string, eg. en_EN
form_factorform factor name, e.g. phone, desktop, phone-version etc.

Member Function Documentation

bool unity::scopes::qt::QActionMetadata::contains_hint ( QString const &  key) const

Check if this SearchMetadata has a hint.

Parameters
keyThe hint name.
Returns
True if the hint is set.
QVariantMap unity::scopes::qt::QActionMetadata::hints ( ) const

Get all hints.

Returns
Hints dictionary.
Exceptions
unity::NotFoundExceptionif no hints are available.
QVariant& unity::scopes::qt::QActionMetadata::operator[] ( QString const &  key)

Returns a reference to a hint.

This method can be used to read or set hints. Setting a value of an existing hint overwrites its previous value. Referencing a non-existing hint automatically creates it with a default value of QVariant::Type::Null.

Parameters
keyThe name of the hint.
Returns
A reference to the hint.
QVariant const& unity::scopes::qt::QActionMetadata::operator[] ( QString const &  key) const

Returns a const reference to a hint.

This method can be used for read-only access to hints. Referencing a non-existing hint throws unity::InvalidArgumentException.

Parameters
keyThe name of the hint.
Returns
A const reference to the hint.
Exceptions
unity::NotFoundExceptionif no hint with the given name exists.
QVariant unity::scopes::qt::QActionMetadata::scope_data ( ) const

Get data attached to this ActionMetadata.

Returns
The attached data, or QVariant::null.
void unity::scopes::qt::QActionMetadata::set_hint ( QString const &  key,
QVariant const &  value 
)

Sets a hint.

Parameters
keyThe name of the hint.
valueHint value
void unity::scopes::qt::QActionMetadata::set_scope_data ( QVariant const &  data)

Attach arbitrary data to this ActionMetadata.

Parameters
dataThe data value to attach.