From d6d747bb99f9ab2c38e65f782472c8d83048d65d Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 15 Sep 2025 13:15:59 +0200 Subject: [PATCH] Fix qml warnings in EmoticonFormCard --- src/settings/EmoticonFormCard.qml | 29 ++++++++++++++++++++--------- src/settings/EmoticonsPage.qml | 5 ----- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/settings/EmoticonFormCard.qml b/src/settings/EmoticonFormCard.qml index 252e6eab8..20ca1970a 100644 --- a/src/settings/EmoticonFormCard.qml +++ b/src/settings/EmoticonFormCard.qml @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2023 Tobias Fella // SPDX-License-Identifier: GPL-2.0-or-later +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Controls as QQC2 import QtQuick.Layouts @@ -38,14 +40,19 @@ FormCard.FormCard { delegate: FormCard.AbstractFormDelegate { id: stickerDelegate + required property string body + required property string url + required property string shortcode + required property int index + width: stickerFlow.width / 4 height: width - onClicked: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(emoticonEditorPage, { - description: model.body ?? "", - index: model.index, - url: model.url, - shortcode: model.shortcode, + onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(emoticonEditorPage, { + description: stickerDelegate.body ?? "", + index: stickerDelegate.index, + url: stickerDelegate.url, + shortcode: stickerDelegate.shortcode, model: stickerModel, proxyModel: emoticonFilterModel, emoticonType: root.emoticonType @@ -55,7 +62,7 @@ FormCard.FormCard { contentItem: ColumnLayout { Image { - source: model.url + source: stickerDelegate.url Layout.fillWidth: true sourceSize.height: parent.width * 0.8 fillMode: Image.PreserveAspectFit @@ -68,7 +75,7 @@ FormCard.FormCard { } QQC2.Label { 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 Layout.fillWidth: true wrapMode: Text.Wrap @@ -82,7 +89,7 @@ FormCard.FormCard { anchors.right: parent.right anchors.margins: Kirigami.Units.smallSpacing 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 height: width - onClicked: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(emoticonEditorPage, { + onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(emoticonEditorPage, { description: "", index: -1, url: "", @@ -116,4 +123,8 @@ FormCard.FormCard { } } } + Component { + id: emoticonEditorPage + EmoticonEditorPage {} + } } diff --git a/src/settings/EmoticonsPage.qml b/src/settings/EmoticonsPage.qml index 6dafcba89..0ae2c34d4 100644 --- a/src/settings/EmoticonsPage.qml +++ b/src/settings/EmoticonsPage.qml @@ -30,9 +30,4 @@ FormCard.FormCardPage { emoticonType: EmoticonFormCard.Stickers connection: root.connection } - - property Component emoticonEditorPage: Component { - id: emoticonEditorPage - EmoticonEditorPage {} - } }