From 5aae8c768aa69344a1d7ff2d9611de0b04acd8e2 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 9 Mar 2022 17:43:24 +0100 Subject: [PATCH] Port to qmlRegisterAnonymousType() The anonymous variant of qmlRegisterType() is deprecated in Qt5 and gone in Qt6. This however now requires us to specify a module URI and major version number. I used the names and (lowest) versions used already for other types nearby where available, and fell back to "org.kde.kwin" and 0 otherwise. --- src/kcmkwin/kwindesktop/virtualdesktops.cpp | 2 +- src/kcmkwin/kwintabbox/layoutpreview.cpp | 2 +- src/plugins/kdecorations/aurorae/src/aurorae.cpp | 4 ++-- src/scripting/scripting.cpp | 14 +++++++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/kcmkwin/kwindesktop/virtualdesktops.cpp b/src/kcmkwin/kwindesktop/virtualdesktops.cpp index 7c5131e803..8d76d7559f 100644 --- a/src/kcmkwin/kwindesktop/virtualdesktops.cpp +++ b/src/kcmkwin/kwindesktop/virtualdesktops.cpp @@ -34,7 +34,7 @@ VirtualDesktops::VirtualDesktops(QObject *parent, const QVariantList &args) QStringLiteral("2.0"), QString(), KAboutLicense::GPL); setAboutData(about); - qmlRegisterType(); + qmlRegisterAnonymousType("org.kde.kwin.kcm.desktop", 0); setButtons(Apply | Default); diff --git a/src/kcmkwin/kwintabbox/layoutpreview.cpp b/src/kcmkwin/kwintabbox/layoutpreview.cpp index aa8b6bb83e..1f752565ee 100644 --- a/src/kcmkwin/kwintabbox/layoutpreview.cpp +++ b/src/kcmkwin/kwintabbox/layoutpreview.cpp @@ -35,7 +35,7 @@ LayoutPreview::LayoutPreview(const QString &path, bool showDesktopThumbnail, QOb qmlRegisterType("org.kde.kwin", 2, 0, "Switcher"); qmlRegisterType("org.kde.kwin", 3, 0, "WindowThumbnailItem"); qmlRegisterType("org.kde.kwin", 3, 0, "TabBoxSwitcher"); - qmlRegisterType(); + qmlRegisterAnonymousType("org.kde.kwin", 2); component->loadUrl(QUrl::fromLocalFile(path)); if (component->isError()) { qDebug() << component->errorString(); diff --git a/src/plugins/kdecorations/aurorae/src/aurorae.cpp b/src/plugins/kdecorations/aurorae/src/aurorae.cpp index 663b0ebffa..e18273afb0 100644 --- a/src/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/src/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -223,8 +223,8 @@ void Helper::init() m_engine->importPlugin(pluginPath, "org.kde.kwin.decoration", nullptr); qmlRegisterType("org.kde.kwin.decoration", 0, 1, "Borders"); - qmlRegisterType(); - qmlRegisterType(); + qmlRegisterAnonymousType("org.kde.kwin.decoration", 0); + qmlRegisterAnonymousType("org.kde.kwin.decoration", 0); qRegisterMetaType(); } diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp index 0713cfaa76..cc0550478f 100644 --- a/src/scripting/scripting.cpp +++ b/src/scripting/scripting.cpp @@ -643,7 +643,7 @@ void KWin::Scripting::init() qmlRegisterType("org.kde.kwin", 2, 0, "ThumbnailItem"); qmlRegisterType("org.kde.kwin", 2, 0, "DBusCall"); qmlRegisterType("org.kde.kwin", 2, 0, "ScreenEdgeItem"); - qmlRegisterType(); + qmlRegisterAnonymousType("org.kde.kwin", 2); qmlRegisterType("org.kde.kwin", 2, 0, "ClientModel"); qmlRegisterType("org.kde.kwin", 2, 0, "ClientModelByScreen"); qmlRegisterType("org.kde.kwin", 2, 0, "ClientModelByScreenAndDesktop"); @@ -665,10 +665,14 @@ void KWin::Scripting::init() }); qmlRegisterSingletonInstance("org.kde.kwin", 3, 0, "Options", options); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); + qmlRegisterAnonymousType("org.kde.kwin", 2); + qmlRegisterAnonymousType("org.kde.kwin", 2); + qmlRegisterAnonymousType("org.kde.kwin", 2); + qmlRegisterAnonymousType("org.kde.kwin", 2); + qmlRegisterAnonymousType("org.kde.kwin", 3); + qmlRegisterAnonymousType("org.kde.kwin", 3); + qmlRegisterAnonymousType("org.kde.kwin", 3); + qmlRegisterAnonymousType("org.kde.kwin", 3); // TODO Plasma 6: Drop context properties. m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("workspace"), m_workspaceWrapper);