![]() |
Qt 6.x
The Qt SDK
|
#include <qquickmenu_p.h>
Public Member Functions | |
QQuickMenu (QObject *parent=nullptr) | |
~QQuickMenu () | |
Q_INVOKABLE QQuickItem * | itemAt (int index) const |
\qmlmethod Item QtQuick.Controls::Menu::itemAt(int index) | |
Q_INVOKABLE void | addItem (QQuickItem *item) |
\qmlmethod void QtQuick.Controls::Menu::addItem(Item item) | |
Q_INVOKABLE void | insertItem (int index, QQuickItem *item) |
\qmlmethod void QtQuick.Controls::Menu::insertItem(int index, Item item) | |
Q_INVOKABLE void | moveItem (int from, int to) |
\qmlmethod void QtQuick.Controls::Menu::moveItem(int from, int to) | |
Q_INVOKABLE void | removeItem (QQuickItem *item) |
QVariant | contentModel () const |
\qmlproperty model QtQuick.Controls::Menu::contentModel \readonly | |
QQmlListProperty< QObject > | contentData () |
QString | title () const |
\qmlproperty string QtQuick.Controls::Menu::title | |
void | setTitle (QString &title) |
QQuickIcon | icon () const |
\qmlproperty string QtQuick.Controls::Menu::icon.name \qmlproperty url QtQuick.Controls::Menu::icon.source \qmlproperty int QtQuick.Controls::Menu::icon.width \qmlproperty int QtQuick.Controls::Menu::icon.height \qmlproperty color QtQuick.Controls::Menu::icon.color \qmlproperty bool QtQuick.Controls::Menu::icon.cache | |
void | setIcon (const QQuickIcon &icon) |
bool | cascade () const |
void | setCascade (bool cascade) |
void | resetCascade () |
qreal | overlap () const |
void | setOverlap (qreal overlap) |
QQmlComponent * | delegate () const |
void | setDelegate (QQmlComponent *delegate) |
int | currentIndex () const |
void | setCurrentIndex (int index) |
int | count () const |
Q_REVISION (2, 3) Q_INVOKABLE QQuickItem *takeItem(int index) | |
Q_REVISION (2, 3) Q_INVOKABLE QQuickMenu *menuAt(int index) const | |
Q_REVISION (2, 3) Q_INVOKABLE void addMenu(QQuickMenu *menu) | |
Q_REVISION (2, 3) Q_INVOKABLE void insertMenu(int index | |
Q_REVISION (2, 3) Q_INVOKABLE void removeMenu(QQuickMenu *menu) | |
Q_REVISION (2, 3) Q_INVOKABLE QQuickMenu *takeMenu(int index) | |
Q_REVISION (2, 3) Q_INVOKABLE QQuickAction *actionAt(int index) const | |
Q_REVISION (2, 3) Q_INVOKABLE void addAction(QQuickAction *action) | |
Q_REVISION (2, 3) Q_INVOKABLE void insertAction(int index | |
Q_REVISION (2, 3) Q_INVOKABLE void removeAction(QQuickAction *action) | |
Q_REVISION (2, 3) Q_INVOKABLE QQuickAction *takeAction(int index) | |
void | popup (QQuickItem *menuItem=nullptr) |
void | popup (const QPointF &pos, QQuickItem *menuItem=nullptr) |
Q_REVISION (2, 3) Q_INVOKABLE void popup(QQmlV4Function *args) | |
Q_REVISION (2, 3) Q_INVOKABLE void dismiss() | |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
![]() | |
QQmlParserStatus () | |
virtual | ~QQmlParserStatus () |
virtual void | classBegin ()=0 |
Invoked after class creation, but before any properties have been set. | |
virtual void | componentComplete ()=0 |
Invoked after the root component that caused this instantiation has completed construction. | |
Public Attributes | |
QQuickMenu * | menu |
QQuickAction * | action |
Protected Member Functions | |
void | componentComplete () override |
Invoked after the root component that caused this instantiation has completed construction. | |
void | contentItemChange (QQuickItem *newItem, QQuickItem *oldItem) override |
void | itemChange (QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override |
void | keyPressEvent (QKeyEvent *event) override |
void | timerEvent (QTimerEvent *event) override |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
QFont | defaultFont () const override |
![]() | |
QQuickPopup (QQuickPopupPrivate &dd, QObject *parent) | |
void | classBegin () override |
Invoked after class creation, but before any properties have been set. | |
void | componentComplete () override |
Invoked after the root component that caused this instantiation has completed construction. | |
bool | isComponentComplete () const |
virtual bool | childMouseEventFilter (QQuickItem *child, QEvent *event) |
virtual void | focusInEvent (QFocusEvent *event) |
virtual void | focusOutEvent (QFocusEvent *event) |
virtual void | keyPressEvent (QKeyEvent *event) |
virtual void | keyReleaseEvent (QKeyEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
virtual void | mouseUngrabEvent () |
virtual bool | overlayEvent (QQuickItem *item, QEvent *event) |
virtual void | contentItemChange (QQuickItem *newItem, QQuickItem *oldItem) |
virtual void | contentSizeChange (const QSizeF &newSize, const QSizeF &oldSize) |
virtual void | fontChange (const QFont &newFont, const QFont &oldFont) |
virtual void | geometryChange (const QRectF &newGeometry, const QRectF &oldGeometry) |
virtual void | localeChange (const QLocale &newLocale, const QLocale &oldLocale) |
virtual void | itemChange (QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) |
virtual void | marginsChange (const QMarginsF &newMargins, const QMarginsF &oldMargins) |
virtual void | paddingChange (const QMarginsF &newPadding, const QMarginsF &oldPadding) |
virtual void | spacingChange (qreal newSpacing, qreal oldSpacing) |
virtual void | insetChange (const QMarginsF &newInset, const QMarginsF &oldInset) |
virtual QFont | defaultFont () const |
QString | accessibleName () const |
void | maybeSetAccessibleName (const QString &name) |
QVariant | accessibleProperty (const char *propertyName) |
bool | setAccessibleProperty (const char *propertyName, const QVariant &value) |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
Additional Inherited Members | |
![]() | |
void | open () |
\qmlmethod void QtQuick.Controls::Popup::open() | |
void | close () |
\qmlmethod void QtQuick.Controls::Popup::close() | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
Definition at line 31 of file qquickmenu_p.h.
Definition at line 727 of file qquickmenu.cpp.
References QObject::connect(), QQmlInstanceModel::countChanged(), and d.
QQuickMenu::~QQuickMenu | ( | ) |
Definition at line 736 of file qquickmenu.cpp.
References QQuickItemPrivate::Children, d, QQuickItemPrivate::Geometry, QQuickItemPrivate::get(), and QQuickItemPrivate::removeItemChangeListener().
void QQuickMenu::addItem | ( | QQuickItem * | item | ) |
\qmlmethod void QtQuick.Controls::Menu::addItem(Item item)
Adds item to the end of the list of items.
Definition at line 767 of file qquickmenu.cpp.
References d, insertItem(), and item.
bool QQuickMenu::cascade | ( | ) | const |
This property holds whether the menu cascades its sub-menus.
The default value is platform-specific. Menus are cascading by default on desktop platforms that have a mouse cursor available. Non-cascading menus are shown one menu at a time, and centered over the parent menu.
Definition at line 1166 of file qquickmenu.cpp.
References d.
|
overrideprotectedvirtual |
Invoked after the root component that caused this instantiation has completed construction.
At this point all static values and binding values have been assigned to the class.
Implements QQmlParserStatus.
Definition at line 1445 of file qquickmenu.cpp.
References QQuickPopup::componentComplete(), and d.
QQmlListProperty< QObject > QQuickMenu::contentData | ( | ) |
|
overrideprotectedvirtual |
Reimplemented from QQuickPopup.
Definition at line 1452 of file qquickmenu.cpp.
References QQuickItemPrivate::addItemChangeListener(), QQuickItemPrivate::Children, QQuickPopup::contentItemChange(), d, QQuickItemPrivate::Geometry, QQuickItemPrivate::get(), QQuickItemPrivate::removeItemChangeListener(), QQuickItemPrivate::updateOrAddGeometryChangeListener(), and QQuickGeometryChange::Width.
QVariant QQuickMenu::contentModel | ( | ) | const |
\qmlproperty model QtQuick.Controls::Menu::contentModel \readonly
This property holds the model used to display menu items.
The content model is provided for visualization purposes. It can be assigned as a model to a content item that presents the contents of the menu.
The model allows menu items to be statically declared as children of the menu.
Definition at line 1064 of file qquickmenu.cpp.
References d, and QVariant::fromValue().
int QQuickMenu::count | ( | ) | const |
This property holds the number of items.
Definition at line 1283 of file qquickmenu.cpp.
References d.
int QQuickMenu::currentIndex | ( | ) | const |
This property holds the index of the currently highlighted item.
Menu items can be highlighted by mouse hover or keyboard navigation.
Definition at line 1264 of file qquickmenu.cpp.
References d.
|
overrideprotectedvirtual |
Reimplemented from QQuickPopup.
Definition at line 1551 of file qquickmenu.cpp.
References QQuickTheme::font(), and QQuickTheme::Menu.
QQmlComponent * QQuickMenu::delegate | ( | ) | const |
This property holds the component that is used to create items to present actions.
Definition at line 1238 of file qquickmenu.cpp.
References d.
QQuickIcon QQuickMenu::icon | ( | ) | const |
\qmlproperty string QtQuick.Controls::Menu::icon.name \qmlproperty url QtQuick.Controls::Menu::icon.source \qmlproperty int QtQuick.Controls::Menu::icon.width \qmlproperty int QtQuick.Controls::Menu::icon.height \qmlproperty color QtQuick.Controls::Menu::icon.color \qmlproperty bool QtQuick.Controls::Menu::icon.cache
This property group was added in QtQuick.Controls 6.5.
grouped-properties
Definition at line 1136 of file qquickmenu.cpp.
References d.
void QQuickMenu::insertItem | ( | int | index, |
QQuickItem * | item | ||
) |
QQuickItem * QQuickMenu::itemAt | ( | int | index | ) | const |
\qmlmethod Item QtQuick.Controls::Menu::itemAt(int index)
Returns the item at index, or null
if it does not exist.
Definition at line 756 of file qquickmenu.cpp.
References d.
|
overrideprotectedvirtual |
Reimplemented from QQuickPopup.
Definition at line 1469 of file qquickmenu.cpp.
References d, QQuickPopup::itemChange(), QQuickItem::ItemVisibleHasChanged, and Qt::OtherFocusReason.
Reimplemented from QQuickPopup.
Definition at line 1483 of file qquickmenu.cpp.
References QQuickPopup::close(), d, QQuickMenuPrivate::get(), Qt::Key_Alt, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, Qt::Key_Up, QQuickPopup::keyPressEvent(), QKeySequence::mnemonic(), popup(), and QStringLiteral.
void QQuickMenu::moveItem | ( | int | from, |
int | to | ||
) |
\qmlmethod void QtQuick.Controls::Menu::moveItem(int from, int to)
Moves an item from one index to another.
Definition at line 803 of file qquickmenu.cpp.
References d.
qreal QQuickMenu::overlap | ( | ) | const |
This property holds the amount of pixels by which the menu horizontally overlaps its parent menu.
The property only has effect when the menu is used as a cascading sub-menu.
The default value is style-specific.
Definition at line 1206 of file qquickmenu.cpp.
References d.
void QQuickMenu::popup | ( | const QPointF & | pos, |
QQuickItem * | menuItem = nullptr |
||
) |
Definition at line 1307 of file qquickmenu.cpp.
References d, QQuickPopup::open(), Qt::PopupFocusReason, pos, and setPosition().
void QQuickMenu::popup | ( | QQuickItem * | menuItem = nullptr | ) |
Definition at line 1289 of file qquickmenu.cpp.
References d, QPlatformIntegration::hasCapability(), QPlatformIntegration::MultipleWindows, QGuiApplicationPrivate::platformIntegration(), popup(), pos, and QCursor::pos().
Referenced by keyPressEvent(), and popup().
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) | const |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) | const |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
QQuickMenu::Q_REVISION | ( | 2 | , |
3 | |||
) |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
void QQuickMenu::removeItem | ( | QQuickItem * | item | ) |
Removes and destroys the specified item.
Definition at line 822 of file qquickmenu.cpp.
void QQuickMenu::resetCascade | ( | ) |
Definition at line 1183 of file qquickmenu.cpp.
References d, setCascade(), and shouldCascade().
void QQuickMenu::setCascade | ( | bool | cascade | ) |
Definition at line 1172 of file qquickmenu.cpp.
References cascade, d, and emit.
Referenced by resetCascade(), and QQuickMenuPrivate::setParentMenu().
void QQuickMenu::setCurrentIndex | ( | int | index | ) |
Definition at line 1270 of file qquickmenu.cpp.
References d, and Qt::OtherFocusReason.
void QQuickMenu::setDelegate | ( | QQmlComponent * | delegate | ) |
Definition at line 1244 of file qquickmenu.cpp.
void QQuickMenu::setIcon | ( | const QQuickIcon & | icon | ) |
Definition at line 1142 of file qquickmenu.cpp.
Definition at line 1212 of file qquickmenu.cpp.
Definition at line 1112 of file qquickmenu.cpp.
References d, emit, title, and titleChanged().
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive timer events for the object.
QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.
Reimplemented from QObject.
Definition at line 1539 of file qquickmenu.cpp.
References d, QQuickPopup::open(), and QObject::timerEvent().
QString QQuickMenu::title | ( | ) | const |
\qmlproperty string QtQuick.Controls::Menu::title
This property holds the title for the menu.
The title of a menu is often displayed in the text of a menu item when the menu is a submenu, and in the text of a tool button when it is in a menubar.
Definition at line 1106 of file qquickmenu.cpp.
References d.
Referenced by QQuickMenuBarItem::setMenu(), QQuickMenuItemPrivate::setSubMenu(), and setTitle().
QQuickAction* QQuickMenu::action |
Definition at line 93 of file qquickmenu_p.h.
QQuickMenu* QQuickMenu::menu |
Definition at line 87 of file qquickmenu_p.h.
|
readwrite |
Definition at line 134 of file qquickmenu_p.h.
Referenced by QQuickMenuPrivate::onItemHovered(), and setCascade().
|
read |
\qmlproperty list<QtObject> QtQuick.Controls::Menu::contentData \qmldefault
This property holds the list of content data.
The list contains all objects that have been declared in QML as children of the menu, and also items that have been dynamically added or inserted using the \l addItem() and \l insertItem() methods, respectively.
contentChildren
, contentData
does include non-visual QML objects. It is not re-ordered when items are inserted or moved.Definition at line 134 of file qquickmenu_p.h.
|
read |
Definition at line 134 of file qquickmenu_p.h.
|
read |
Definition at line 134 of file qquickmenu_p.h.
Referenced by insertItem().
|
readwrite |
Definition at line 134 of file qquickmenu_p.h.
|
readwrite |
Definition at line 134 of file qquickmenu_p.h.
Referenced by setDelegate().
|
readwrite |
Definition at line 134 of file qquickmenu_p.h.
Referenced by setIcon(), and QQuickMenuItemPrivate::setSubMenu().
|
readwrite |
Definition at line 134 of file qquickmenu_p.h.
Referenced by setOverlap().
|
readwrite |
Definition at line 134 of file qquickmenu_p.h.
Referenced by QQuickMenuBarItem::setMenu(), QQuickMenuItemPrivate::setSubMenu(), and setTitle().