Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickMenuPrivate Class Reference

#include <qquickmenu_p_p.h>

+ Inheritance diagram for QQuickMenuPrivate:
+ Collaboration diagram for QQuickMenuPrivate:

Public Types

enum class  DestructionPolicy { Destroy , DoNotDestroy }
 
- Public Types inherited from QQuickPopupPrivate
enum  TransitionState { NoTransition , EnterTransition , ExitTransition }
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>
 

Public Member Functions

 QQuickMenuPrivate ()
 
void init ()
 
QPlatformMenunativeHandle ()
 
QPlatformMenumaybeNativeHandle () const
 
QQuickMenurootMenu () const
 
bool useNativeMenu () const
 
bool createNativeMenu ()
 
void removeNativeMenu ()
 
void syncWithNativeMenu ()
 
void syncWithUseNativeMenu ()
 
void setNativeMenuVisible (bool visible)
 
QQuickItemitemAt (int index) const
 
void insertItem (int index, QQuickItem *item)
 
void maybeCreateAndInsertNativeItem (int index, QQuickItem *item)
 
void moveItem (int from, int to)
 
void removeItem (int index, QQuickItem *item, DestructionPolicy destructionPolicy=DestructionPolicy::DoNotDestroy)
 
void removeNativeItem (int index)
 
void resetNativeData ()
 
void printContentModelItems () const
 
QQuickItembeginCreateItem ()
 
void completeCreateItem ()
 
QQuickItemcreateItem (QQuickMenu *menu)
 
QQuickItemcreateItem (QQuickAction *action)
 
void resizeItem (QQuickItem *item)
 
void resizeItems ()
 
void itemChildAdded (QQuickItem *item, QQuickItem *child) override
 
void itemSiblingOrderChanged (QQuickItem *item) override
 
void itemParentChanged (QQuickItem *item, QQuickItem *parent) override
 
void itemDestroyed (QQuickItem *item) override
 
void itemGeometryChanged (QQuickItem *, QQuickGeometryChange change, const QRectF &diff) override
 
QQuickPopupPositionergetPositioner () override
 
bool prepareEnterTransition () override
 
bool prepareExitTransition () override
 
bool blockInput (QQuickItem *item, const QPointF &point) const override
 
bool handleReleaseWithoutGrab (const QEventPoint &eventPoint) override
 
void onItemHovered ()
 
void onItemTriggered ()
 
void onItemActiveFocusChanged ()
 
void updateTextPadding ()
 
QQuickMenucurrentSubMenu () const
 
void setParentMenu (QQuickMenu *parent)
 
void resolveParentItem ()
 
void propagateKeyEvent (QKeyEvent *event)
 
void startHoverTimer ()
 
void stopHoverTimer ()
 
void setCurrentIndex (int index, Qt::FocusReason reason)
 
bool activateNextItem ()
 
bool activatePreviousItem ()
 
QQuickMenuItemfirstEnabledMenuItem () const
 
QPalette defaultPalette () const override
 
- Public Member Functions inherited from QQuickPopupPrivate
 QQuickPopupPrivate ()
 
QQmlListProperty< QObjectcontentData ()
 \qmlproperty list<QtObject> QtQuick.Controls::Popup::contentData \qmldefault
 
QQmlListProperty< QQuickItemcontentChildren ()
 \qmlproperty list<Item> QtQuick.Controls::Popup::contentChildren
 
void init ()
 
void closeOrReject ()
 
bool tryClose (const QPointF &pos, QQuickPopup::ClosePolicy flags)
 
bool contains (const QPointF &scenePos) const
 
virtual bool handlePress (QQuickItem *item, const QPointF &point, ulong timestamp)
 
virtual bool handleMove (QQuickItem *item, const QPointF &point, ulong timestamp)
 
virtual bool handleRelease (QQuickItem *item, const QPointF &point, ulong timestamp)
 
virtual void handleUngrab ()
 
bool handleMouseEvent (QQuickItem *item, QMouseEvent *event)
 
bool handleHoverEvent (QQuickItem *item, QHoverEvent *event)
 
QPointF dropShadowOffset () const
 
void setEffectivePosFromWindowPos (const QPointF &windowPos)
 
void reposition ()
 
bool usePopupWindow () const
 
void adjustPopupItemParentAndWindow ()
 
void createOverlay ()
 
void destroyDimmer ()
 
void toggleOverlay ()
 
void updateContentPalettes (const QPalette &parentPalette)
 
virtual void showDimmer ()
 
virtual void hideDimmer ()
 
virtual void resizeDimmer ()
 
virtual void finalizeEnterTransition ()
 
virtual void finalizeExitTransition ()
 
virtual void opened ()
 
virtual Qt::WindowFlags popupWindowType () const
 
QMarginsF getMargins () const
 
void setTopMargin (qreal value, bool reset=false)
 
void setLeftMargin (qreal value, bool reset=false)
 
void setRightMargin (qreal value, bool reset=false)
 
void setBottomMargin (qreal value, bool reset=false)
 
QQuickPopupAnchorsgetAnchors ()
 
void setWindow (QQuickWindow *window)
 
void itemDestroyed (QQuickItem *item) override
 
QPalette defaultPalette () const override
 
- Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
virtual ~QObjectPrivate ()
 
void deleteChildren ()
 
void clearBindingStorage ()
 
void checkForIncompatibleLibraryVersion (int version) const
 
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
 
QMetaObjectdynamicMetaObject () const
 
- Public Member Functions inherited from QQuickItemChangeListener
virtual ~QQuickItemChangeListener ()
 
virtual void itemVisibilityChanged (QQuickItem *)
 
virtual void itemEnabledChanged (QQuickItem *)
 
virtual void itemOpacityChanged (QQuickItem *)
 
virtual void itemChildRemoved (QQuickItem *, QQuickItem *)
 
virtual void itemRotationChanged (QQuickItem *)
 
virtual void itemImplicitWidthChanged (QQuickItem *)
 
virtual void itemImplicitHeightChanged (QQuickItem *)
 
virtual void itemFocusChanged (QQuickItem *, Qt::FocusReason)
 
virtual QQuickAnchorsPrivateanchorPrivate ()
 
- Public Member Functions inherited from QQuickPaletteProviderPrivateBase< QQuickPopup, QQuickPopupPrivate >
virtual ~QQuickPaletteProviderPrivateBase ()=default
 
virtual QQuickPalettepalette () const
 
virtual void setPalette (QQuickPalette *p)
 
virtual void resetPalette ()
 
virtual bool providesPalette () const
 
QPalette parentPalette (const QPalette &fallbackPalette) const override
 
void inheritPalette (const QPalette &parentPalette)
 
virtual void updateChildrenPalettes (const QPalette &parentPalette)
 
- Public Member Functions inherited from QQuickAbstractPaletteProvider
virtual ~QQuickAbstractPaletteProvider ()=default
 

Static Public Member Functions

static QQuickMenuPrivateget (QQuickMenu *menu)
 
static void recursivelyDestroyNativeSubMenus (QQuickMenu *menu)
 
static void recursivelyCreateNativeMenuItems (QQuickMenu *menu)
 
static void contentData_append (QQmlListProperty< QObject > *prop, QObject *obj)
 
static qsizetype contentData_count (QQmlListProperty< QObject > *prop)
 
static QObjectcontentData_at (QQmlListProperty< QObject > *prop, qsizetype index)
 
static void contentData_clear (QQmlListProperty< QObject > *prop)
 
- Static Public Member Functions inherited from QQuickPopupPrivate
static QQuickPopupPrivateget (QQuickPopup *popup)
 
- 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 cascade = false
 
bool triedToCreateNativeMenu = false
 
int hoverTimer = 0
 
int currentIndex = -1
 
qreal overlap = 0
 
qreal textPadding = 0
 
QPointer< QQuickMenuparentMenu
 
QPointer< QQuickMenuItemcurrentItem
 
QQuickItemcontentItem = nullptr
 
QList< QObject * > contentData
 
QQmlObjectModelcontentModel
 
QQmlComponentdelegate = nullptr
 
QString title
 
QQuickIcon icon
 
std::unique_ptr< QPlatformMenuhandle = nullptr
 
QList< QQuickNativeMenuItem * > nativeItems
 
QPointer< QQuickMenuBarmenuBar
 
qreal lastDevicePixelRatio = 0
 
- Public Attributes inherited from QQuickPopupPrivate
bool focus = false
 
bool modal = false
 
bool dim = false
 
bool hasDim = false
 
bool visible = false
 
bool complete = true
 
bool positioning = false
 
bool hasWidth = false
 
bool hasHeight = false
 
bool hasTopMargin = false
 
bool hasLeftMargin = false
 
bool hasRightMargin = false
 
bool hasBottomMargin = false
 
bool hasZ = false
 
bool allowVerticalFlip = false
 
bool allowHorizontalFlip = false
 
bool allowVerticalMove = true
 
bool allowHorizontalMove = true
 
bool allowVerticalResize = true
 
bool allowHorizontalResize = true
 
bool hadActiveFocusBeforeExitTransition = false
 
bool interactive = true
 
bool hasClosePolicy = false
 
bool outsidePressed = false
 
bool outsideParentPressed = false
 
bool inDestructor = false
 
bool relaxEdgeConstraint = false
 
bool popupWindowDirty = false
 
int touchId = -1
 
qreal x = 0
 
qreal y = 0
 
QPointF effectivePos
 
qreal margins = -1
 
qreal topMargin = 0
 
qreal leftMargin = 0
 
qreal rightMargin = 0
 
qreal bottomMargin = 0
 
QPointF pressPoint
 
TransitionState transitionState = NoTransition
 
QQuickPopup::ClosePolicy closePolicy = DefaultClosePolicy
 
QQuickItemparentItem = nullptr
 
QQuickItemdimmer = nullptr
 
QPointer< QQuickWindowwindow
 
QQuickTransitionenter = nullptr
 
QQuickTransitionexit = nullptr
 
QQuickPopupItempopupItem = nullptr
 
QQuickPopupWindowpopupWindow = nullptr
 
QQuickPopupPositionerpositioner = nullptr
 
QList< QQuickStateActionenterActions
 
QList< QQuickStateActionexitActions
 
QQuickPopupTransitionManager transitionManager
 
QQuickPopupAnchorsanchors = nullptr
 
qreal explicitDimmerOpacity = 0
 
qreal prevOpacity = 0
 
qreal prevScale = 0
 
QString m_title
 
QQuickPopup::PopupType m_popupType = QQuickPopup::Default
 
- 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

- Static Public Attributes inherited from QQuickPopupPrivate
static const QQuickPopup::ClosePolicy DefaultClosePolicy = QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutside
 
- Protected Member Functions inherited from QQuickPaletteProviderPrivateBase< QQuickPopup, QQuickPopupPrivate >
void setCurrentColorGroup ()
 

Detailed Description

Definition at line 35 of file qquickmenu_p_p.h.

Member Enumeration Documentation

◆ DestructionPolicy

Enumerator
Destroy 
DoNotDestroy 

Definition at line 64 of file qquickmenu_p_p.h.

Constructor & Destructor Documentation

◆ QQuickMenuPrivate()

QQuickMenuPrivate::QQuickMenuPrivate ( )

Definition at line 279 of file qquickmenu.cpp.

References cascade, and shouldCascade().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateNextItem()

bool QQuickMenuPrivate::activateNextItem ( )

Definition at line 1164 of file qquickmenu.cpp.

References contentModel, QQmlObjectModel::count(), currentIndex, QGraphicsItem::isEnabled(), item, itemAt(), setCurrentIndex(), and Qt::TabFocusReason.

+ Here is the call graph for this function:

◆ activatePreviousItem()

bool QQuickMenuPrivate::activatePreviousItem ( )

Definition at line 1178 of file qquickmenu.cpp.

References Qt::BacktabFocusReason, currentIndex, QGraphicsItem::isEnabled(), item, itemAt(), and setCurrentIndex().

+ Here is the call graph for this function:

◆ beginCreateItem()

QQuickItem * QQuickMenuPrivate::beginCreateItem ( )

Definition at line 744 of file qquickmenu.cpp.

References QQmlComponent::beginCreate(), context, QQmlComponent::creationContext(), delegate, item, qmlContext(), qobject_cast< QQuickItem * >(), and QQml_setParent_noEvent().

Referenced by createItem(), and createItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockInput()

bool QQuickMenuPrivate::blockInput ( QQuickItem * item,
const QPointF & point ) const
overridevirtual

Reimplemented from QQuickPopupPrivate.

Definition at line 940 of file qquickmenu.cpp.

References QQuickPopupPrivate::blockInput(), cascade, QQuickPopupPrivate::contains(), item, and parentMenu.

+ Here is the call graph for this function:

◆ completeCreateItem()

void QQuickMenuPrivate::completeCreateItem ( )

Definition at line 764 of file qquickmenu.cpp.

References QQmlComponent::completeCreate(), and delegate.

Referenced by createItem(), and createItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contentData_append()

void QQuickMenuPrivate::contentData_append ( QQmlListProperty< QObject > * prop,
QObject * obj )
static

Definition at line 1207 of file qquickmenu.cpp.

References QQuickItemPrivate::get(), get(), item, menu, qobject_cast< QQuickItem * >(), QGraphicsItem::setParentItem(), and QQuickItemPrivate::SiblingOrder.

+ Here is the call graph for this function:

◆ contentData_at()

QObject * QQuickMenuPrivate::contentData_at ( QQmlListProperty< QObject > * prop,
qsizetype index )
static

Definition at line 1238 of file qquickmenu.cpp.

References get().

+ Here is the call graph for this function:

◆ contentData_clear()

void QQuickMenuPrivate::contentData_clear ( QQmlListProperty< QObject > * prop)
static

Definition at line 1249 of file qquickmenu.cpp.

References get().

+ Here is the call graph for this function:

◆ contentData_count()

qsizetype QQuickMenuPrivate::contentData_count ( QQmlListProperty< QObject > * prop)
static

Definition at line 1232 of file qquickmenu.cpp.

References get().

+ Here is the call graph for this function:

◆ createItem() [1/2]

QQuickItem * QQuickMenuPrivate::createItem ( QQuickAction * action)

Definition at line 781 of file qquickmenu.cpp.

References beginCreateItem(), button, completeCreateItem(), and item.

+ Here is the call graph for this function:

◆ createItem() [2/2]

QQuickItem * QQuickMenuPrivate::createItem ( QQuickMenu * menu)

Definition at line 772 of file qquickmenu.cpp.

References beginCreateItem(), completeCreateItem(), QQuickMenuItemPrivate::get(), item, and menu.

+ Here is the call graph for this function:

◆ createNativeMenu()

bool QQuickMenuPrivate::createNativeMenu ( )

Definition at line 328 of file qquickmenu.cpp.

References QPlatformMenu::aboutToHide(), QPlatformMenu::aboutToShow(), get(), QQuickMenuBarPrivate::get(), menuBar, parentMenu, QGuiApplicationPrivate::platformTheme(), Q_ASSERT, qCDebug, recursivelyCreateNativeMenuItems(), rootMenu(), syncWithNativeMenu(), and triedToCreateNativeMenu.

Referenced by nativeHandle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ currentSubMenu()

QQuickMenu * QQuickMenuPrivate::currentSubMenu ( ) const

Definition at line 1054 of file qquickmenu.cpp.

References currentItem, and QQuickMenuItem::subMenu.

Referenced by prepareExitTransition().

+ Here is the caller graph for this function:

◆ defaultPalette()

QPalette QQuickMenuPrivate::defaultPalette ( ) const
overridevirtual

Implements QQuickAbstractPaletteProvider.

Definition at line 1244 of file qquickmenu.cpp.

References QQuickTheme::Menu, and QQuickTheme::palette().

+ Here is the call graph for this function:

◆ firstEnabledMenuItem()

QQuickMenuItem * QQuickMenuPrivate::firstEnabledMenuItem ( ) const

Definition at line 1191 of file qquickmenu.cpp.

References contentModel, QQmlObjectModel::count(), i, QGraphicsItem::isEnabled(), item, and itemAt().

+ Here is the call graph for this function:

◆ get()

◆ getPositioner()

QQuickPopupPositioner * QQuickMenuPrivate::getPositioner ( )
overridevirtual

Reimplemented from QQuickPopupPrivate.

Definition at line 865 of file qquickmenu.cpp.

References QQuickPopupPrivate::positioner.

◆ handleReleaseWithoutGrab()

bool QQuickMenuPrivate::handleReleaseWithoutGrab ( const QEventPoint & eventPoint)
overridevirtual

QQuickPopupWindow::event() calls this to handle the release event of a menu drag-press-release gesture, because the eventPoint does not have a grabber within the popup window. This override finds and activates the appropriate menu item, as if it had been pressed and released. Returns true on success, to indicate that handling eventPoint is done.

Reimplemented from QQuickPopupPrivate.

Definition at line 953 of file qquickmenu.cpp.

References QQuickPopupPrivate::contains(), contentItem, currentIndex, itemAt(), list, QEventPoint::position, Q_LIKELY, QEventPoint::scenePosition, QPointF::x(), and QPointF::y().

+ Here is the call graph for this function:

◆ init()

void QQuickMenuPrivate::init ( )

Definition at line 284 of file qquickmenu.cpp.

References contentModel.

