QtQuick.Controls.ScrollBar handle's customization based on mouse state, how?
-
Hello, all.
Target: make the handle e.g. the
contentItemof the QtQuick Controls'ScrollBarlook different when being hovered, pressed, enabled and disabled. The guidelines for theScrollBar's customization mention unexistingScrollBar's sub-elements such ashandlewhere the latter is actually theControlclass'contentItem. Here is an excerpt from the official sample customization code:handle: Rectangle { id: handle implicitWidth: 6 implicitHeight: 6 radius: width / 2 // ...There's no such sub-element
handlebelonging to theScrollBar's class. Again thehandlesub-element is mentioned in the documentation of the QtQuick's so-called "Imagine Style". Looking at the "Element Reference" section about QtQuick'sScrollBarthe list of elements again mentionshandleandbackgroundas well. The latter is made available not by theScrollBarclass but again by its parent -Control's one. As the "Imagine Style"'s documentation states both thebackgroundandhandle(e.g.contentItem) should have all the mouse states separately. Thing is that I failed catching only those of the scroll bar's handle as stated by theScrollBarofficial customization example (see comments):handle: Rectangle { // as mentioned there's no "handle" property id: handle // ... radius: width / 2 color: control.pressed ? "#28282a" : "#bdbebf" // ... states: State { name: "active" when: control.active // there's no "control" property (attached or not) PropertyChanges { target: handle; opacity: 0.75 } } transitions: Transition { from: "active" SequentialAnimation { PauseAnimation { duration: 450 } NumberAnimation { target: handle; duration: 200; property: "opacity"; to: 0.0 } } } }I've customized the handle based on the
ScrollBar's mouse status but I want handle's customization based on handle's such such as changing color of the handle only upon hovering the handle not due to hovering over the rest of the scroll bar as well.