XII Release 0.1.0
Loading...
Searching...
No Matches
xiiQtProxy Class Referenceabstract

Glue class that maps xiiActions to QActions. QActions are only created if the xiiAction is actually mapped somewhere. Document and Global actions are manually executed and don't solely rely on Qt's ShortcutContext setting to prevent ambiguous action shortcuts. More...

#include <QtProxy.moc.h>

Inheritance diagram for xiiQtProxy:
[legend]

Public Member Functions

virtual void Update ()=0
 
virtual void SetAction (xiiAction *pAction)
 
xiiActionGetAction ()
 

Static Public Member Functions

static bool TriggerDocumentAction (xiiDocument *pDocument, QKeyEvent *pEvent, bool bTestOnly)
 Converts the QKeyEvent into a shortcut and tries to find a matching action in the document and global action list.
 
static xiiRttiMappedObjectFactory< xiiQtProxy > & GetFactory ()
 
static QSharedPointer< xiiQtProxyGetProxy (xiiActionContext &ref_context, xiiActionDescriptorHandle hAction)
 

Protected Member Functions

 XII_MAKE_SUBSYSTEM_STARTUP_FRIEND (GuiFoundation, QtProxies)
 

Protected Attributes

xiiActionm_pAction
 

Static Protected Attributes

static xiiRttiMappedObjectFactory< xiiQtProxys_Factory
 
static xiiMap< xiiActionDescriptorHandle, QWeakPointer< xiiQtProxy > > s_GlobalActions
 
static xiiMap< const xiiDocument *, xiiMap< xiiActionDescriptorHandle, QWeakPointer< xiiQtProxy > > > s_DocumentActions
 
static xiiMap< QWidget *, xiiMap< xiiActionDescriptorHandle, QWeakPointer< xiiQtProxy > > > s_WindowActions
 
static QObject * s_pSignalProxy = nullptr
 

Detailed Description

Glue class that maps xiiActions to QActions. QActions are only created if the xiiAction is actually mapped somewhere. Document and Global actions are manually executed and don't solely rely on Qt's ShortcutContext setting to prevent ambiguous action shortcuts.

Member Function Documentation

◆ TriggerDocumentAction()

bool xiiQtProxy::TriggerDocumentAction ( xiiDocument * pDocument,
QKeyEvent * pEvent,
bool bTestOnly )
static

Converts the QKeyEvent into a shortcut and tries to find a matching action in the document and global action list.

Document actions are not mapped as ShortcutContext::WindowShortcut because docking allows for multiple documents to be mapped into the same window. Instead, ShortcutContext::WidgetWithChildrenShortcut is used to prevent ambiguous action shortcuts and the actions are executed manually via filtering QEvent::ShortcutOverride at the dock widget level. The function always has to be called two times: A: QEvent::ShortcutOverride: Only check with bTestOnly = true that we want to override the shortcut. This will instruct Qt to send the event as a regular key press event to the widget that accepted the override. B: QEvent::keyPressEvent: Execute the actual action with bTestOnly = false;

Parameters
pDocumentThe document for which matching actions should be searched for. If null, only global actions are searched.
pEventThe key event that should be converted into a shortcut.
bTestOnlyAccept the event and return true but don't execute the action. Use this inside QEvent::ShortcutOverride.
Returns
Whether the key event was consumed and an action executed.

The documentation for this class was generated from the following files: