0

I am trying to customize Slider QML Component but getting error for style property.
I want to make the slider handle smaller and also change some colors and so on, so I am trying to modify the style.
I found different behavior with multiple versions of the QtQuick.Controls.

import QtQuick 2.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 1.4

Rectangle {
    property int slideFrom: 0
    property int slideTo: 10
    property int slideStep: 1
    property int slideValue: 0

    Slider {
        width: 100
        height: 50

        snapMode: Slider.SnapAlways
        from: parent.slideFrom
        to: parent.slideTo
        stepSize: parent.slideStep
        value: parent.slideValue

        style: SliderStyle {

        }

    }
}

If I import QtQuick.Controls 2.14
I get Error for style property as "Invalid property name style".

If I import QtQuick.Controls 1.4
I get error for snapMode, from and to as "Invalid property name".

I want both the properties and I see issue with imports.
I have no idea if we don't have to, from and stepSize in older version how we can manage the slide or is there some different way of using it?

User7723337
  • 11,857
  • 27
  • 101
  • 182
  • 1
    As you want the `snapMode` .. you need to import `QtQuick.Controls 2.14` .. then style the controls2 control – Mohammad Kanan May 24 '20 at 17:30
  • Thanks, how do I change the size of the handle is there any direct properties available to change the handle size? I am not able to find any. – User7723337 May 24 '20 at 17:35
  • 1
    should be simple once you familiarize .. like this `handle: Rectangle { implicitWidth: 34 implicitHeight: 34 radius: 12 }` – Mohammad Kanan May 24 '20 at 19:30

0 Answers0