[plasma/xdg-desktop-portal-kde] src: Register ScreenshotDialog with qml

David Redondo <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 967bde6c440edd0a7fca2269dee1bb8594557ef7 by David Redondo.
Committed on 29/07/2026 at 10:14.
Pushed by davidre into branch 'master'.

Register ScreenshotDialog with qml

So qml knows it has the method it can call

M  +2    -1    src/ScreenshotDialog.qml
M  +3    -0    src/screenshotdialog.h

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/967bde6c440edd0a7fca2269dee1bb8594557ef7

diff --git a/src/ScreenshotDialog.qml b/src/ScreenshotDialog.qml
index 01f9a1b4..564e5cf2 100644
--- a/src/ScreenshotDialog.qml
+++ b/src/ScreenshotDialog.qml
@@ -9,6 +9,7 @@ import QtQuick.Layouts
 import QtQuick.Controls as QQC2
 import org.kde.kirigami as Kirigami
 import org.kde.ki18n
+import org.kde.xdgdesktopportal
 
 PortalDialog {
     id: root
@@ -18,7 +19,7 @@ PortalDialog {
     property alias screenshotImage: screenshot.source
     property alias withCursor: hasCursor.checked
     property alias withBorders: hasWindowBorders.checked
-    property QtObject app
+    property ScreenshotDialogCpp app
     required property string appName
 
     iconName: "preferences-system-windows-effect-screenshot"
diff --git a/src/screenshotdialog.h b/src/screenshotdialog.h
index 86ea7af0..d98de46c 100644
--- a/src/screenshotdialog.h
+++ b/src/screenshotdialog.h
@@ -12,10 +12,13 @@
 #include "quickdialog.h"
 #include <QFuture>
 #include <QImage>
+#include <qqmlintegration.h>
 
 class ScreenshotDialog : public QuickDialog
 {
     Q_OBJECT
+    QML_NAMED_ELEMENT(ScreenshotDialogCpp)
+    QML_UNCREATABLE("")
 public:
     explicit ScreenshotDialog(const QString &appName, QObject *parent = nullptr);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.