Fix qml warnings in EmoticonFormCard

This commit is contained in:
Tobias Fella
2025-09-15 13:15:59 +02:00
parent f390702a7a
commit d6d747bb99
2 changed files with 20 additions and 14 deletions

View File

@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org> // SPDX-FileCopyrightText: 2023 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
@@ -38,14 +40,19 @@ FormCard.FormCard {
delegate: FormCard.AbstractFormDelegate { delegate: FormCard.AbstractFormDelegate {
id: stickerDelegate id: stickerDelegate
required property string body
required property string url
required property string shortcode
required property int index
width: stickerFlow.width / 4 width: stickerFlow.width / 4
height: width height: width
onClicked: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(emoticonEditorPage, { onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(emoticonEditorPage, {
description: model.body ?? "", description: stickerDelegate.body ?? "",
index: model.index, index: stickerDelegate.index,
url: model.url, url: stickerDelegate.url,
shortcode: model.shortcode, shortcode: stickerDelegate.shortcode,
model: stickerModel, model: stickerModel,
proxyModel: emoticonFilterModel, proxyModel: emoticonFilterModel,
emoticonType: root.emoticonType emoticonType: root.emoticonType
@@ -55,7 +62,7 @@ FormCard.FormCard {
contentItem: ColumnLayout { contentItem: ColumnLayout {
Image { Image {
source: model.url source: stickerDelegate.url
Layout.fillWidth: true Layout.fillWidth: true
sourceSize.height: parent.width * 0.8 sourceSize.height: parent.width * 0.8
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -68,7 +75,7 @@ FormCard.FormCard {
} }
QQC2.Label { QQC2.Label {
id: descriptionLabel id: descriptionLabel
text: model.body ?? i18nc("As in 'This sticker/emoji has no description'", "No Description") text: stickerDelegate.body ?? i18nc("As in 'This sticker/emoji has no description'", "No Description")
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap
@@ -82,7 +89,7 @@ FormCard.FormCard {
anchors.right: parent.right anchors.right: parent.right
anchors.margins: Kirigami.Units.smallSpacing anchors.margins: Kirigami.Units.smallSpacing
z: 2 z: 2
onClicked: stickerModel.deleteEmoticon(emoticonFilterModel.mapToSource(emoticonFilterModel.index(model.index, 0)).row) onClicked: stickerModel.deleteEmoticon(emoticonFilterModel.mapToSource(emoticonFilterModel.index(stickerDelegate.index, 0)).row)
} }
} }
} }
@@ -90,7 +97,7 @@ FormCard.FormCard {
width: stickerFlow.width / 4 width: stickerFlow.width / 4
height: width height: width
onClicked: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(emoticonEditorPage, { onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(emoticonEditorPage, {
description: "", description: "",
index: -1, index: -1,
url: "", url: "",
@@ -116,4 +123,8 @@ FormCard.FormCard {
} }
} }
} }
Component {
id: emoticonEditorPage
EmoticonEditorPage {}
}
} }

View File

@@ -30,9 +30,4 @@ FormCard.FormCardPage {
emoticonType: EmoticonFormCard.Stickers emoticonType: EmoticonFormCard.Stickers
connection: root.connection connection: root.connection
} }
property Component emoticonEditorPage: Component {
id: emoticonEditorPage
EmoticonEditorPage {}
}
} }