aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols
diff options
context:
space:
mode:
authorVladimir Belyavsky <belyavskyv@gmail.com>2024-04-05 21:05:31 +0300
committerVladimir Belyavsky <belyavskyv@gmail.com>2024-04-08 20:06:26 +0000
commit5ffe6709e88956edce1f6726f790c8bc91f33f94 (patch)
treec4d4e3d7515bfcc67a7540c754fed38d37e6bc28 /src/quickcontrols
parent5f8332db7d5d514e58d063f0fbcb58c0f754c838 (diff)
Imagine: fix warnings in Slider in case of null handle
Fix warnings, such as "TypeError: Cannot read property 'width' of null" in case when the handle is null Fixes: QTBUG-119633 Pick-to: 6.7 Change-Id: Idc3f759ce7983cf37bee5e633d9d83eb4180ac56 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols')
-rw-r--r--src/quickcontrols/imagine/Slider.qml9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/quickcontrols/imagine/Slider.qml b/src/quickcontrols/imagine/Slider.qml
index 01b5899fcb..8176abcd78 100644
--- a/src/quickcontrols/imagine/Slider.qml
+++ b/src/quickcontrols/imagine/Slider.qml
@@ -59,15 +59,18 @@ T.Slider {
}
NinePatchImage {
+ readonly property real handleWidth: control.handle ? control.handle.width : 0
+ readonly property real handleHeight: control.handle ? control.handle.height : 0
+
x: control.horizontal ? 0 : (parent.width - width) / 2
y: control.horizontal
? (parent.height - height) / 2
- : control.handle.height / 2 + control.visualPosition * (parent.height - control.handle.height)
+ : handleHeight / 2 + control.visualPosition * (parent.height - handleHeight)
width: control.horizontal
- ? control.handle.width / 2 + control.position * (parent.width - control.handle.width)
+ ? handleWidth / 2 + control.position * (parent.width - handleWidth)
: parent.width
height: control.vertical
- ? control.handle.height / 2 + control.position * (parent.height - control.handle.height)
+ ? handleHeight / 2 + control.position * (parent.height - handleHeight)
: parent.height
source: control.Imagine.url + "slider-progress"