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 &&) | |
QActionMetadata & | operator= (QActionMetadata const &other) |
QActionMetadata & | operator= (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
-
locale locale string, eg. en_EN form_factor form 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
-
key The hint name.
- Returns
- True if the hint is set.
QVariantMap unity::scopes::qt::QActionMetadata::hints | ( | ) | const |
Get all hints.
- Returns
- Hints dictionary.
- Exceptions
-
unity::NotFoundException if 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
-
key The 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
-
key The name of the hint.
- Returns
- A const reference to the hint.
- Exceptions
-
unity::NotFoundException if 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
-
key The name of the hint. value Hint value
void unity::scopes::qt::QActionMetadata::set_scope_data | ( | QVariant const & | data | ) |
Attach arbitrary data to this ActionMetadata.
- Parameters
-
data The data value to attach.