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

View file

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