feat(StatusInput): exposed letterIconName property (#671)

Exposed letterIconName to be set in StatusLetterIdenticon

Needed for: https://github.com/status-im/status-desktop/issues/5636
This commit is contained in:
Alexandra Betouni 2022-05-13 13:38:49 +03:00 committed by GitHub
parent 6c5957a492
commit 02923f7947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -240,6 +240,11 @@ Item {
}
}
/*!
\qmlproperty string StatusBaseInput::letterIconName
This property holds the letter that should be displayed in the letter identicon component.
*/
property string letterIconName: ""
/*!
\qmlproperty Component StatusBaseInput::leftComponent
This property sets the left component to be displayed inside the input.
@ -327,7 +332,7 @@ Item {
sourceComponent: {
if (root.leftComponent) return root.leftComponent
if (!root.leftIcon) return undefined
if (root.icon.emoji) return identiconComponent
if (root.icon.emoji || root.icon.isLetterIdenticon) return identiconComponent
if (root.icon.name) return isIconSelectable ? identiconComponent : iconComponent
return undefined
}
@ -479,13 +484,15 @@ Item {
StatusSmartIdenticon {
id: identicon
icon.width: !root.icon.emoji ? 20 : 24
icon.height: !root.icon.emoji ? 20 : 24
icon.width: 24
icon.height: 24
icon.background: root.icon.background
icon.color: root.icon.color
icon.letterSize: root.icon.letterSize
icon.emoji: root.icon.emoji
icon.name: !root.icon.emoji ? root.icon.name : ""
icon.isLetterIdenticon: root.icon.isLetterIdenticon
name: root.letterIconName
MouseArea {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor

View File

@ -51,6 +51,13 @@ Item {
This property holds a reference to the TextEdit component.
*/
property alias input: statusBaseInput
/*!
\qmlproperty string StatusInput::letterIconName
This property holds a reference to the StatusBaseInput's letterIconName property.
*/
property alias letterIconName: statusBaseInput.letterIconName
/*!
\qmlproperty alias StatusInput::valid
This property holds a reference to the TextEdit's valid property.

View File

@ -0,0 +1,6 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 18.5C14.6944 18.5 18.5 14.6944 18.5 10C18.5 5.30558 14.6944 1.5 10 1.5C5.30558 1.5 1.5 5.30558 1.5 10C1.5 14.6944 5.30558 18.5 10 18.5ZM10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20Z" fill="#4360DF"/>
<path d="M7.56858 13.1746C7.22903 12.9373 6.75712 12.9308 6.46422 13.2237C6.17133 13.5166 6.16876 13.996 6.49708 14.2485C7.46695 14.9946 8.68155 15.4381 9.99976 15.4381C11.318 15.4381 12.5326 14.9946 13.5024 14.2485C13.8308 13.996 13.8282 13.5166 13.5353 13.2237C13.2424 12.9308 12.7705 12.9373 12.4309 13.1746C11.742 13.6558 10.9039 13.9381 9.99976 13.9381C9.09565 13.9381 8.25747 13.6558 7.56858 13.1746Z" fill="#4360DF"/>
<path d="M15 8.5C15 9.32843 14.3284 10 13.5 10C12.6716 10 12 9.32843 12 8.5C12 7.67157 12.6716 7 13.5 7C14.3284 7 15 7.67157 15 8.5Z" fill="#4360DF"/>
<path d="M8 8.5C8 9.32843 7.32843 10 6.5 10C5.67157 10 5 9.32843 5 8.5C5 7.67157 5.67157 7 6.5 7C7.32843 7 8 7.67157 8 8.5Z" fill="#4360DF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB