【问题标题】:custom Slider without using the QML one?不使用 QML 的自定义滑块?
【发布时间】:2017-04-04 14:01:23
【问题描述】:

我正在寻找不使用 QML 的滑块示例。只是使用rectabgle,但我真的不知道如何处理它?

QML 没有那么多属性:

Slider {
        id: sliderHorizontal1
        x: 69
        y: 52
        activeFocusOnPress: true
        tickmarksEnabled: true
        minimumValue: 0
    }

谢谢,

【问题讨论】:

标签: qt qml


【解决方案1】:

我通过使用 QML 滑块找到了答案。

Slider {
        id: slider
        x: 56
        y: 53
        width: 450
        height: 30
        tickmarksEnabled: true
        activeFocusOnPress: true
        updateValueWhileDragging: true
        value: 10
        maximumValue: 30

        style: SliderStyle {
            handle: Rectangle {
                height: 40
                width: height
                radius: width/2
                color: "#fff"
            }

            groove: Rectangle {
                implicitHeight: 10
                implicitWidth: 100
                radius: height/2
                border.color: "#333"
                color: "#222"
                Rectangle {
                    height: parent.height
                    width: styleData.handlePosition
                    implicitHeight: 6
                    implicitWidth: 100
                    radius: height/2
                    color: "red"
                }
            }

        }
    }

我可以添加修改以满足我的需要... 谢谢@Tarod

【讨论】:

  • 将您的帖子标记为答案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-04-05
  • 2020-06-22
  • 1970-01-01
  • 1970-01-01
  • 2016-01-28
  • 2020-01-23
  • 1970-01-01
相关资源
最近更新 更多