moment/src/qml/Base/HTileDelegate.qml

44 lines
1.0 KiB
QML
Raw Normal View History

import QtQuick 2.12
import QtQuick.Layouts 1.12
HTile {
id: tile
onActivated: view.currentIndex = model.index
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.LeftButton
onTapped: {
view.highlightRangeMode = ListView.NoHighlightRange
view.highlightMoveDuration = 0
activated()
view.highlightRangeMode = ListView.ApplyRange
view.highlightMoveDuration = theme.animationDuration
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: if (contextMenu.count > 0) contextMenu.popup()
}
}