35class Q_QUICKTEMPLATES2_EXPORT
QQuickMenu :
public QQuickPopup
38 Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
39 Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
40 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
42 Q_PROPERTY(
int count READ count NOTIFY countChanged FINAL REVISION(2, 3))
43 Q_PROPERTY(
bool cascade READ cascade WRITE setCascade RESET resetCascade NOTIFY cascadeChanged FINAL REVISION(2, 3))
44 Q_PROPERTY(qreal overlap READ overlap WRITE setOverlap NOTIFY overlapChanged FINAL REVISION(2, 3))
45 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL REVISION(2, 3))
46 Q_PROPERTY(
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL REVISION(2, 3))
48 Q_PROPERTY(QQuickIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION(6, 5))
49 Q_CLASSINFO(
"DefaultProperty",
"contentData")
50 QML_NAMED_ELEMENT(Menu)
51 QML_ADDED_IN_VERSION(2, 0)
54 explicit QQuickMenu(QObject *parent =
nullptr);
57 Q_INVOKABLE QQuickItem *itemAt(
int index)
const;
58 Q_INVOKABLE
void addItem(QQuickItem *item);
59 Q_INVOKABLE
void insertItem(
int index, QQuickItem *item);
60 Q_INVOKABLE
void moveItem(
int from,
int to);
61 Q_INVOKABLE
void removeItem(QQuickItem *item);
63 QVariant contentModel()
const;
64 QQmlListProperty<QObject> contentData();
66 QString title()
const;
67 void setTitle(
const QString &title);
69 QQuickIcon icon()
const;
70 void setIcon(
const QQuickIcon &icon);
73 void setCascade(
bool cascade);
76 qreal overlap()
const;
77 void setOverlap(qreal overlap);
79 QQmlComponent *delegate()
const;
80 void setDelegate(QQmlComponent *delegate);
82 int currentIndex()
const;
83 void setCurrentIndex(
int index);
87 Q_REVISION(2, 3) Q_INVOKABLE QQuickItem *takeItem(
int index);
89 Q_REVISION(2, 3) Q_INVOKABLE QQuickMenu *menuAt(
int index)
const;
90 Q_REVISION(2, 3) Q_INVOKABLE
void addMenu(QQuickMenu *menu);
91 Q_REVISION(2, 3) Q_INVOKABLE
void insertMenu(
int index, QQuickMenu *menu);
92 Q_REVISION(2, 3) Q_INVOKABLE
void removeMenu(QQuickMenu *menu);
93 Q_REVISION(2, 3) Q_INVOKABLE QQuickMenu *takeMenu(
int index);
95 Q_REVISION(2, 3) Q_INVOKABLE QQuickAction *actionAt(
int index)
const;
96 Q_REVISION(2, 3) Q_INVOKABLE
void addAction(QQuickAction *action);
97 Q_REVISION(2, 3) Q_INVOKABLE
void insertAction(
int index, QQuickAction *action);
98 Q_REVISION(2, 3) Q_INVOKABLE
void removeAction(QQuickAction *action);
99 Q_REVISION(2, 3) Q_INVOKABLE QQuickAction *takeAction(
int index);
101 bool isVisible()
const override;
102 void setVisible(
bool visible) override;
105 Q_REVISION(2, 3) Q_INVOKABLE
void popup(QQuickItem *parent, qreal x, qreal y, QQuickItem *menuItem =
nullptr);
106 Q_REVISION(2, 3) Q_INVOKABLE
void popup(QQuickItem *parent,
const QPointF &position, QQuickItem *menuItem =
nullptr);
107 Q_REVISION(2, 3) Q_INVOKABLE
void popup(QQuickItem *parent, QQuickItem *menuItem);
108 Q_REVISION(2, 3) Q_INVOKABLE
void popup(QQuickItem *parent =
nullptr);
110 Q_REVISION(2, 3) Q_INVOKABLE
void popup(qreal x, qreal y, QQuickItem *menuItem =
nullptr);
111 Q_REVISION(2, 3) Q_INVOKABLE
void popup(
const QPointF &position, QQuickItem *menuItem =
nullptr);
112 Q_REVISION(2, 3) Q_INVOKABLE
void dismiss();
115 void componentComplete() override;
116 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
117 void itemChange(QQuickItem::ItemChange change,
const QQuickItem::ItemChangeData &data) override;
118 void keyPressEvent(QKeyEvent *event) override;
121 void titleChanged(
const QString &title);
123 Q_REVISION(2, 3)
void countChanged();
124 Q_REVISION(2, 3)
void cascadeChanged(
bool cascade);
125 Q_REVISION(2, 3)
void overlapChanged();
126 Q_REVISION(2, 3)
void delegateChanged();
127 Q_REVISION(2, 3)
void currentIndexChanged();
129 Q_REVISION(6, 5)
void iconChanged(
const QQuickIcon &icon);
132 void timerEvent(QTimerEvent *event) override;
134 QFont defaultFont()
const override;
136#if QT_CONFIG(accessibility)
137 QAccessible::Role accessibleRole()
const override;
141 Q_DISABLE_COPY(QQuickMenu)
142 Q_DECLARE_PRIVATE(QQuickMenu)