feat(StatusItemSelector): Add possibility to use letter identicons

This commit is contained in:
Michał Cieślak 2022-12-20 01:05:12 +01:00 committed by Michał
parent 80b46ce788
commit 4c4abdbea2

View File

@ -100,13 +100,23 @@ Rectangle {
an image or an icon. an image or an icon.
*/ */
property bool useIcons: false property bool useIcons: false
property StatusAssetSettings asset: StatusAssetSettings { property StatusAssetSettings asset: StatusAssetSettings {
height: 20 height: 20
width: 20 width: 20
bgColor: "transparent" bgColor: "transparent"
isImage: !root.useIcons isImage: !root.useIcons
isLetterIdenticon: root.useLetterIdenticons
} }
property int tagLeftPadding: 6 property int tagLeftPadding: 6
/*!
\qmlproperty bool StatusItemSelector::useLetterIdenticons
This property determines if letter identicons should be used. If set to
true, the model is expected to contain roles "color" and "emoji".
*/
property bool useLetterIdenticons: false
/*! /*!
\qmlsignal StatusItemSelector::itemClicked \qmlsignal StatusItemSelector::itemClicked
This signal is emitted when the item is clicked. This signal is emitted when the item is clicked.
@ -190,15 +200,20 @@ Rectangle {
} }
StatusListItemTag { StatusListItemTag {
title: model.text title: model.text
asset.name: model.imageSource
asset.isImage: root.asset.isImage
asset.bgColor: root.asset.bgColor
asset.height: root.asset.height asset.height: root.asset.height
asset.width: root.asset.width asset.width: root.asset.width
leftPadding: root.tagLeftPadding asset.name: root.useLetterIdenticons ? model.text : model.imageSource
asset.isImage: root.asset.isImage
asset.bgColor: root.asset.bgColor
asset.emoji: model.emoji ? model.emoji : ""
asset.color: model.color ? model.color : ""
asset.isLetterIdenticon: root.useLetterIdenticons
//color: Theme.palette.primaryColor3
closeButtonVisible: false closeButtonVisible: false
titleText.color: Theme.palette.primaryColor1 titleText.color: Theme.palette.primaryColor1
titleText.font.pixelSize: 15 titleText.font.pixelSize: 15
leftPadding: root.tagLeftPadding
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent