Unsolved QtQuick.Controls.ScrollBar handle's customization based on mouse state, how?
-
Hello, all.
Target: make the handle e.g. the
contentItem
of the QtQuick Controls'ScrollBar
look different when being hovered, pressed, enabled and disabled. The guidelines for theScrollBar
's customization mention unexistingScrollBar
's sub-elements such ashandle
where the latter is actually theControl
class'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
handle
belonging to theScrollBar
's class. Again thehandle
sub-element is mentioned in the documentation of the QtQuick's so-called "Imagine Style". Looking at the "Element Reference" section about QtQuick'sScrollBar
the list of elements again mentionshandle
andbackground
as well. The latter is made available not by theScrollBar
class but again by its parent -Control
's one. As the "Imagine Style"'s documentation states both thebackground
andhandle
(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 theScrollBar
official 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.