diff options
Diffstat (limited to 'src/widgets/widgets/qmenu.cpp')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index eba17783ec..d957dda162 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1479,10 +1479,9 @@ QMenu::QMenu(QWidget *parent) \sa title */ QMenu::QMenu(const QString &title, QWidget *parent) - : QWidget(*new QMenuPrivate, parent, Qt::Popup) + : QMenu(parent) { Q_D(QMenu); - d->init(); d->menuAction->setText(title); } @@ -2730,7 +2729,10 @@ QMenu::event(QEvent *e) if (kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down || kev->key() == Qt::Key_Left || kev->key() == Qt::Key_Right || kev->key() == Qt::Key_Enter || kev->key() == Qt::Key_Return - || kev->matches(QKeySequence::Cancel)) { +#ifndef QT_NO_SHORTCUT + || kev->matches(QKeySequence::Cancel) +#endif + ) { e->accept(); return true; } @@ -2978,7 +2980,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = true; break; } - //FALL THROUGH + Q_FALLTHROUGH(); case Qt::Key_Left: { if (d->currentAction && !d->scroll) { QAction *nextAction = 0; @@ -3025,6 +3027,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this)) break; // for motif, fall through + Q_FALLTHROUGH(); #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Select: #endif @@ -3057,7 +3060,11 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = false; } - if (!key_consumed && (e->matches(QKeySequence::Cancel) + if (!key_consumed && ( + false +#ifndef QT_NO_SHORTCUT + || e->matches(QKeySequence::Cancel) +#endif #ifdef QT_KEYPAD_NAVIGATION || e->key() == Qt::Key_Back #endif @@ -3271,7 +3278,9 @@ static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *i item->setIcon(QIcon()); } item->setVisible(action->isVisible()); +#ifndef QT_NO_SHORTCUT item->setShortcut(action->shortcut()); +#endif item->setCheckable(action->isCheckable()); item->setChecked(action->isChecked()); item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive()); @@ -3354,17 +3363,6 @@ void QMenu::actionEvent(QActionEvent *e) d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators); } -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - if (!d->wce_menu) - d->wce_menu = new QMenuPrivate::QWceMenuPrivate; - if (e->type() == QEvent::ActionAdded) - d->wce_menu->addAction(e->action(), d->wce_menu->findAction(e->before())); - else if (e->type() == QEvent::ActionRemoved) - d->wce_menu->removeAction(e->action()); - else if (e->type() == QEvent::ActionChanged) - d->wce_menu->syncAction(e->action()); -#endif - if (isVisible()) { d->updateActionRects(); resize(sizeHint()); |