Fix warnings in EmojiPicker
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
|
// SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
@@ -127,7 +129,7 @@ ColumnLayout {
|
|||||||
header: categories
|
header: categories
|
||||||
Keys.forwardTo: searchField
|
Keys.forwardTo: searchField
|
||||||
stickers: root.selectedType === 1
|
stickers: root.selectedType === 1
|
||||||
onStickerChosen: stickerModel.postSticker(emoticonFilterModel.mapToSource(emoticonFilterModel.index(index, 0)).row)
|
onStickerChosen: index => stickerModel.postSticker(emoticonFilterModel.mapToSource(emoticonFilterModel.index(index, 0)).row)
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Separator {
|
Kirigami.Separator {
|
||||||
@@ -149,6 +151,7 @@ ColumnLayout {
|
|||||||
model: ["👍", "👎", "😄", "🎉", "😕", "❤", "🚀", "👀"]
|
model: ["👍", "👎", "😄", "🎉", "😕", "❤", "🚀", "👀"]
|
||||||
|
|
||||||
delegate: EmojiDelegate {
|
delegate: EmojiDelegate {
|
||||||
|
required property string modelData
|
||||||
emoji: modelData
|
emoji: modelData
|
||||||
|
|
||||||
height: root.categoryIconSize
|
height: root.categoryIconSize
|
||||||
@@ -184,11 +187,14 @@ ColumnLayout {
|
|||||||
Component {
|
Component {
|
||||||
id: emojiDelegate
|
id: emojiDelegate
|
||||||
Kirigami.NavigationTabButton {
|
Kirigami.NavigationTabButton {
|
||||||
|
required property string emoji
|
||||||
|
required property int index
|
||||||
|
required property string name
|
||||||
width: root.categoryIconSize
|
width: root.categoryIconSize
|
||||||
height: width
|
height: width
|
||||||
checked: categories.currentIndex === model.index
|
checked: categories.currentIndex === index
|
||||||
text: modelData ? modelData.emoji : ""
|
text: emoji
|
||||||
QQC2.ToolTip.text: modelData ? modelData.name : ""
|
QQC2.ToolTip.text: name
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
QQC2.ToolTip.visible: hovered
|
QQC2.ToolTip.visible: hovered
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@@ -201,21 +207,25 @@ ColumnLayout {
|
|||||||
Component {
|
Component {
|
||||||
id: stickerDelegate
|
id: stickerDelegate
|
||||||
Kirigami.NavigationTabButton {
|
Kirigami.NavigationTabButton {
|
||||||
|
id: sticker
|
||||||
|
required property string name
|
||||||
|
required property int index
|
||||||
|
required property string emoji
|
||||||
width: root.categoryIconSize
|
width: root.categoryIconSize
|
||||||
height: width
|
height: width
|
||||||
checked: stickerModel.packIndex === model.index
|
checked: stickerModel.packIndex === index
|
||||||
padding: Kirigami.Units.largeSpacing
|
padding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
source: model.url
|
source: sticker.emoji
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
sourceSize.width: width
|
sourceSize.width: width
|
||||||
sourceSize.height: height
|
sourceSize.height: height
|
||||||
}
|
}
|
||||||
QQC2.ToolTip.text: model.name
|
QQC2.ToolTip.text: name
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
QQC2.ToolTip.visible: hovered && !!model.name
|
QQC2.ToolTip.visible: hovered && !!name
|
||||||
onClicked: stickerModel.packIndex = model.index
|
onClicked: stickerModel.packIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ QVariant ImagePacksModel::data(const QModelIndex &index, int role) const
|
|||||||
QHash<int, QByteArray> ImagePacksModel::roleNames() const
|
QHash<int, QByteArray> ImagePacksModel::roleNames() const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
{DisplayNameRole, "displayName"},
|
{DisplayNameRole, "name"},
|
||||||
{AvatarUrlRole, "avatarUrl"},
|
{AvatarUrlRole, "emoji"},
|
||||||
{AttributionRole, "attribution"},
|
{AttributionRole, "attribution"},
|
||||||
{IdRole, "id"},
|
{IdRole, "id"},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user