The main action class. More...
Public Types | |
enum | Type { None, String, Integer, Bool, Real } |
Available parameter types. More... | |
Public Slots | |
void | trigger (QVariant value=QVariant()) |
Signals | |
void | descriptionChanged (const QString &value) |
void | enabledChanged (bool value) |
void | iconNameChanged (const QString &value) |
void | keywordsChanged (const QString &value) |
void | nameChanged (const QString &value) |
void | parameterTypeChanged (unity::action::Action::Type value) |
void | textChanged (const QString &value) |
void | triggered (QVariant value) |
Public Member Functions | |
Action (QObject *parent=0) | |
QString | description () const |
bool | enabled () const |
QString | iconName () const |
QString | keywords () const |
QString | name () const |
Type | parameterType () const |
void | setDescription (const QString &value) |
void | setEnabled (bool value) |
void | setIconName (const QString &value) |
void | setKeywords (const QString &value) |
void | setName (const QString &value) |
void | setParameterType (Type value) |
void | setText (const QString &value) |
QString | text () const |
Properties | |
QString | description |
bool | enabled |
QString | iconName |
QString | keywords |
QString | name |
unity::action::Action::Type | parameterType |
QString | text |
The main action class.
Unity services visualizing this class will usually be represented it as a simple button or menu item, depending upon where it is contributed.
The optional name property is available through D-Bus and can be used to activate a specific Action from external componenets such as the Launcher. See Platform Integration and Offline Actions for more information.
If the parameterType property is set, the Action is said to be parameterised. This means that when it is bound to a menu or button, the action expects a typed input parameter. The type affects the allowed value of the QVariant that must be passed to the trigger() and triggered().
Action has to be added to the ActionManager or a ActionContext to make it available for external components.
Available parameter types.
This enum defines the available types that the action trigger() and triggered() support.
|
explicit |
parent | parent QObject or 0 |
Constructs a new Action. See the property documentation for default values.
|
slot |
Checks the value agains parameterType and triggers the action.
if paramType is Action::None the action can be triggered by simly calling:
|
signal |
value | the value which which was passed to trigger() |
The value is always compatible with the set parameterType. For example if parameterType is Action::String the value can be converted to QString by using the QVariant conversion functions:
|
readwrite |
User visible secondary description for the action.
Description is more verbose than the text() and should describe the Action with couple of words.
|
readwrite |
|
readwrite |
Name of a icon for this action.
When the action is exported to external components the iconName must be avaible on system icon theme engine.
|
readwrite |
Additional user visible keywords for the action.
Keywords improve the HUD search results when the user tries to search for an action with a synonym of the text(). For example if we the application has an action "Crop" but the user tries to "Trim" then without the keywords the HUD would not try to offer the "Crop" action.
The format of the keywords string is "Keyword 1;Keyword 2;Keyword 3" to allow translators to define different number of keywords per language.
The keywords are separated by ; and they may contain spaces.
|
readwrite |
The name of the action. By default an action gets it's name generated automatically if not overridden with setName() later. If name is set to "" then the action restores it's autogenerated name.
The actions is accessible from D-Bus with this name.
The name is not user visible.
|
readwrite |
Type of the parameter passed to trigger() and triggered().
|
readwrite |
The user visible primary label of the action.