diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qshortcut.cpp | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qtooltip.cpp | 12 | ||||
-rw-r--r-- | src/widgets/widgets/qsplitter.cpp | 9 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 32600d4152..fde039c75e 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -187,8 +187,15 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge active_window = active_window->parentWidget()->window(); } - if (active_window != tlw) + if (active_window != tlw) { +#if QT_CONFIG(menubar) + // If the tlw is a QMenuBar then we allow it to proceed as this indicates that + // the QMenuBar is a parentless one and is therefore used for multiple top level + // windows in the application. This is common on macOS platforms for example. + if (!qobject_cast<QMenuBar *>(tlw)) +#endif return false; + } /* if we live in a MDI subwindow, ignore the event if we are not the active document window */ diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index baf717d715..ed7184302a 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -317,15 +317,13 @@ void QTipLabel::timerEvent(QTimerEvent *e) bool QTipLabel::eventFilter(QObject *o, QEvent *e) { switch (e->type()) { -#if 0 // Used to be included in Qt4 for Q_WS_MAC +#ifdef Q_OS_MACOS case QEvent::KeyPress: case QEvent::KeyRelease: { - int key = static_cast<QKeyEvent *>(e)->key(); - Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(e)->modifiers(); - if (!(mody & Qt::KeyboardModifierMask) - && key != Qt::Key_Shift && key != Qt::Key_Control - && key != Qt::Key_Alt && key != Qt::Key_Meta) - hideTip(); + const int key = static_cast<QKeyEvent *>(e)->key(); + // Anything except key modifiers or caps-lock, etc. + if (key < Qt::Key_Shift || key > Qt::Key_ScrollLock) + hideTipImmediately(); break; } #endif diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 55f2dd2421..6ee49aa9f0 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1234,9 +1234,9 @@ QSplitterHandle *QSplitter::createHandle() } /*! - Returns the handle to the left (or above) for the item in the - splitter's layout at the given \a index. The handle at index 0 is - always hidden. + Returns the handle to the left of (or above) the item in the + splitter's layout at the given \a index, or \c nullptr if there is no such item. + The handle at index 0 is always hidden. For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. The handle will be to the @@ -1253,7 +1253,8 @@ QSplitterHandle *QSplitter::handle(int index) const } /*! - Returns the widget at the given \a index in the splitter's layout. + Returns the widget at the given \a index in the splitter's layout, + or \c nullptr if there is no such widget. \sa count(), handle(), indexOf(), insertWidget() */ |