summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockwidget.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-10-31 18:52:30 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-04 11:00:04 +0100
commit04f4b27774ba70ebba425394fa8a1ffdffb2483b (patch)
treea1bc5376a64d01035db9b11b182965ba84eea532 /src/widgets/widgets/qdockwidget.cpp
parent91fe6fb2e14f295c0020eb5e7f33444dfddbd7dd (diff)
QDockWidget: fix dock buttons size
The size of the dock buttons did not account the SH_DockWidget_ButtonsHaveFrame style hint and therefore was too large when a full 16x16 icon was used (which was the case after the latest style cleanups) and therefore appeared too large. This also allows the remove of the hack for the windows style. The windows vista/11 style is not even affected by this hack because there the size comes from windows itself and can not be modified via PM_SmallIconSize. Fixes: QTBUG-118643 Task-number: QTBUG-118122 Change-Id: Ie09a6a4e89df66b5393c5a57735002da47415c0e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/widgets/widgets/qdockwidget.cpp')
-rw-r--r--src/widgets/widgets/qdockwidget.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 23d16dd6d7..2ba0c821d4 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -128,33 +128,12 @@ bool QDockWidgetTitleButton::event(QEvent *event)
return QAbstractButton::event(event);
}
-static inline bool isWindowsStyle(const QStyle *style)
-{
- // Note: QStyleSheetStyle inherits QWindowsStyle
- const QStyle *effectiveStyle = style;
-
-#if QT_CONFIG(style_stylesheet)
- if (style->inherits("QStyleSheetStyle"))
- effectiveStyle = static_cast<const QStyleSheetStyle *>(style)->baseStyle();
-#endif
-#if !defined(QT_NO_STYLE_PROXY)
- if (style->inherits("QProxyStyle"))
- effectiveStyle = static_cast<const QProxyStyle *>(style)->baseStyle();
-#endif
-
- return effectiveStyle->inherits("QWindowsStyle");
-}
-
QSize QDockWidgetTitleButton::dockButtonIconSize() const
{
if (m_iconSize < 0) {
m_iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
- // Dock Widget title buttons on Windows where historically limited to size 10
- // (from small icon size 16) since only a 10x10 XPM was provided.
- // Adding larger pixmaps to the icons thus caused the icons to grow; limit
- // this to qpiScaled(10) here.
- if (isWindowsStyle(style()))
- m_iconSize = qMin((10 * logicalDpiX()) / 96, m_iconSize);
+ if (style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, nullptr, this))
+ m_iconSize = (m_iconSize * 3) / 4;
}
return QSize(m_iconSize, m_iconSize);
}