I want to customize highlight color in ItemDelegate
. If I use default ItemDelegate
with Material theme then all ok and color change when i hover over this item, but when I redefine background it breaks down and colors not change anymore.
MyItemDelegate.qml:
import QtQuick 2.11
import QtQuick.Controls.Material 2.4
import QtQuick.Controls 2.4
import QtQuick.Templates 2.4 as T
T.ItemDelegate {
id: myItemDelegate
height: 40
anchors.left: parent.left
anchors.right: parent.right
contentItem: Text {
text: "Hello"
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
background: Rectangle {
anchors.fill: myItemDelegate
color: myItemDelegate.highlighted ? "blue" : "transparent"
}
}
Why highlighted
property not work? And how I can customize this color?