2022-06-03 11:26:02 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2018-06-26 13:53:07 +00:00
|
|
|
|
2020-11-02 14:38:47 +00:00
|
|
|
import QtQuick
|
2018-06-26 13:53:07 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: delegate
|
|
|
|
|
2024-07-08 16:46:43 +00:00
|
|
|
required property real itemSize
|
|
|
|
required property string name
|
|
|
|
required property string feed
|
|
|
|
required property string image
|
|
|
|
required property int index
|
|
|
|
required property bool isLoading
|
|
|
|
|
2018-06-26 13:53:07 +00:00
|
|
|
property bool selected: ListView.isCurrentItem
|
2024-07-08 16:46:43 +00:00
|
|
|
|
2018-06-26 13:53:07 +00:00
|
|
|
width: itemSize
|
|
|
|
height: itemSize
|
|
|
|
|
|
|
|
Image {
|
|
|
|
anchors.centerIn: parent
|
2024-07-08 16:46:43 +00:00
|
|
|
source: delegate.image
|
2018-06-26 13:53:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: titleText
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
left: parent.left; leftMargin: 20
|
|
|
|
right: parent.right; rightMargin: 20
|
|
|
|
top: parent.top; topMargin: 20
|
|
|
|
}
|
|
|
|
|
|
|
|
font { pixelSize: 18; bold: true }
|
2024-07-08 16:46:43 +00:00
|
|
|
text: delegate.name
|
|
|
|
color: delegate.selected ? "#ffffff" : "#ebebdd"
|
|
|
|
scale: delegate.selected ? 1.15 : 1.0
|
2018-06-26 13:53:07 +00:00
|
|
|
Behavior on color { ColorAnimation { duration: 150 } }
|
|
|
|
Behavior on scale { PropertyAnimation { duration: 300 } }
|
|
|
|
}
|
|
|
|
|
|
|
|
BusyIndicator {
|
|
|
|
scale: 0.8
|
2024-07-08 16:46:43 +00:00
|
|
|
visible: delegate.ListView.isCurrentItem && delegate.isLoading
|
2018-06-26 13:53:07 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: delegate
|
|
|
|
onClicked: {
|
2024-07-08 16:46:43 +00:00
|
|
|
delegate.ListView.view.currentIndex = delegate.index
|
|
|
|
delegate.clicked()
|
2018-06-26 13:53:07 +00:00
|
|
|
}
|
|
|
|
}
|
2024-07-08 16:46:43 +00:00
|
|
|
signal clicked()
|
2018-06-26 13:53:07 +00:00
|
|
|
}
|