Interface used to communicate with the clipboard manager. More...
#include <IClipboard.h>
Public Types | |
enum | ClipboardOrigin { CopyAction, CutAction, Unspecified } |
Enumeration which is used to indicate if a copy or a cut operation caused the clipboard to change. More... |
Public Member Functions | |
virtual void | acceptMimeData ()=0 |
Call this function if you accepted the mime data and want to remove the data from the clipboard. It will disable the paste action. | |
virtual ClipboardOrigin | clipboardOrigin ()=0 |
Gives information about the data which was placed in the clipboard. | |
virtual void | initialize ()=0 |
Initializes the actions associated with the clipboard manager. | |
virtual void | setClipboardOrigin (ClipboardOrigin)=0 |
Call this function after a copy or cut action call to indicate what the paste action should do. | |
Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase | |
virtual QObject * | objectBase ()=0 |
Returns the QObject* base of the interface. | |
virtual const QObject * | objectBase () const =0 |
Returns a const QObject* base of the interface. | |
QString | objectOriginID () const |
Allows interfaces to provide some sort of source identification. | |
void | setObjectOriginID (const QString &object_origin_id) |
Allows setting of the object source ID of this interface implementation. |
Interface used to communicate with the clipboard manager.
The goal of the clipboard manager is to register backends (associated with the standard context) for the Qtilities::CoreGui::Actions::qti_action_EDIT_COPY, Qtilities::CoreGui::Actions::qti_action_EDIT_CUT and Qtilities::CoreGui::Actions::qti_action_EDIT_PASTE action placeholders if they exists. This allows control over disabling and enabling these three actions in Qtilities applications. For example, the paste action should only be enabled if something exists in the the clipboard. Also, when you perform a paste operation, the paste action must become disabled again. The clipboard manager provides this functionality.
To use the Qtilities clipboard in your applications, you must register the copy and cut actions in your main function and then initialize the clipboard as shown below:
The operation and intended usage of the clipboard manager is best shown using an example, thus we look at a shortened version of the copy, cut and paste action handlers taken from the Qtilities::CoreGui::ObserverWidget class' sources.
First we look at the observer widget's copy action handler implementation:
Next we look at the observer widget's cut action handler implementation:
Finaly we look at the observer widget's paste action handler implementation:
Enumeration which is used to indicate if a copy or a cut operation caused the clipboard to change.
Qtilities : Reference Documentation | Back to top |
Copyright © 2009-2013, Jaco Naudé
|