Windows11Style: don't set minimum width for QAbstractSpinBox
There is no need to set a minimum width for QAbstractSpinBox in QWindows11Style::polish() as this might override the user preferences. Also the minimum size handling is now properly done within sizeFromContents(). Change-Id: Ibc1fd7a6f862fc85e3739025b9de581aa235d74c Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io> (cherry picked from commit 2ec4c28470de115c16944653a5d4f6209452d56c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit b93a8dfdfe6900cb542fdc587dd2682007a6ac53)bb10
parent
e43f6d7087
commit
f86da3d3f8
|
|
@ -34,7 +34,6 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
static constexpr int topLevelRoundingRadius = 8; //Radius for toplevel items like popups for round corners
|
||||
static constexpr int secondLevelRoundingRadius = 4; //Radius for second level items like hovered menu item round corners
|
||||
static constexpr QLatin1StringView originalWidthProperty("_q_windows11_style_original_width");
|
||||
|
||||
enum WINUI3Color {
|
||||
subtleHighlightColor, //Subtle highlight based on alpha used for hovered elements
|
||||
|
|
@ -2162,13 +2161,6 @@ void QWindows11Style::polish(QWidget* widget)
|
|||
pal.setColor(QPalette::ButtonText, pal.text().color());
|
||||
pal.setColor(QPalette::BrightText, pal.text().color());
|
||||
widget->setPalette(pal);
|
||||
} else if (widget->inherits("QAbstractSpinBox")) {
|
||||
const int minWidth = 2 * 24 + 40;
|
||||
const int originalWidth = widget->size().width();
|
||||
if (originalWidth < minWidth) {
|
||||
widget->resize(minWidth, widget->size().height());
|
||||
widget->setProperty(originalWidthProperty.constData(), originalWidth);
|
||||
}
|
||||
} else if (widget->inherits("QAbstractButton") || widget->inherits("QToolButton")) {
|
||||
widget->setAutoFillBackground(false);
|
||||
auto pal = widget->palette();
|
||||
|
|
@ -2219,13 +2211,6 @@ void QWindows11Style::unpolish(QWidget *widget)
|
|||
scrollarea->viewport()->setPalette(pal);
|
||||
scrollarea->viewport()->setProperty("_q_original_background_palette", QVariant());
|
||||
}
|
||||
if (widget->inherits("QAbstractSpinBox")) {
|
||||
const QVariant originalWidth = widget->property(originalWidthProperty.constData());
|
||||
if (originalWidth.isValid()) {
|
||||
widget->resize(originalWidth.toInt(), widget->size().height());
|
||||
widget->setProperty(originalWidthProperty.constData(), QVariant());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue