summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/REUSE.toml8
-rw-r--r--src/widgets/accessible/simplewidgets.cpp28
-rw-r--r--src/widgets/accessible/simplewidgets_p.h4
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp6
-rw-r--r--src/widgets/itemviews/qheaderview.cpp4
-rw-r--r--src/widgets/kernel/qtestsupport_widgets.cpp63
-rw-r--r--src/widgets/kernel/qtestsupport_widgets.h13
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp14
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp14
-rw-r--r--src/widgets/styles/qcommonstyle.cpp3
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qfusionstyle_p_p.h5
-rw-r--r--src/widgets/styles/qstyle.cpp12
-rw-r--r--src/widgets/styles/qstyle.h2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp6
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp16
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp3
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp6
-rw-r--r--src/widgets/widgets/qscrollbar.cpp6
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp8
22 files changed, 170 insertions, 59 deletions
diff --git a/src/widgets/REUSE.toml b/src/widgets/REUSE.toml
index 98653c588bb..0bfd718750e 100644
--- a/src/widgets/REUSE.toml
+++ b/src/widgets/REUSE.toml
@@ -3,24 +3,24 @@ version = 1
[[annotations]]
path = ["styles/images/*.png", "dialogs/images/*.png", "styles/images/*.svg"]
precedence = "closest"
-SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
+SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"
[[annotations]]
path = ["doc/**"]
precedence = "closest"
-SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
+SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
[[annotations]]
path = ["doc/snippets/**"]
precedence = "closest"
-SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
+SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["doc/snippets/common-table-model/README"]
precedence = "closest"
-SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
+SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index 39da1538376..190c7b624f6 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -289,19 +289,32 @@ QToolButton *QAccessibleToolButton::toolButton() const
bool QAccessibleToolButton::isSplitButton() const
{
#if QT_CONFIG(menu)
- return toolButton()->menu() && toolButton()->popupMode() == QToolButton::MenuButtonPopup;
+ return menu() && toolButton()->popupMode() == QToolButton::MenuButtonPopup;
#else
return false;
#endif
}
+#if QT_CONFIG(menu)
+QMenu *QAccessibleToolButton::menu() const
+{
+ if (QMenu *menu = toolButton()->menu())
+ return menu;
+
+ if (QAction *defaultAction = toolButton()->defaultAction())
+ return defaultAction->menu();
+
+ return nullptr;
+}
+#endif
+
QAccessible::State QAccessibleToolButton::state() const
{
QAccessible::State st = QAccessibleButton::state();
if (toolButton()->autoRaise())
st.hotTracked = true;
#if QT_CONFIG(menu)
- if (toolButton()->menu())
+ if (menu())
st.hasPopup = true;
#endif
return st;
@@ -315,9 +328,8 @@ int QAccessibleToolButton::childCount() const
QAccessible::Role QAccessibleToolButton::role() const
{
#if QT_CONFIG(menu)
- QAbstractButton *ab = button();
- QToolButton *tb = qobject_cast<QToolButton*>(ab);
- if (!tb->menu())
+ QToolButton *tb = toolButton();
+ if (!menu())
return tb->isCheckable() ? QAccessible::CheckBox : QAccessible::PushButton;
else if (tb->popupMode() == QToolButton::DelayedPopup)
return QAccessible::ButtonDropDown;
@@ -329,10 +341,8 @@ QAccessible::Role QAccessibleToolButton::role() const
QAccessibleInterface *QAccessibleToolButton::child(int index) const
{
#if QT_CONFIG(menu)
- if (index == 0 && toolButton()->menu())
- {
- return QAccessible::queryAccessibleInterface(toolButton()->menu());
- }
+ if (index == 0 && menu())
+ return QAccessible::queryAccessibleInterface(menu());
#else
Q_UNUSED(index);
#endif
diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h
index 02c23f8cba7..356ef9101b2 100644
--- a/src/widgets/accessible/simplewidgets_p.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -27,6 +27,7 @@ class QAbstractButton;
class QLineEdit;
class QToolButton;
class QGroupBox;
+class QMenu;
class QMessageBox;
class QProgressBar;
@@ -71,6 +72,9 @@ protected:
QToolButton *toolButton() const;
bool isSplitButton() const;
+#if QT_CONFIG(menu)
+ QMenu *menu() const;
+#endif
};
#endif // QT_CONFIG(toolbutton)
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index f9d58e4d906..acb63c4aa9b 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -562,6 +562,10 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel
and \l{QMessageBox::standardButtons} {standard buttons} for
accepting a user response.
+ While the parent parameter is optional, specifying it gives a hint
+ to the window manager, which can then take care of positioning, and
+ maintain a proper stacking order of the dialog window.
+
Two APIs for using QMessageBox are provided, the property-based
API, and the static functions. Calling one of the static functions
is the simpler approach, but it is less flexible than using the
diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
index ebc07025ec0..062e2e5142a 100644
--- a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
@@ -12,7 +12,7 @@ int ret = QMessageBox::warning(this, tr("My Application"),
//! [2]
-QMessageBox msgBox;
+QMessageBox msgBox(this);
QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole);
QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);
@@ -53,13 +53,13 @@ int main(int argc, char *argv[])
//! [4]
//! [5]
-QMessageBox msgBox;
+QMessageBox msgBox(this);
msgBox.setText("The document has been modified.");
msgBox.exec();
//! [5]
//! [6]
-QMessageBox msgBox;
+QMessageBox msgBox(this);
msgBox.setText("The document has been modified.");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index b2fa08e406f..06912d41582 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3671,10 +3671,8 @@ void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool
executePostedLayout();
- if (noSectionMemoryUsage() &&
- (hasAutoResizeSections() || (useGlobalMode && globalResizeMode != QHeaderView::Fixed))) {
+ if (noSectionMemoryUsage() && (hasAutoResizeSections() || globalMode != QHeaderView::Fixed))
setHeaderMode(HeaderMode::FlexibleWithSectionMemoryUsage);
- }
if (sectionCount() == 0 )
return;
diff --git a/src/widgets/kernel/qtestsupport_widgets.cpp b/src/widgets/kernel/qtestsupport_widgets.cpp
index 5a7200e58aa..ce40ba8c6dd 100644
--- a/src/widgets/kernel/qtestsupport_widgets.cpp
+++ b/src/widgets/kernel/qtestsupport_widgets.cpp
@@ -31,6 +31,17 @@ static bool qWaitForWidgetWindow(QWidget *w, Predicate predicate, QDeadlineTimer
/*!
\since 5.0
+ \overload
+
+ The \a timeout is in milliseconds.
+*/
+bool QTest::qWaitForWindowActive(QWidget *widget, int timeout)
+{
+ return qWaitForWindowActive(widget, QDeadlineTimer{timeout, Qt::TimerType::PreciseTimer});
+}
+
+/*!
+ \since 6.10
Returns \c true if \a widget is active within \a timeout milliseconds. Otherwise returns \c false.
@@ -45,7 +56,7 @@ static bool qWaitForWidgetWindow(QWidget *w, Predicate predicate, QDeadlineTimer
\sa qWaitForWindowExposed(), QWidget::isActiveWindow()
*/
-Q_WIDGETS_EXPORT bool QTest::qWaitForWindowActive(QWidget *widget, int timeout)
+bool QTest::qWaitForWindowActive(QWidget *widget, QDeadlineTimer timeout)
{
if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))) {
qWarning() << "qWaitForWindowActive was called on a platform that doesn't support window"
@@ -57,9 +68,19 @@ Q_WIDGETS_EXPORT bool QTest::qWaitForWindowActive(QWidget *widget, int timeout)
}
return qWaitForWidgetWindow(widget,
[&](QWindow *window) { return window->isActive(); },
- QDeadlineTimer{timeout, Qt::TimerType::PreciseTimer});
+ timeout);
}
+/*!
+ \since 6.10
+ \overload
+
+ This function uses the default timeout of 5 seconds.
+*/
+bool QTest::qWaitForWindowActive(QWidget *widget)
+{
+ return qWaitForWindowActive(widget, Internal::defaultTryTimeout);
+}
/*!
\since 6.7
@@ -86,7 +107,30 @@ Q_WIDGETS_EXPORT bool QTest::qWaitForWindowFocused(QWidget *widget, QDeadlineTim
}
/*!
+ \since 6.10
+ \overload
+
+ This function uses the default timeout of 5 seconds.
+*/
+bool QTest::qWaitForWindowFocused(QWidget *widget)
+{
+ return qWaitForWindowFocused(widget, Internal::defaultTryTimeout);
+}
+
+/*!
\since 5.0
+ \overload
+
+ The \a timeout is in milliseconds.
+*/
+bool QTest::qWaitForWindowExposed(QWidget *widget, int timeout)
+{
+ return qWaitForWindowExposed(widget, std::chrono::milliseconds(timeout));
+}
+
+
+/*!
+ \since 6.10
Returns \c true if \a widget is exposed within \a timeout milliseconds. Otherwise returns \c false.
@@ -99,11 +143,22 @@ Q_WIDGETS_EXPORT bool QTest::qWaitForWindowFocused(QWidget *widget, QDeadlineTim
\sa qWaitForWindowActive(), QWidget::isVisible(), QWindow::isExposed()
*/
-Q_WIDGETS_EXPORT bool QTest::qWaitForWindowExposed(QWidget *widget, int timeout)
+bool QTest::qWaitForWindowExposed(QWidget *widget, QDeadlineTimer timeout)
{
return qWaitForWidgetWindow(widget,
[&](QWindow *window) { return window->isExposed(); },
- QDeadlineTimer{timeout, Qt::TimerType::PreciseTimer});
+ timeout);
+}
+
+/*!
+ \since 6.10
+ \overload
+
+ This function uses the default timeout of 5 seconds.
+*/
+bool QTest::qWaitForWindowExposed(QWidget *widget)
+{
+ return qWaitForWindowExposed(widget, Internal::defaultTryTimeout);
}
namespace QTest {
diff --git a/src/widgets/kernel/qtestsupport_widgets.h b/src/widgets/kernel/qtestsupport_widgets.h
index b49e68db651..4b5e5ff7772 100644
--- a/src/widgets/kernel/qtestsupport_widgets.h
+++ b/src/widgets/kernel/qtestsupport_widgets.h
@@ -14,9 +14,16 @@ class QWidget;
namespace QTest {
-[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, int timeout = 5000);
-[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowFocused(QWidget *widget, QDeadlineTimer timeout = std::chrono::seconds{5});
-[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000);
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, int timeout);
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, QDeadlineTimer timeout);
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget);
+
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowFocused(QWidget *widget, QDeadlineTimer timeout);
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowFocused(QWidget *widget);
+
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, int timeout);
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, QDeadlineTimer timeout);
+[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget);
class Q_WIDGETS_EXPORT QTouchEventWidgetSequence : public QTouchEventSequence
{
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 17a19aa780d..c843927d366 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -11,18 +11,16 @@
QT_BEGIN_NAMESPACE
namespace {
-
-// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
-static constexpr struct : QMetaTypeModuleHelper
+struct QVariantWidgetsHelper : QMetaTypeModuleHelper
{
- const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override {
+ static const QtPrivate::QMetaTypeInterface *interfaceForType(int type)
+ {
switch (type) {
QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_CONVERT_ID_TO_TYPE)
default: return nullptr;
}
}
-} qVariantWidgetsHelper;
-
+};
#undef QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES
@@ -30,7 +28,9 @@ static constexpr struct : QMetaTypeModuleHelper
void qRegisterWidgetsVariant()
{
- qMetaTypeWidgetsHelper = &qVariantWidgetsHelper;
+ qMetaTypeWidgetsHelper = QMetaTypeModuleHelper{
+ &QVariantWidgetsHelper::interfaceForType,
+ };
}
Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant)
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 4cf2934a2dc..b85446121bd 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -622,7 +622,21 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
}
}
QApplicationPrivate::replayMousePress = false;
+#ifndef QT_NO_CONTEXTMENU
+ } else if (event->type() == QGuiApplicationPrivate::contextMenuEventType()
+ && event->button() == Qt::RightButton) {
+ QWidget *receiver = activePopupWidget;
+ if (qt_button_down)
+ receiver = qt_button_down;
+ else if (popupChild)
+ receiver = popupChild;
+ const QPoint localPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
+ QContextMenuEvent e(QContextMenuEvent::Mouse, localPos, event->globalPosition().toPoint(), event->modifiers());
+ QApplication::forwardEvent(receiver, &e, event);
+ }
+#else
}
+#endif
if (releaseAfter) {
qt_button_down = nullptr;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index b5972411534..60ec043d094 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5434,7 +5434,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_Menu_AllowActiveAndDisabled:
case SH_Menu_SpaceActivatesItem:
case SH_ScrollView_FrameOnlyAroundContents:
- case SH_ComboBox_ListMouseTracking:
+ case SH_ComboBox_ListMouseTracking_Current:
+ case SH_ComboBox_ListMouseTracking_Active:
case SH_Menu_MouseTracking:
case SH_MenuBar_MouseTracking:
case SH_ItemView_ChangeHighlightOnFocus:
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index e9cc250c517..c341a025115 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -591,7 +591,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
painter->setPen(highlightedOutline);
else
- painter->setPen(colorScheme() == Qt::ColorScheme::Dark ? outline.lighter(150)
+ painter->setPen(colorScheme() == Qt::ColorScheme::Dark ? outline.lighter(240)
: outline.lighter(110));
painter->drawRect(rect);
diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h
index 67abdd74dc8..62641609d59 100644
--- a/src/widgets/styles/qfusionstyle_p_p.h
+++ b/src/widgets/styles/qfusionstyle_p_p.h
@@ -70,10 +70,7 @@ public:
}
if (pal.window().style() == Qt::TexturePattern)
return QColor(0, 0, 0, 160);
- if (colorScheme() == Qt::ColorScheme::Dark)
- return pal.window().color().lighter(140);
- else
- return pal.window().color().darker(140);
+ return pal.window().color().darker(140);
}
QColor highlightedOutline(const QPalette &pal) const {
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 6bb0728cfd4..e72e645e69c 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1736,8 +1736,16 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
by pressing Alt, followed by using the arrow keys to select
the desired item.
- \value SH_ComboBox_ListMouseTracking Mouse tracking in combobox
- drop-down lists.
+ \value SH_ComboBox_ListMouseTracking_Current Mouse tracking in
+ combobox drop-down lists, the item under the cursor is made
+ the current item (QStyle::State_Selected).
+
+ \value SH_ComboBox_ListMouseTracking same as
+ SH_ComboBox_ListMouseTracking_Current
+
+ \value SH_ComboBox_ListMouseTracking_Active Mouse tracking in
+ combobox drop-down lists, the item under the cursor is not
+ made the current item, only active (QStyle::State_MouseOver).
\value SH_Menu_MouseTracking Mouse tracking in popup menus.
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index db09eedc70d..d6bccf9f698 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -602,6 +602,7 @@ public:
SH_ScrollView_FrameOnlyAroundContents,
SH_MenuBar_AltKeyNavigation,
SH_ComboBox_ListMouseTracking,
+ SH_ComboBox_ListMouseTracking_Current = SH_ComboBox_ListMouseTracking,
SH_Menu_MouseTracking,
SH_MenuBar_MouseTracking,
SH_ItemView_ChangeHighlightOnFocus,
@@ -704,6 +705,7 @@ public:
SH_TabBar_AllowWheelScrolling,
SH_Table_AlwaysDrawLeftTopGridLines,
SH_SpinBox_SelectOnStep,
+ SH_ComboBox_ListMouseTracking_Active,
// Add new style hint values here
SH_CustomBase = 0xf0000000
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 08178e7b685..f4b21d3b70d 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -5269,7 +5269,11 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
if (rule.baseStyleCanDraw()) {
sz = baseStyle()->sizeFromContents(ct, opt, sz, w);
- } else if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) {
+ if (rule.hasBox() || !rule.hasNativeBorder())
+ sz = rule.boxSize(sz);
+ return sz;
+ }
+ if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) {
// Add some space for the up/down buttons
QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
if (subRule.hasDrawable()) {
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 907628f224e..d6daa681798 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -461,7 +461,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
case SH_MenuBar_AltKeyNavigation:
case SH_MenuBar_MouseTracking:
case SH_Menu_MouseTracking:
- case SH_ComboBox_ListMouseTracking:
+ case SH_ComboBox_ListMouseTracking_Current:
case SH_Slider_StopMouseOverSlider:
case SH_MainWindow_SpaceBelowMenuBar:
ret = 1;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index fbec606ae4a..aa58ac8d75d 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -640,8 +640,10 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
if (usePopup)
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
- if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
- usePopup) {
+ if (usePopup ||
+ combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking_Current, &opt, combo) ||
+ combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking_Active, &opt, combo)
+ ) {
view->setMouseTracking(true);
}
view->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -775,10 +777,12 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
QPoint vector = widget->mapToGlobal(m->position().toPoint()) - initialClickPosition;
if (vector.manhattanLength() > 9 && blockMouseReleaseTimer.isActive())
blockMouseReleaseTimer.stop();
- QModelIndex indexUnderMouse = view->indexAt(m->position().toPoint());
- if (indexUnderMouse.isValid()
- && !QComboBoxDelegate::isSeparator(indexUnderMouse)) {
- view->setCurrentIndex(indexUnderMouse);
+ if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking_Current, nullptr, combo)) {
+ QModelIndex indexUnderMouse = view->indexAt(m->position().toPoint());
+ if (indexUnderMouse.isValid()
+ && !QComboBoxDelegate::isSeparator(indexUnderMouse)) {
+ view->setCurrentIndex(indexUnderMouse);
+ }
}
}
break;
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index f5d92094f54..c1ce675d75a 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3327,7 +3327,8 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
{
int delta = 0;
const auto dockPosition = static_cast<QInternal::DockPosition>(separator.last());
- const bool isHorizontal = dockPosition == QInternal::LeftDock || dockPosition == QInternal::TopDock;
+ const bool isHorizontal =
+ dockPosition == QInternal::LeftDock || dockPosition == QInternal::RightDock;
const bool isLeftOrTop = dockPosition == QInternal::LeftDock || dockPosition == QInternal::TopDock;
const bool separatorIsWithinDock = separator.size() > 1;
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 87c33932a8d..a1a4cfc2ce0 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -2673,8 +2673,10 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
#if QT_CONFIG(tabbar)
const auto usedTabBarsCopy = usedTabBars; // list potentially modified by animations
- for (QTabBar *tab_bar : usedTabBarsCopy)
- tab_bar->show();
+ for (QTabBar *tab_bar : usedTabBarsCopy) {
+ if (usedTabBars.contains(tab_bar)) // Showing a tab bar can cause another to be deleted.
+ tab_bar->show();
+ }
#endif // QT_CONFIG(tabbar)
#endif // QT_CONFIG(dockwidget)
}
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 431faf9e24d..92ccfe7db9d 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -126,8 +126,8 @@ using namespace Qt::StringLiterals;
ScrollBar inherits a comprehensive set of signals from QAbstractSlider:
\list
\li \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the
- scroll bar's value has changed. The tracking() determines whether this
- signal is emitted during user interaction.
+ scroll bar's value has changed. The \l{QAbstractSlider::}{tracking} property
+ determines whether this signal is emitted during user interaction.
\li \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the
scroll bar's range of values has changed.
\li \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when
@@ -382,7 +382,7 @@ QMenu *QScrollBar::createStandardContextMenu(QPoint position)
{
#if QT_CONFIG(menu)
const bool horiz = HORIZONTAL;
- QMenu *menu = new QMenu();
+ QMenu *menu = new QMenu(this);
menu->setObjectName("qt_scrollbar_menu"_L1);
if (window() && window()->windowHandle()) {
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 54c21b60387..0d7227eb038 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -564,19 +564,19 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const
{
switch (dockPos) {
case QInternal::LeftDock:
- if (pos.y() < rect.bottom())
+ if (pos.y() > 0 && pos.y() < rect.bottom())
return pos.x() - rect.right();
break;
case QInternal::RightDock:
- if (pos.y() < rect.bottom())
+ if (pos.y() > 0 && pos.y() < rect.bottom())
return rect.left() - pos.x();
break;
case QInternal::TopDock:
- if (pos.x() < rect.right())
+ if (pos.x() > 0 && pos.x() < rect.right())
return pos.y() - rect.bottom();
break;
case QInternal::BottomDock:
- if (pos.x() < rect.right())
+ if (pos.x() > 0 && pos.x() < rect.right())
return rect.top() - pos.y();
break;