qml有自己运行的而一套机制,了解清楚了他的运行机制,在进行qml组件的灵活应用
比如自定义水平滚动条和垂直滚动条,大致了解了机制之后可以灵活运用qml组件进行相应的组合等灵活运用
了解清楚了机制之后,根据需要进行qml组件的组装
有的时候在设置qml组件的style的时候,不会响应鼠标事件,
这可能和qml内部机制有关,qml内部机制可能使用的是styleData.hover
而不是hover,所以应该这样用
handle: Rectangle {
color: "transparent"
implicitHeight: 17
implicitWidth: 17
anchors.centerIn: parent
Button {
id: button
implicitHeight: parent.height - 4
implicitWidth: parent.width - 4
property var hovered: styleData.hovered;
property var pressed: styleData.pressed;
anchors.centerIn: parent
style: ButtonStyle {
background: Rectangle {
color: button.pressed ? "#787878" : button.hovered ?