10#include <QtGui/private/qguiapplication_p.h>
11#include <QtGui/qpa/qplatformtheme.h>
13#include <QtQml/qqmlcontext.h>
14#include <QtQml/qqmlcomponent.h>
15#include <QtQml/qqmlengine.h>
67 menuBarItem->setMenu(
menu);
102 else if (
menu && activate)
103 menu->setCurrentIndex(0);
121 item->setHighlighted(
true);
189 totalWidth +=
item->implicitWidth();
202 maxHeight =
qMax(maxHeight,
item->implicitHeight());
338 const int count =
d->contentModel->count();
412 return QQmlListProperty<QQuickMenu>(
q,
nullptr,
422 return QQmlListProperty<QObject>(
q,
nullptr,
434 switch (
event->type()) {
440 if (
auto *
item = qobject_cast<QQuickMenuBarItem *>(
d->itemAt(
i))) {
441 d->activateItem(
item);
463 d->altPressed =
false;
464 qApp->removeEventFilter(
this);
472 if (altKeyNavigation) {
476 d->altPressed =
true;
477 qApp->installEventFilter(
this);
489 switch (
event->key()) {
491 d->toggleCurrentMenu(
false,
false);
495 d->toggleCurrentMenu(
true,
true);
501 d->activateNextItem();
503 d->activatePreviousItem();
507 if (
d->currentItem) {
508 d->activateItem(
nullptr);
513#if QT_CONFIG(shortcut)
517 if (
auto *
item = qobject_cast<QQuickMenuBarItem *>(
d->itemAt(
i))) {
518 if (
item->shortcut() == mnemonic) {
519 d->activateItem(
item);
520 d->toggleCurrentMenu(
true,
true);
534 switch (
event->key()) {
553 if (!
d->popupMode &&
d->currentItem)
554 d->activateItem(
nullptr);
559 return qobject_cast<QQuickMenuBarItem *>(
item);
568 if (
d->windowContentItem)
569 d->windowContentItem->removeEventFilter(
this);
571 d->windowContentItem =
value.window->contentItem();
572 if (
d->windowContentItem)
573 d->windowContentItem->installEventFilter(
this);
592 d->updateImplicitContentSize();
613 d->updateImplicitContentSize();
622#if QT_CONFIG(accessibility)
623QAccessible::Role QQuickMenuBar::accessibleRole()
const
625 return QAccessible::MenuBar;
631#include "moc_qquickmenubar_p.cpp"
bool isEnabled() const
Returns true if the item is enabled; otherwise, false is returned.
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
static QPlatformTheme * platformTheme()
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
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)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
void deleteLater()
\threadsafe
The QPalette class contains color groups for each widget state.
The QQmlComponent class encapsulates a QML component definition.
virtual QObject * beginCreate(QQmlContext *)
Create an object instance from this component, within the specified context.
virtual void completeCreate()
This method provides advanced control over component instance creation.
QQmlContext * creationContext() const
Returns the QQmlContext the component was created in.
The QQmlContext class defines a context within a QML engine.
int count() const override
\qmlproperty int QtQml.Models::ObjectModel::count
int indexOf(QObject *object, QObject *objectContext) const override
static void contentData_append(QQmlListProperty< QObject > *prop, QObject *obj)
static QObject * contentData_at(QQmlListProperty< QObject > *prop, qsizetype index)
static qsizetype contentData_count(QQmlListProperty< QObject > *prop)
QQuickItem * itemAt(int index) const
static void contentData_clear(QQmlListProperty< QObject > *prop)
QQmlObjectModel * contentModel
virtual void itemMoved(int index, QQuickItem *item)
Q_INVOKABLE void addItem(QQuickItem *item)
\qmlmethod void QtQuick.Controls::Container::addItem(Item item)
virtual void itemAdded(int index, QQuickItem *item)
Q_INVOKABLE void removeItem(QQuickItem *item)
virtual void itemRemoved(int index, QQuickItem *item)
Q_INVOKABLE QQuickItem * itemAt(int index) const
\qmlmethod Item QtQuick.Controls::Container::itemAt(int index)
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
Q_INVOKABLE void insertItem(int index, QQuickItem *item)
\qmlmethod void QtQuick.Controls::Container::insertItem(int index, Item item)
QQuickDeferredPointer< QQuickItem > contentItem
void updateImplicitContentWidth()
void updateImplicitContentHeight()
void setFocusReason(Qt::FocusReason reason)
bool isMirrored() const
\qmlproperty bool QtQuick.Controls::Control::mirrored \readonly
virtual void itemImplicitWidthChanged(QQuickItem *)
virtual void itemImplicitHeightChanged(QQuickItem *)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key release events for an item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
void setFocusPolicy(Qt::FocusPolicy policy)
Sets the focus policy of this item to policy.
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
static QPalette palette(Scope scope)
static QFont font(Scope scope)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMax(const T &a, const T &b)
GLenum GLenum GLsizei count
GLdouble GLdouble GLdouble GLdouble q
QQmlContext * qmlContext(const QObject *obj)
void QQml_setParent_noEvent(QObject *object, QObject *parent)
Makes the object a child of parent.
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)