ItemDelegate for NavigationListDelegate

This commit is contained in:
Anika Raemer 2021-03-13 16:22:47 +01:00
parent ef525a5ffb
commit f2fd2e880a
4 changed files with 35 additions and 28 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
build-LenaPi-Desktop-Debug build-LenaPi-Desktop-Debug
build-LenaPi-RasPi-Debug build-LenaPi-RasPi-Debug
build-LenaPi-RasPi-Release build-LenaPi-RasPi-Release
LenaPi/LenaPi.pro.user.4.8-pre1

View file

@ -1,5 +1,8 @@
import QtQuick 2.0 import QtQuick 2.0
/**
* @brief Navigation view containing list view displaying artists or genres and albums
*/
Item { Item {
RoundButton{ RoundButton{
id: back id: back
@ -11,7 +14,7 @@ Item {
visible: navigationList.pIsBackVisible visible: navigationList.pIsBackVisible
onClicked: navigationList.navigateBack(); onClicked: navigationList.navigateBack();
} } // RoundButton: navigate back
Rectangle{ Rectangle{
anchors.left: parent.left anchors.left: parent.left
@ -38,8 +41,9 @@ Item {
NavigationListDelegate{ NavigationListDelegate{
id: delegate id: delegate
height: parent.height height: parent.height
width: height
model: navigationList.pModelItems[index] model: navigationList.pModelItems[index]
} } // NavigationListDelegate
} } // ListView
} } // Rectangle: List background
} } // Item

View file

@ -1,34 +1,36 @@
import QtQuick 2.0 import QtQuick 2.11
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
Rectangle{ ItemDelegate{
id: container id: container
property var model property var model
property alias imageSource: contentImage.source property alias imageSource: contentImage.source
width: height
height: 150
radius: model.pIsCircleDelegate ? height/2 : 0
color: "blue"
Image{ padding: 5
id: contentImage onClicked:{
source: model ? model.pImageSource : "qrc:/default_image" model.onClicked();
anchors.centerIn: parent
width: parent.width-10
height: width
fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: OpacityMask{
maskSource: container
}
} }
MouseArea{
id: controlObject background: Rectangle{
anchors.fill: parent id: background
onClicked:{ implicitWidth: 150
model.onClicked(); implicitHeight: implicitWidth
radius: model.pIsCircleDelegate ? height/2 : 0
color: "blue"
Image{
id: contentImage
source: model ? model.pImageSource : "qrc:/default_image"
anchors.fill: parent
anchors.margins: 5
fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: OpacityMask{
maskSource: background
}
} }
} }
} }

View file

@ -6,7 +6,7 @@ Window {
visible: true visible: true
width: 800 width: 800
height: 480 height: 480
title: "LenaPi 1.1 - beta" title: "LenaPi 1.2"
Image{ Image{
id: background id: background