2016-11-21 73 views
1

我在找不使用QML的滑塊實例。只是通過使用rectabgle,但我真的不知道如何處理它?不使用QML的自定義滑塊?

的QML一個不要有那麼多的特性:

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

感謝,

+0

一個很好的[示例](https://jryannel.wordpress.com/2010/02/09/滑塊組件/)。 – Tarod

回答

2

我發現答案通過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

+0

請將您的帖子標記爲答案 – folibis

+0

好的folibis,我可以標記在兩天內接受我自己的答案。謝謝 –