◆ insertItem()

void QQuickMenuPrivate::insertItem ( int index,
QQuickItem * item )

◆ itemAt()

QQuickItem * QQuickMenuPrivate::itemAt ( int index) const

Definition at line 551 of file qquickmenu.cpp.

References contentModel, and qobject_cast< QQuickItem * >().

Referenced by activateNextItem(), activatePreviousItem(), firstEnabledMenuItem(), handleReleaseWithoutGrab(), printContentModelItems(), resizeItems(), setCurrentIndex(), and updateTextPadding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ itemChildAdded()

void QQuickMenuPrivate::itemChildAdded ( QQuickItem * item,
QQuickItem * child )
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 811 of file qquickmenu.cpp.

References child, QListSpecialMethodsBase< T >::contains(), contentData, contentModel, QQmlObjectModel::count(), QQuickItemPrivate::get(), and insertItem().

+ Here is the call graph for this function:

◆ itemDestroyed()

void QQuickMenuPrivate::itemDestroyed ( QQuickItem * item)
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 841 of file qquickmenu.cpp.

References contentModel, QQmlObjectModel::indexOf(), item, QQuickPopupPrivate::itemDestroyed(), and removeItem().

+ Here is the call graph for this function:

◆ itemGeometryChanged()

void QQuickMenuPrivate::itemGeometryChanged ( QQuickItem * item,
QQuickGeometryChange change,
const QRectF & diff )
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 849 of file qquickmenu.cpp.

References QQuickPopupPrivate::complete, contentItem, item, resizeItem(), and resizeItems().

+ Here is the call graph for this function:

◆ itemParentChanged()

void QQuickMenuPrivate::itemParentChanged ( QQuickItem * item,
QQuickItem * parent )
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 818 of file qquickmenu.cpp.

References contentModel, QQmlObjectModel::indexOf(), item, QObjectData::parent, and removeItem().

+ Here is the call graph for this function:

◆ itemSiblingOrderChanged()

void QQuickMenuPrivate::itemSiblingOrderChanged ( QQuickItem * item)
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 825 of file qquickmenu.cpp.

References QQuickItem::childItems(), contentItem, contentModel, QQuickItemPrivate::get(), i, and QQmlObjectModel::indexOf().

+ Here is the call graph for this function:

◆ maybeCreateAndInsertNativeItem()

void QQuickMenuPrivate::maybeCreateAndInsertNativeItem ( int index,
QQuickItem * item )

Definition at line 591 of file qquickmenu.cpp.

References arg, QQuickPopupPrivate::complete, QQuickNativeMenuItem::createFromNonNativeItem(), QQuickNativeMenuItem::debugText(), QString::fromLatin1(), get(), QQuickNativeMenuItem::handle(), QList< T >::insert(), item, nativeItems, nativeMenuItemListToString(), Q_ASSERT, Q_ASSERT_X, Q_FUNC_INFO, qCDebug, qmlWarning(), qPrintable, QStringLiteral, recursivelyCreateNativeMenuItems(), and QList< T >::value().

Referenced by insertItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maybeNativeHandle()

QPlatformMenu * QQuickMenuPrivate::maybeNativeHandle ( ) const

Definition at line 323 of file qquickmenu.cpp.

Referenced by insertItem(), moveItem(), removeItem(), QQuickMenuBarPrivate::removeNativeMenu(), QQuickMenuBarPrivate::syncMenuBarItemVisibilty(), and syncWithUseNativeMenu().

+ Here is the caller graph for this function:

◆ moveItem()

void QQuickMenuPrivate::moveItem ( int from,
int to )

Definition at line 631 of file qquickmenu.cpp.

References contentModel, maybeNativeHandle(), QList< T >::move(), and nativeItems.

+ Here is the call graph for this function:

◆ nativeHandle()

QPlatformMenu * QQuickMenuPrivate::nativeHandle ( )

Definition at line 315 of file qquickmenu.cpp.

References createNativeMenu(), Q_ASSERT, triedToCreateNativeMenu, and useNativeMenu().

Referenced by QQuickMenuBarPrivate::insertNativeMenu(), QQuickMenuBarPrivate::removeNativeMenu(), and syncWithUseNativeMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onItemActiveFocusChanged()

void QQuickMenuPrivate::onItemActiveFocusChanged ( )

Definition at line 1018 of file qquickmenu.cpp.

