From 45177bb29b3c4cf98cabb97de091da6965a55ea4 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Mon, 23 Dec 2019 14:08:58 +0100 Subject: [PATCH] Remove deprecated method Summary: Remove some deprecated method Reviewers: zzag Reviewed By: zzag Subscribers: davidedmundson, zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D25735 --- kcmkwin/kwindecoration/declarative-plugin/plugin.cpp | 7 +++++++ kcmkwin/kwindecoration/kcm.cpp | 7 +++++-- plugins/kdecorations/aurorae/src/decorationoptions.cpp | 10 +++++----- screenedge.cpp | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/kcmkwin/kwindecoration/declarative-plugin/plugin.cpp b/kcmkwin/kwindecoration/declarative-plugin/plugin.cpp index 54144f5167..878f5a1c80 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/plugin.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/plugin.cpp @@ -41,10 +41,17 @@ void Plugin::registerTypes(const char *uri) qmlRegisterType(uri, 1, 0, "Decoration"); qmlRegisterType(uri, 1, 0, "Button"); qmlRegisterType(uri, 1, 0, "ButtonsModel"); +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); +#else + qmlRegisterAnonymousType(uri, 1); + qmlRegisterAnonymousType(uri, 1); + qmlRegisterAnonymousType(uri, 1); + qmlRegisterAnonymousType(uri, 1); +#endif } } diff --git a/kcmkwin/kwindecoration/kcm.cpp b/kcmkwin/kwindecoration/kcm.cpp index b83bcefb05..f8d6be6183 100644 --- a/kcmkwin/kwindecoration/kcm.cpp +++ b/kcmkwin/kwindecoration/kcm.cpp @@ -100,10 +100,13 @@ KCMKWinDecoration::KCMKWinDecoration(QObject *parent, const QVariantList &argume i18n("Author"), QStringLiteral("vpilo@coldshock.net")); setAboutData(about); - +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) qmlRegisterType(); qmlRegisterType(); - +#else + qmlRegisterAnonymousType("org.kde.kwin.KWinDecoration", 1); + qmlRegisterAnonymousType("org.kde.kwin.KWinDecoration", 1); +#endif m_proxyThemesModel->setSourceModel(m_themesModel); m_proxyThemesModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyThemesModel->setSortCaseSensitivity(Qt::CaseInsensitive); diff --git a/plugins/kdecorations/aurorae/src/decorationoptions.cpp b/plugins/kdecorations/aurorae/src/decorationoptions.cpp index 055175ee86..eda5e76916 100644 --- a/plugins/kdecorations/aurorae/src/decorationoptions.cpp +++ b/plugins/kdecorations/aurorae/src/decorationoptions.cpp @@ -167,7 +167,7 @@ void DecorationOptions::setDecoration(KDecoration2::Decoration *decoration) } if (m_decoration) { // disconnect from existing decoration - disconnect(m_decoration->client().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged); + disconnect(m_decoration->client().toStrongRef().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged); auto s = m_decoration->settings(); disconnect(s.data(), &KDecoration2::DecorationSettings::fontChanged, this, &DecorationOptions::fontChanged); disconnect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &DecorationOptions::titleButtonsChanged); @@ -175,8 +175,8 @@ void DecorationOptions::setDecoration(KDecoration2::Decoration *decoration) disconnect(m_paletteConnection); } m_decoration = decoration; - connect(m_decoration->client().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged); - m_paletteConnection = connect(m_decoration->client().data(), &KDecoration2::DecoratedClient::paletteChanged, this, + connect(m_decoration->client().toStrongRef().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged); + m_paletteConnection = connect(m_decoration->client().toStrongRef().data(), &KDecoration2::DecoratedClient::paletteChanged, this, [this] (const QPalette &pal) { m_colors.update(pal); emit colorsChanged(); @@ -194,10 +194,10 @@ void DecorationOptions::slotActiveChanged() if (!m_decoration) { return; } - if (m_active == m_decoration->client().data()->isActive()) { + if (m_active == m_decoration->client().toStrongRef().data()->isActive()) { return; } - m_active = m_decoration->client().data()->isActive(); + m_active = m_decoration->client().toStrongRef().data()->isActive(); emit colorsChanged(); emit fontChanged(); } diff --git a/screenedge.cpp b/screenedge.cpp index 6aadc68528..a5e97a4a37 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -880,7 +880,7 @@ void ScreenEdges::setActionForTouchBorder(ElectricBorder border, ElectricBorderA void ScreenEdges::updateLayout() { const QSize desktopMatrix = VirtualDesktopManager::self()->grid().size(); - Qt::Orientations newLayout = nullptr; + Qt::Orientations newLayout = {}; if (desktopMatrix.width() > 1) { newLayout |= Qt::Horizontal; }