lena_pi/LenaPi/NavigationListDelegate.qml
2021-03-13 16:38:12 +01:00

38 lines
890 B
QML

import QtQuick 2.11
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
/**
* @brief Delegate of navigation list.
*
* The delegate is either a circle or a rectangle containing an image.
*/
ItemDelegate{
id: container
property bool isCircleDelegate: true
property alias imageSource: contentImage.source
padding: 5
background: Rectangle{
id: background
implicitWidth: 150
implicitHeight: implicitWidth
radius: container.isCircleDelegate ? height/2 : 0
color: "blue"
Image{
id: contentImage
source: "qrc:/default_image"
anchors.fill: parent
anchors.margins: 5
fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: OpacityMask{
maskSource: background
}
}
}
}