References contentModel, QQuickControl::focusReason, QQmlObjectModel::indexOf(), item, Qt::OtherFocusReason, qobject_cast< QQuickItem * >(), and setCurrentIndex().

Referenced by insertItem(), and removeItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onItemHovered()

void QQuickMenuPrivate::onItemHovered ( )

Definition at line 976 of file qquickmenu.cpp.

References button, QQuickMenu::cascade, QQuickPopup::close(), contentModel, currentItem, QQuickAbstractButtonPrivate::get(), QQmlObjectModel::indexOf(), QWidget::isEnabled(), QQuickMenuItem::menu, Qt::OtherFocusReason, setCurrentIndex(), and startHoverTimer().

Referenced by insertItem(), and removeItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onItemTriggered()

void QQuickMenuPrivate::onItemTriggered ( )

Definition at line 1003 of file qquickmenu.cpp.

References get(), and item.

Referenced by insertItem(), and removeItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareEnterTransition()

bool QQuickMenuPrivate::prepareEnterTransition ( )
overridevirtual

Reimplemented from QQuickPopupPrivate.

Definition at line 902 of file qquickmenu.cpp.

References QQuickPopupPrivate::allowHorizontalFlip, cascade, cascadingSubMenuClosePolicy, QQuickPopup::close(), QQuickPopupPrivate::closePolicy, QQuickPopupPrivate::hasClosePolicy, parentMenu, and QQuickPopupPrivate::prepareEnterTransition().

+ Here is the call graph for this function:

◆ prepareExitTransition()

bool QQuickMenuPrivate::prepareExitTransition ( )
overridevirtual

Reimplemented from QQuickPopupPrivate.

Definition at line 924 of file qquickmenu.cpp.

References QQuickPopup::close(), currentSubMenu(), get(), QQuickPopupPrivate::prepareExitTransition(), and stopHoverTimer().

+ Here is the call graph for this function:

◆ printContentModelItems()

void QQuickMenuPrivate::printContentModelItems ( ) const

Definition at line 737 of file qquickmenu.cpp.

References contentModel, QQmlObjectModel::count(), i, itemAt(), and qCDebug.

Referenced by insertItem(), and removeItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propagateKeyEvent()

void QQuickMenuPrivate::propagateKeyEvent ( QKeyEvent * event)

Definition at line 1104 of file qquickmenu.cpp.

References get(), menu, menuBar, QQuickPopupPrivate::parentItem, and QCoreApplication::sendEvent().

+ Here is the call graph for this function:

◆ recursivelyCreateNativeMenuItems()

void QQuickMenuPrivate::recursivelyCreateNativeMenuItems ( QQuickMenu * menu)
static

Definition at line 714 of file qquickmenu.cpp.

References get(), i, item, menu, Q_ASSERT, qCDebug, and recursivelyCreateNativeMenuItems().

Referenced by createNativeMenu(), maybeCreateAndInsertNativeItem(), and recursivelyCreateNativeMenuItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recursivelyDestroyNativeSubMenus()

void QQuickMenuPrivate::recursivelyDestroyNativeSubMenus ( QQuickMenu * menu)
static

Recursively destroys native sub-menus of menu.

This function checks if each native item in menu has a sub-menu, and if so: \list

  • Calls itself with that sub-menu
  • Resets the item's data (important to avoid accessing a deleted QQuickAction when printing in QQuickNativeMenuItem's destructor)
  • Deletes (eventually) the native item \endlist

Similar (besides the recursion) to removeNativeItem(), except that we can avoid repeated calls to syncWithNativeMenu().

Definition at line 491 of file qquickmenu.cpp.

References get(), item, menu, Q_ASSERT, qCDebug, and recursivelyDestroyNativeSubMenus().

Referenced by recursivelyDestroyNativeSubMenus(), and removeNativeItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeItem()

void QQuickMenuPrivate::removeItem ( int index,
QQuickItem * item,
DestructionPolicy destructionPolicy = DestructionPolicy::DoNotDestroy )

Removes the specified item, potentially destroying it depending on destructionPolicy.

Note
the native menu item is destroyed regardless of the destruction policy, because it's an implementation detail and hence is not created by or available to the user.

Definition at line 649 of file qquickmenu.cpp.

References QQuickItem::activeFocusChanged(), contentData, contentModel, Destroy, QQuickItemPrivate::Destroyed, QObjectPrivate::disconnect(), QQuickItemPrivate::Geometry, QQuickItemPrivate::get(), get(), QQuickMenuItemPrivate::get(), QQuickControl::hoveredChanged(), item, maybeNativeHandle(), onItemActiveFocusChanged(), onItemHovered(), onItemTriggered(), QQuickItemPrivate::Parent, printContentModelItems(), qCDebug, removeNativeItem(), QList< T >::removeOne(), QGraphicsItem::setParentItem(), QQuickMenuItem::subMenu, QQuickMenuItem::triggered(), updateTextPadding(), and QQuickItem::visibleChanged().

Referenced by itemDestroyed(), and itemParentChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeNativeItem()

void QQuickMenuPrivate::removeNativeItem ( int index)

Definition at line 682 of file qquickmenu.cpp.

References arg, QString::fromLatin1(), nativeItems, nativeMenuItemListToString(), Q_ASSERT, Q_ASSERT_X, Q_FUNC_INFO, qCDebug, qPrintable, recursivelyDestroyNativeSubMenus(), QList< T >::size(), syncWithNativeMenu(), and QList< T >::takeAt().

Referenced by removeItem(), and removeNativeMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeNativeMenu()

void QQuickMenuPrivate::removeNativeMenu ( )

Definition at line 439 of file qquickmenu.cpp.

References i, QList< T >::isEmpty(), nativeItems, Q_ASSERT, removeNativeItem(), resetNativeData(), and QList< T >::size().

Referenced by QQuickMenuBarPrivate::removeNativeMenu(), and syncWithUseNativeMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetNativeData()

void QQuickMenuPrivate::resetNativeData ( )

Definition at line 707 of file qquickmenu.cpp.

References qCDebug, and triedToCreateNativeMenu.

Referenced by removeNativeMenu().

+ Here is the caller graph for this function:

◆ resizeItem()

void QQuickMenuPrivate::resizeItem ( QQuickItem * item)

Definition at line 790 of file qquickmenu.cpp.

References contentItem, QQuickItemPrivate::get(), item, and QQuickItem::width.

Referenced by insertItem(), itemGeometryChanged(), and resizeItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeItems()

void QQuickMenuPrivate::resizeItems ( )

Definition at line 802 of file qquickmenu.cpp.

References contentModel, QQmlObjectModel::count(), i, itemAt(), and resizeItem().

Referenced by itemGeometryChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveParentItem()

void QQuickMenuPrivate::resolveParentItem ( )

Definition at line 1093 of file qquickmenu.cpp.

References cascade, findParentMenuItem(), and parentMenu.

Referenced by setParentMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootMenu()

QQuickMenu * QQuickMenuPrivate::rootMenu ( ) const

Definition at line 290 of file qquickmenu.cpp.

References menu, QObject::parent(), and rootMenu().

Referenced by createNativeMenu(), rootMenu(), and useNativeMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentIndex()

void QQuickMenuPrivate::setCurrentIndex ( int index,
Qt::FocusReason reason )

Definition at line 1136 of file qquickmenu.cpp.

References contentItem, currentIndex, currentItem, emit, QQuickItemPrivate::get(), QQuickWindowPrivate::get(), itemAt(), Qt::OtherFocusReason, QQuickMenuItem::setHighlighted(), stopHoverTimer(), and QQuickPopupPrivate::window.

Referenced by activateNextItem(), activatePreviousItem(), onItemActiveFocusChanged(), and onItemHovered().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNativeMenuVisible()

void QQuickMenuPrivate::setNativeMenuVisible ( bool visible)

Definition at line 523 of file qquickmenu.cpp.

References effectiveWindow(), emit, lastDevicePixelRatio, QQuickPopupPrivate::parentItem, qCDebug, qGuiApp, syncWithNativeMenu(), QHighDpi::toNativePixels(), QPointF::toPoint(), QQuickPopupPrivate::visible, and QQuickPopupPrivate::window.

+ Here is the call graph for this function:

◆ setParentMenu()

void QQuickMenuPrivate::setParentMenu ( QQuickMenu * parent)

Definition at line 1062 of file qquickmenu.cpp.

References QObject::connect(), QObjectPrivate::connect(), QPointer< T >::data(), disconnect(), QObject::disconnect(), QObjectData::parent, QQuickPopup::parentChanged(), parentMenu, resolveParentItem(), and QQuickMenu::setCascade().

+ Here is the call graph for this function:

◆ startHoverTimer()

void QQuickMenuPrivate::startHoverTimer ( )

Definition at line 1119 of file qquickmenu.cpp.

References hoverTimer, stopHoverTimer(), and SUBMENU_DELAY.

Referenced by onItemHovered().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stopHoverTimer()

void QQuickMenuPrivate::stopHoverTimer ( )

Definition at line 1126 of file qquickmenu.cpp.

References hoverTimer.

Referenced by prepareExitTransition(), setCurrentIndex(), and startHoverTimer().

+ Here is the caller graph for this function:

◆ syncWithNativeMenu()

void QQuickMenuPrivate::syncWithNativeMenu ( )

Definition at line 396 of file qquickmenu.cpp.

References QQuickPopupPrivate::complete, item, nativeItems, qCDebug, QList< T >::size(), title, and QQuickPopupPrivate::visible.

Referenced by createNativeMenu(), removeNativeItem(), and setNativeMenuVisible().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncWithUseNativeMenu()

void QQuickMenuPrivate::syncWithUseNativeMenu ( )

Definition at line 455 of file qquickmenu.cpp.

References QList< T >::isEmpty(), maybeNativeHandle(), nativeHandle(), nativeItems, parentMenu, Q_ASSERT, removeNativeMenu(), and useNativeMenu().

+ Here is the call graph for this function:

◆ updateTextPadding()

void QQuickMenuPrivate::updateTextPadding ( )

Definition at line 1030 of file qquickmenu.cpp.

References QQuickPopupPrivate::complete, emit, i, itemAt(), qMax(), and textPadding.

Referenced by insertItem(), and removeItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ useNativeMenu()

bool QQuickMenuPrivate::useNativeMenu ( ) const

Definition at line 304 of file qquickmenu.cpp.

References QPointer< T >::get(), get(), QQuickMenuBarPrivate::get(), QQuickPopupPrivate::m_popupType, menuBar, and rootMenu().

Referenced by nativeHandle(), and syncWithUseNativeMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cascade

bool QQuickMenuPrivate::cascade = false

◆ contentData

QList<QObject *> QQuickMenuPrivate::contentData

Definition at line 134 of file qquickmenu_p_p.h.

Referenced by insertItem(), itemChildAdded(), and removeItem().

◆ contentItem

◆ contentModel

◆ currentIndex

int QQuickMenuPrivate::currentIndex = -1

◆ currentItem

QPointer<QQuickMenuItem> QQuickMenuPrivate::currentItem

Definition at line 132 of file qquickmenu_p_p.h.

Referenced by currentSubMenu(), onItemHovered(), and setCurrentIndex().

◆ delegate

QQmlComponent* QQuickMenuPrivate::delegate = nullptr

Definition at line 136 of file qquickmenu_p_p.h.

Referenced by beginCreateItem(), and completeCreateItem().

◆ handle

std::unique_ptr<QPlatformMenu> QQuickMenuPrivate::handle = nullptr

Definition at line 141 of file qquickmenu_p_p.h.

◆ hoverTimer

int QQuickMenuPrivate::hoverTimer = 0

Definition at line 127 of file qquickmenu_p_p.h.

Referenced by startHoverTimer(), and stopHoverTimer().

◆ icon

QQuickIcon QQuickMenuPrivate::icon

Definition at line 138 of file qquickmenu_p_p.h.

◆ lastDevicePixelRatio

qreal QQuickMenuPrivate::lastDevicePixelRatio = 0

Definition at line 144 of file qquickmenu_p_p.h.

Referenced by setNativeMenuVisible().

◆ menuBar

QPointer<QQuickMenuBar> QQuickMenuPrivate::menuBar

Definition at line 143 of file qquickmenu_p_p.h.

Referenced by createNativeMenu(), propagateKeyEvent(), and useNativeMenu().

◆ nativeItems

◆ overlap

qreal QQuickMenuPrivate::overlap = 0

Definition at line 129 of file qquickmenu_p_p.h.

◆ parentMenu

◆ textPadding

qreal QQuickMenuPrivate::textPadding = 0

Definition at line 130 of file qquickmenu_p_p.h.

Referenced by updateTextPadding().

◆ title

QString QQuickMenuPrivate::title

Definition at line 137 of file qquickmenu_p_p.h.

Referenced by syncWithNativeMenu().

◆ triedToCreateNativeMenu

bool QQuickMenuPrivate::triedToCreateNativeMenu = false

Definition at line 126 of file qquickmenu_p_p.h.

Referenced by createNativeMenu(), nativeHandle(), and resetNativeData().


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