From 058e3946dfbef24309515d27c985048866b69fc9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 12 Jun 2016 22:36:41 +0200 Subject: Sliders: fix implicit size calculations Background size was in the bindings twice: once without and once with paddings. Change-Id: I863d1fe29f1d79017bad410b31f961e4d1238e3b Reviewed-by: Mitch Curtis --- src/imports/controls/RangeSlider.qml | 10 ++++------ src/imports/controls/Slider.qml | 6 ++---- src/imports/controls/material/RangeSlider.qml | 10 ++++------ src/imports/controls/material/Slider.qml | 6 ++---- src/imports/controls/universal/RangeSlider.qml | 10 ++++------ src/imports/controls/universal/Slider.qml | 6 ++---- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index 8d285298..7353e2b5 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -41,13 +41,11 @@ T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(background ? background.implicitWidth : 0, - first.handle ? first.handle.implicitWidth : 0, - second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) + Math.max(first.handle ? first.handle.implicitWidth : 0, + second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(background ? background.implicitHeight : 0, - first.handle ? first.handle.implicitHeight : 0, - second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) + Math.max(first.handle ? first.handle.implicitHeight : 0, + second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml index a44a6c80..896dbca0 100644 --- a/src/imports/controls/Slider.qml +++ b/src/imports/controls/Slider.qml @@ -41,11 +41,9 @@ T.Slider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(background ? background.implicitWidth : 0, - handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) + (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(background ? background.implicitHeight : 0, - handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) + (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml index f103fb27..acad1f6d 100644 --- a/src/imports/controls/material/RangeSlider.qml +++ b/src/imports/controls/material/RangeSlider.qml @@ -43,13 +43,11 @@ T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(background ? background.implicitWidth : 0, - first.handle ? first.handle.implicitWidth : 0, - second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) + Math.max(first.handle ? first.handle.implicitWidth : 0, + second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(background ? background.implicitHeight : 0, - first.handle ? first.handle.implicitHeight : 0, - second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) + Math.max(first.handle ? first.handle.implicitHeight : 0, + second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml index a473db37..aa85f229 100644 --- a/src/imports/controls/material/Slider.qml +++ b/src/imports/controls/material/Slider.qml @@ -43,11 +43,9 @@ T.Slider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(background ? background.implicitWidth : 0, - handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) + (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(background ? background.implicitHeight : 0, - handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) + (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml index fd220521..ec2ff7c8 100644 --- a/src/imports/controls/universal/RangeSlider.qml +++ b/src/imports/controls/universal/RangeSlider.qml @@ -42,13 +42,11 @@ T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(background ? background.implicitWidth : 0, - first.handle ? first.handle.implicitWidth : 0, - second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) + Math.max(first.handle ? first.handle.implicitWidth : 0, + second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(background ? background.implicitHeight : 0, - first.handle ? first.handle.implicitHeight : 0, - second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) + Math.max(first.handle ? first.handle.implicitHeight : 0, + second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml index 5aa336ee..baf91211 100644 --- a/src/imports/controls/universal/Slider.qml +++ b/src/imports/controls/universal/Slider.qml @@ -42,11 +42,9 @@ T.Slider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(background ? background.implicitWidth : 0, - handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) + (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(background ? background.implicitHeight : 0, - handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) + (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 -- cgit v1.2.3