lena_pi/LenaPi/NavigationListDelegate.qml

38 lines
976 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: StylePaddings.defaultPadding
background: Rectangle{
id: background
implicitWidth: StyleSizes.navigationDelegateDefaultSize
implicitHeight: implicitWidth
radius: container.isCircleDelegate ? height/2 : 0
color: "blue"
Image{
id: contentImage
source: "qrc:/default_image"
anchors.fill: parent
anchors.margins: StyleMargins.tinyMargin
fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: OpacityMask{
maskSource: background
}
}
}
}