Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuickActionPrivate Class Reference

#include <qquickaction_p_p.h>

Inheritance diagram for QQuickActionPrivate:
Collaboration diagram for QQuickActionPrivate:

Public Member Functions

void setEnabled (bool enable)
 Abstract user interface action.
bool watchItem (QQuickItem *item)
bool unwatchItem (QQuickItem *item)
void registerItem (QQuickItem *item)
void unregisterItem (QQuickItem *item)
void itemVisibilityChanged (QQuickItem *item) override
void itemDestroyed (QQuickItem *item) override
bool handleShortcutEvent (QObject *object, QShortcutEvent *event)
void trigger (QObject *, bool doToggle)
Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
void setObjectNameWithoutBindings (const QString &name)
 QObjectPrivate (decltype(QObjectPrivateVersion) version=QObjectPrivateVersion)
virtual ~QObjectPrivate ()
void deleteChildren ()
void clearBindingStorage ()
void setParent_helper (QObject *)
void moveToThread_helper ()
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
QObjectList receiverList (const char *signal) const
void ensureConnectionData ()
void addConnection (int signal, Connection *c)
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
bool maybeSignalConnected (uint signalIndex) const
bool isDeclarativeSignalConnected (uint signalIdx) const
void connectNotify (const QMetaMethod &signal)
void disconnectNotify (const QMetaMethod &signal)
void reinitBindingStorageAfterThreadMove ()
virtual std::string flagsForDumping () const
virtual void writeToDebugStream (QDebug &) const
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
Public Member Functions inherited from QObjectData
 QObjectData ()=default
virtual ~QObjectData ()=0
const QMetaObjectdynamicMetaObject () const
Public Member Functions inherited from QSafeQuickItemChangeListener< QQuickActionPrivate >
 ~QSafeQuickItemChangeListener () override
bool baseDeleted (const QObject *caller) const override
QString debugName () const override
Public Member Functions inherited from QQuickItemChangeListener
virtual ~QQuickItemChangeListener ()
virtual void itemGeometryChanged (QQuickItem *, QQuickGeometryChange, const QRectF &)
virtual void itemSiblingOrderChanged (QQuickItem *)
virtual void itemEnabledChanged (QQuickItem *)
virtual void itemOpacityChanged (QQuickItem *)
virtual void itemChildAdded (QQuickItem *, QQuickItem *)
virtual void itemChildRemoved (QQuickItem *, QQuickItem *)
virtual void itemParentChanged (QQuickItem *, QQuickItem *)
virtual void itemRotationChanged (QQuickItem *)
virtual void itemImplicitWidthChanged (QQuickItem *)
virtual void itemImplicitHeightChanged (QQuickItem *)
virtual void itemFocusChanged (QQuickItem *, Qt::FocusReason)
virtual void itemScaleChanged (QQuickItem *)
virtual void itemTransformChanged (QQuickItem *, QQuickItem *)
virtual QQuickAnchorsPrivateanchorPrivate ()
virtual void addSourceItem (QQuickItem *)
virtual void removeSourceItem (QQuickItem *)

Static Public Member Functions

static QQuickActionPrivateget (QQuickAction *action)
Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
static QObjectPrivateget (QObject *o)
static const QObjectPrivateget (const QObject *o)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
static QMetaObject::Connection connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
static bool disconnect (const QObject *sender, int signal_index, void **slot)
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot)

Public Attributes

bool explicitEnabled = false
bool enabled = true
bool checked = false
bool checkable = false
QString text
QQuickIcon icon
QQuickActionGroupgroup = nullptr
Public Attributes inherited from QObjectPrivate
ExtraDataextraData
QAtomicPointer< QThreadDatathreadData
QAtomicPointer< ConnectionDataconnections
union { 
   QObject *   currentChildBeingDeleted 
   QAbstractDeclarativeData *   declarativeData 
}; 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
Public Attributes inherited from QObjectData
QObjectq_ptr
QObjectparent
QObjectList children
uint isWidget: 1
uint blockSig: 1
uint wasDeleted: 1
uint isDeletingChildren: 1
uint sendChildEvents: 1
uint receiveChildEvents: 1
uint isWindow: 1
uint deleteLaterCalled: 1
uint isQuickItem: 1
uint willBeWidget: 1
uint wasWidget: 1
uint receiveParentEvents: 1
uint unused: 20
QAtomicInt postedEvents
QDynamicMetaObjectDatametaObject
QBindingStorage bindingStorage

Additional Inherited Members

Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>
Public Types inherited from QSafeQuickItemChangeListener< QQuickActionPrivate >
using InDestructorTest
using WasDeletedTest

Detailed Description

Definition at line 32 of file qquickaction_p_p.h.

Member Function Documentation

◆ get()

QQuickActionPrivate * QQuickActionPrivate::get ( QQuickAction * action)
inlinestatic

Definition at line 38 of file qquickaction_p_p.h.

◆ handleShortcutEvent()

bool QQuickActionPrivate::handleShortcutEvent ( QObject * object,
QShortcutEvent * event )

◆ itemDestroyed()

void QQuickActionPrivate::itemDestroyed ( QQuickItem * item)
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 261 of file qquickaction.cpp.

◆ itemVisibilityChanged()

void QQuickActionPrivate::itemVisibilityChanged ( QQuickItem * item)
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 243 of file qquickaction.cpp.

◆ registerItem()

void QQuickActionPrivate::registerItem ( QQuickItem * item)

Definition at line 212 of file qquickaction.cpp.

◆ setEnabled()

QT_BEGIN_NAMESPACE void QQuickActionPrivate::setEnabled ( bool enable)

Abstract user interface action.

\qmltype Action
\inherits QtObject

! \nativetype QQuickAction \inqmlmodule QtQuick.Controls

Since
5.10

Action represents an abstract user interface action that can have shortcuts and can be assigned to menu items and toolbar buttons.

Actions may contain \l text, an \l icon, and a \l shortcut. Actions are normally \l triggered by the user via menu items, toolbar buttons, or keyboard shortcuts. A \l checkable Action toggles its \l checked state when triggered.

Action {
id: copyAction
text: qsTr("&Copy")
icon.name: "edit-copy"
shortcut: StandardKey.Copy
onTriggered: window.activeFocusItem.copy()
}

Action is commonly used to implement application commands that can be invoked via menu items, toolbar buttons, and keyboard shortcuts. Since the user expects the commands to be performed in the same way, regardless of the user interface used, it is useful to represent the commands as shareable actions.

Action can be also used to separate the logic and the visual presentation. For example, when declaring buttons and menu items in .ui.qml files, actions can be declared elsewhere and assigned from the outside.

ToolButton {
id: toolButton
action: copyAction
}

When an action is paired with buttons and menu items, the enabled, checkable, and checked states are synced automatically. For example, in a word processor, if the user clicks a "Bold" toolbar button, the "Bold" menu item will automatically be checked. Buttons and menu items get their text and icon from the action by default. An action-specific text or icon can be overridden for a specific control by specifying text or icon directly on the control.

MenuItem {
id: menuItem
action: copyAction
text: qsTr("&Copy selected Text")
}

Since Action presents a user interface action, it is intended to be assigned to a \l MenuItem, \l ToolButton, or any other control that inherits \l AbstractButton. For keyboard shortcuts, the simpler \l Shortcut type is more appropriate.

See also
MenuItem, ToolButton, Shortcut

\qmlsignal QtQuick.Controls::Action::toggled(QtObject source)

This signal is emitted when the action is toggled. The source argument identifies the object that toggled the action.

For example, if the action is assigned to a menu item and a toolbar button, the action is toggled when the control is toggled, the shortcut is activated, or when \l toggle() is called directly.

\qmlsignal QtQuick.Controls::Action::triggered(QtObject source)

This signal is emitted when the action is triggered. The source argument identifies the object that triggered the action.

For example, if the action is assigned to a menu item and a toolbar button, the action is triggered when the control is clicked, the shortcut is activated, or when \l trigger() is called directly.

Definition at line 173 of file qquickaction.cpp.

◆ trigger()

void QQuickActionPrivate::trigger ( QObject * source,
bool doToggle )

Definition at line 516 of file qquickaction.cpp.

References enabled.

◆ unregisterItem()

void QQuickActionPrivate::unregisterItem ( QQuickItem * item)

Definition at line 227 of file qquickaction.cpp.

◆ unwatchItem()

bool QQuickActionPrivate::unwatchItem ( QQuickItem * item)

Definition at line 201 of file qquickaction.cpp.

◆ watchItem()

bool QQuickActionPrivate::watchItem ( QQuickItem * item)

Definition at line 190 of file qquickaction.cpp.

Member Data Documentation

◆ checkable

bool QQuickActionPrivate::checkable = false

Definition at line 90 of file qquickaction_p_p.h.

◆ checked

bool QQuickActionPrivate::checked = false

Definition at line 89 of file qquickaction_p_p.h.

◆ enabled

bool QQuickActionPrivate::enabled = true

Definition at line 88 of file qquickaction_p_p.h.

Referenced by trigger().

◆ explicitEnabled

bool QQuickActionPrivate::explicitEnabled = false

Definition at line 87 of file qquickaction_p_p.h.

◆ group

QQuickActionGroup* QQuickActionPrivate::group = nullptr

Definition at line 99 of file qquickaction_p_p.h.

◆ icon

QQuickIcon QQuickActionPrivate::icon

Definition at line 92 of file qquickaction_p_p.h.

◆ text

QString QQuickActionPrivate::text

Definition at line 91 of file qquickaction_p_p.h.


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