moment/src/qml/Base/HTileDelegate.qml

40 lines
978 B
QML
Raw Normal View History

import QtQuick 2.12
import QtQuick.Layouts 1.12
HTile {
id: tile
onActivated: view.currentIndex = model.index
2019-09-15 07:39:17 +10:00
onClicked: {
view.highlightRangeMode = ListView.NoHighlightRange
view.highlightMoveDuration = 0
activated()
view.highlightRangeMode = ListView.ApplyRange
view.highlightMoveDuration = theme.animationDuration
}
signal activated()
property HListView view: ListView.view
property bool shouldBeCurrent: false
readonly property QtObject delegateModel: model
readonly property alias setCurrentTimer: setCurrentTimer
Timer {
id: setCurrentTimer
interval: 100
repeat: true
running: true
// Component.onCompleted won't work for this
onTriggered: if (shouldBeCurrent) view.currentIndex = model.index
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: if (contextMenu.count > 0) contextMenu.popup()
}
}