From 549df2cbe2ee7c002e0fd29c2e6cafa30d232c9f Mon Sep 17 00:00:00 2001 From: Mikhail Shashin Date: Fri, 28 Nov 2025 01:00:21 +0300 Subject: [PATCH] Adjust button size to match parent TitleBar height Updated the Button::sizeHint() method to use the height of the parent TitleBar as the button size, defaulting to 24 if unavailable. This change ensures button sizing is consistent with the TitleBar's height. --- .../Libs/kddockwidgets/qtwidgets/views/TitleBar.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/AdaptixClient/Libs/kddockwidgets/qtwidgets/views/TitleBar.cpp b/AdaptixClient/Libs/kddockwidgets/qtwidgets/views/TitleBar.cpp index ddb91d5e..2b95d162 100644 --- a/AdaptixClient/Libs/kddockwidgets/qtwidgets/views/TitleBar.cpp +++ b/AdaptixClient/Libs/kddockwidgets/qtwidgets/views/TitleBar.cpp @@ -95,13 +95,10 @@ void Button::paintEvent(QPaintEvent *) QSize Button::sizeHint() const { - // Pass an opt so it scales against the logical dpi of the correct screen (since Qt 5.14) even - // if the HDPI Qt::AA_ attributes are off. - QStyleOption opt; - opt.initFrom(this); - - const int m = style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, this); - return QSize(m, m); + // Используем высоту родителя (TitleBar) для размера кнопки + int h = parentWidget() ? parentWidget()->height() : 24; + if (h <= 0) h = 24; + return QSize(h, h); } bool Button::event(QEvent *ev)