diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-26 09:13:31 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-26 17:25:57 +0200 |
commit | a824bca18ec356d322e551b8a01b7b0e051ba1aa (patch) | |
tree | 0caea69d8009ed7c34cde4f21848f8723abea615 | |
parent | 64651d862af266f0c39b60eec44e21aa52668f92 (diff) | |
download | qttools-a824bca18ec356d322e551b8a01b7b0e051ba1aa.tar.gz |
Qt Designer: Slow down wheel scrolling of the widget box
Determine the single step of the vertical scroll bar by
the item height.
Pick-to: 6.1 5.15
Fixes: QTBUG-93099
Change-Id: Ib04200131a64abb7beecd28bfa73433d6c20e9bf
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 7b2ffbc9697bab43a68efd12a2c58e5f5781bf21)
-rw-r--r-- | src/designer/src/components/widgetbox/widgetboxtreewidget.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp index fa32ad279..da4656217 100644 --- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp +++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp @@ -50,6 +50,7 @@ #include <QtWidgets/qaction.h> #include <QtWidgets/qactiongroup.h> #include <QtWidgets/qmenu.h> +#include <QtWidgets/qscrollbar.h> #include <QtCore/qfile.h> #include <QtCore/qtimer.h> @@ -303,7 +304,15 @@ bool WidgetBoxTreeWidget::load(QDesignerWidgetBox::LoadMode loadMode) return false; const QString contents = QString::fromUtf8(f.readAll()); - return loadContents(contents); + if (!loadContents(contents)) + return false; + if (topLevelItemCount() > 0) { + // QTBUG-93099: Set the single step to the item height to have some + // size-related value. + const auto itemHeight = visualItemRect(topLevelItem(0)).height(); + verticalScrollBar()->setSingleStep(itemHeight); + } + return true; } bool WidgetBoxTreeWidget::loadContents(const QString &contents) |