aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle/controls/DefaultProgressBar.qml
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-09-16 14:56:39 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-09-17 14:14:52 +0200
commite5827955cfae9928d4d0213b7db51f72fd765562 (patch)
treef850ef613b0304a72ad9e84fad803689b74e353b /src/imports/nativestyle/controls/DefaultProgressBar.qml
parentae6132cb20584357fb342ef51f15523e53b7532a (diff)
Native style: implement implicit minimum size
QStyle doesn't calculate a sensible minimum implicit size for us, only a implicit size that matches the size of the contents. This means that if the contents is empty (e.g a TextField that has no text), the implicit size will typically be smaller than what a sensible minimum should be. Note that for widgets, a sensible preffered size is set from the widgets themselves, and not QStyle. Which explains why the sizes we get from QStyle can sometimes be too small. Therefore, add a sensible minimum implicit size to all the controls that suffers from this problem. We let QStyle continue to calculate the actual minimum size given the contents as before (which will end up as the StyleItem's implicit size), and instead fix the recommended minimum size directly in the QML style files. Change-Id: Ic4097776e40d0de64312e4099d7fe4c7fc1ca9d1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/nativestyle/controls/DefaultProgressBar.qml')
-rw-r--r--src/imports/nativestyle/controls/DefaultProgressBar.qml6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/imports/nativestyle/controls/DefaultProgressBar.qml b/src/imports/nativestyle/controls/DefaultProgressBar.qml
index 0bf23ec4..80b0b94a 100644
--- a/src/imports/nativestyle/controls/DefaultProgressBar.qml
+++ b/src/imports/nativestyle/controls/DefaultProgressBar.qml
@@ -45,9 +45,11 @@ T.ProgressBar {
readonly property bool nativeBackground: background instanceof NativeStyle.StyleItem
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
- implicitContentWidth + leftPadding + rightPadding)
+ implicitContentWidth + leftPadding + rightPadding,
+ control.horizontal ? 90 : 0 /* minimum */ )
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
- implicitContentHeight + topPadding + bottomPadding)
+ implicitContentHeight + topPadding + bottomPadding,
+ control.vertical ? 90 : 0 /* minimum */ )
font.pixelSize: nativeIndicator ? indicator.styleFont(control).pixelSize : undefined