All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions
Qtilities::CoreGui::Command Class Reference

A class which represents a command. More...

#include <Command.h>

Inheritance diagram for Qtilities::CoreGui::Command:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual QAction * action () const =0
 The action associated with this command. If the command is a wrapper for a shortcut, 0 is returned.
Qtilities::Core::QtilitiesCategory category () const
 Gets the command's category.
QKeySequence defaultKeySequence () const
 Returns the default key sequence.
QString defaultText () const
 Gets the default text (id) associated with this command.
virtual void handleKeySequenceChange (const QKeySequence &old_key)=0
 Called when the key sequence changes.
QKeySequence keySequence () const
 Returns the current key sequence.
void setCategory (Qtilities::Core::QtilitiesCategory category)
 Sets the command's category.
virtual bool setCurrentContext (QList< int > context_ids)=0
 Call to set change the curent context of a command.
void setDefaultKeySequence (const QKeySequence &key)
 Sets the default key sequence.
void setDefaultText (const QString &text)
 Sets the default text (id) associated with this command.
void setKeySequence (const QKeySequence &key)
 Sets the current key sequence.
virtual QShortcut * shortcut () const =0
 The shortcut associated with this command. If the command is a wrapper for an action, 0 is returned.
virtual QString text () const =0
 Returns the text which appears as user friendly text to the user.
virtual void unregisterContext (int context_id)=0
 Removes all backend actions from the command which were registered for the specified context.

Detailed Description

A class which represents a command.

A command is a class which is a wrapper for either of the following:

By registering all the shortcuts and actions in the application in one place, it is easier to manage and control them. The command class is also aware of the current context of the application and enables/disables shortcuts and actions depending on the context.

Each command can be used accros multiple contexts. For example, you can present the user with a single command. The user will see one command (if the command contains an action) but the result of triggering the command will be different depending on the context.

A command has a key sequence associated with it. If the command represents an application wide shortcut, the key sequence will be the sequence that triggers that shortcut. If the command is an action, the key sequence will trigger the action.

The command class is an abstract base class and is reimplemented by the ProxyAction and Shortcut classes.

For more information see the Action Management article.


Member Function Documentation

virtual void Qtilities::CoreGui::Command::unregisterContext ( int  context_id)
pure virtual

Removes all backend actions from the command which were registered for the specified context.

Parameters:
context_idThe applicable context.

This function was added in Qtilities v1.2.

Implemented in Qtilities::CoreGui::ShortcutCommand, and Qtilities::CoreGui::ProxyAction.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé