Plasma Engine  2.0
Loading...
Searching...
No Matches
plQtProxy Class Referenceabstract

Glue class that maps plActions to QActions. QActions are only created if the plAction 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 plQtProxy:

Public Member Functions

virtual void Update ()=0
 
virtual void SetAction (plAction *pAction)
 
plActionGetAction ()
 

Static Public Member Functions

static bool TriggerDocumentAction (plDocument *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 plRttiMappedObjectFactory< plQtProxy > & GetFactory ()
 
static QSharedPointer< plQtProxyGetProxy (plActionContext &ref_context, plActionDescriptorHandle hAction)
 

Protected Member Functions

 PL_MAKE_SUBSYSTEM_STARTUP_FRIEND (GuiFoundation, QtProxies)
 

Protected Attributes

plActionm_pAction
 

Static Protected Attributes

static plRttiMappedObjectFactory< plQtProxys_Factory
 
static plMap< plActionDescriptorHandle, QWeakPointer< plQtProxy > > s_GlobalActions
 
static plMap< const plDocument *, plMap< plActionDescriptorHandle, QWeakPointer< plQtProxy > > > s_DocumentActions
 
static plMap< QWidget *, plMap< plActionDescriptorHandle, QWeakPointer< plQtProxy > > > s_WindowActions
 
static QObject * s_pSignalProxy = nullptr
 

Detailed Description

Glue class that maps plActions to QActions. QActions are only created if the plAction 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 plQtProxy::TriggerDocumentAction ( plDocument * 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: