diff options
Diffstat (limited to 'src/widgets/widgets/qmenu.cpp')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 57d7fb1bc8..4796ed43d3 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -116,7 +116,7 @@ class QTornOffMenu : public QMenu q->setFixedSize(size); } - QVector<QPointer<QWidget> > calcCausedStack() const Q_DECL_OVERRIDE { return causedStack; } + QVector<QPointer<QWidget> > calcCausedStack() const override { return causedStack; } QPointer<QMenu> causedMenu; QVector<QPointer<QWidget> > causedStack; bool initialized; @@ -162,7 +162,7 @@ public: } else if (act->type() == QEvent::ActionRemoved) removeAction(act->action()); } - void actionEvent(QActionEvent *e) Q_DECL_OVERRIDE + void actionEvent(QActionEvent *e) override { Q_D(QTornOffMenu); QMenu::actionEvent(e); @@ -240,7 +240,7 @@ void QMenuPrivate::syncPlatformMenu() if (platformMenu.isNull()) return; - QPlatformMenuItem *beforeItem = Q_NULLPTR; + QPlatformMenuItem *beforeItem = nullptr; const QList<QAction*> actions = q->actions(); for (QList<QAction*>::const_reverse_iterator it = actions.rbegin(), end = actions.rend(); it != end; ++it) { QPlatformMenuItem *menuItem = insertActionInPlatformMenu(*it, beforeItem); @@ -435,13 +435,13 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const QString s = action->text(); int t = s.indexOf(QLatin1Char('\t')); if (t != -1) { - tabWidth = qMax(int(tabWidth), qfm.width(s.mid(t+1))); + tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(s.mid(t+1))); s = s.left(t); #ifndef QT_NO_SHORTCUT } else if (action->isShortcutVisibleInContextMenu() || !contextMenu) { QKeySequence seq = action->shortcut(); if (!seq.isEmpty()) - tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText))); + tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(seq.toString(QKeySequence::NativeText))); #endif } sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width()); @@ -665,7 +665,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason if (action && (action->isSeparator() || (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)))) - action = Q_NULLPTR; + action = nullptr; // Reselect the currently active action in case mouse moved over other menu items when // moving from sub menu action to sub menu (QTBUG-20094). @@ -739,13 +739,13 @@ void QMenuSloppyState::reset() m_use_reset_action = true; m_uni_dir_discarded_count = 0; m_time.stop(); - m_reset_action = Q_NULLPTR; - m_origin_action = Q_NULLPTR; + m_reset_action = nullptr; + m_origin_action = nullptr; m_action_rect = QRect(); m_previous_point = QPointF(); if (m_sub_menu) { - QMenuPrivate::get(m_sub_menu)->sloppyState.m_parent = Q_NULLPTR; - m_sub_menu = Q_NULLPTR; + QMenuPrivate::get(m_sub_menu)->sloppyState.m_parent = nullptr; + m_sub_menu = nullptr; } } void QMenuSloppyState::enter() @@ -854,7 +854,7 @@ void QMenuSloppyState::timeout() if (m_use_reset_action) menu_priv->setCurrentAction(m_reset_action, 0); } else { - menu_priv->setCurrentAction(Q_NULLPTR, 0); + menu_priv->setCurrentAction(nullptr, 0); } } @@ -903,8 +903,7 @@ void QMenuPrivate::adjustMenuScreen(const QPoint &p) // The (item) size calculations depend on the menu screen, // so a wrong screen would often cause wrong sizes (on high DPI) const QScreen *currentScreen = q->windowHandle() ? q->windowHandle()->screen() : nullptr; - const int screenNumberForPoint = QApplication::desktop()->screenNumber(p); - QScreen *actualScreen = QGuiApplication::screens().at(screenNumberForPoint); + QScreen *actualScreen = QGuiApplication::screenAt(p); if (actualScreen && currentScreen != actualScreen) { if (!q->windowHandle()) // Try to create a window handle if not created. createWinId(); @@ -2226,7 +2225,7 @@ void QMenu::hideTearOffMenu() // should consider the torn-off menu deleted. // This way showTearOffMenu() will not try to // reuse the dying torn-off menu. - d->tornPopup = Q_NULLPTR; + d->tornPopup = nullptr; } } |