Delegate highlighting to delegate item. Make sure ListView will not snap highlighted item

This commit is contained in:
vladest 2017-08-18 08:11:29 +02:00
parent f3969b0909
commit 4eba09214c
2 changed files with 12 additions and 1 deletions

View file

@ -46,6 +46,8 @@ Item {
property int stackShadowNarrowing: 5;
property string defaultThumbnail: Qt.resolvedUrl("../../images/default-domain.gif");
property int shadowHeight: 10;
property bool hovered: false
HifiConstants { id: hifi }
function pastTime(timestamp) { // Answer a descriptive string
@ -231,6 +233,13 @@ Item {
// to that which is being hovered over.
property var hoverThunk: function () { };
property var unhoverThunk: function () { };
Rectangle {
anchors.fill: parent;
visible: root.hovered
color: "transparent";
border.width: 4; border.color: hifiStyleConstants.colors.primaryHighlight;
z: 1;
}
MouseArea {
anchors.fill: parent;
acceptedButtons: Qt.LeftButton;

View file

@ -206,9 +206,9 @@ Column {
id: scroll;
model: suggestions;
orientation: ListView.Horizontal;
highlightFollowsCurrentItem: false
highlightMoveDuration: -1;
highlightMoveVelocity: -1;
highlight: Rectangle { color: "transparent"; border.width: 4; border.color: hifiStyleConstants.colors.primaryHighlight; z: 1; }
currentIndex: -1;
spacing: 12;
@ -237,6 +237,8 @@ Column {
textSizeSmall: root.textSizeSmall;
stackShadowNarrowing: root.stackShadowNarrowing;
shadowHeight: root.stackedCardShadowHeight;
hoverThunk: function () { hovered = true }
unhoverThunk: function () { hovered = false }
}
}
NumberAnimation {