Get rid of deprecated QWeakPointer usage

Replace by QPointer

Differential Revision: https://phabricator.kde.org/D14819
This commit is contained in:
Kai Uwe Broulik 2018-08-17 15:43:31 +02:00
parent 4bda8ec0b7
commit 938cef210c
20 changed files with 40 additions and 39 deletions

View File

@ -50,7 +50,7 @@ private Q_SLOTS:
private:
const QUrl m_url;
QWeakPointer<KJob> m_job;
QPointer<KJob> m_job;
QByteArray m_data;
};

View File

@ -21,7 +21,7 @@
#define COLORSCOPE_H
#include <QQuickItem>
#include <QWeakPointer>
#include <QPointer>
#include <QtCore/QVariant>
#include <Plasma/Plasma>
#include <Plasma/Theme>

View File

@ -20,7 +20,7 @@
#define SERVICEOPERATIONSTATUS_P
#include <QObject>
#include <QSharedPointer>
#include <QPointer>
#include "plasma/service.h"
@ -74,7 +74,7 @@ private Q_SLOTS:
void updateStatus();
private:
QWeakPointer<Plasma::Service> m_service;
QPointer<Plasma::Service> m_service;
QString m_operation;
bool m_enabled;
};

View File

@ -102,7 +102,7 @@ private:
void updatePolish() override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
QWeakPointer<Plasma::Svg> m_svg;
QPointer<Plasma::Svg> m_svg;
QString m_elementID;
bool m_smooth;
bool m_textureChanged;

View File

@ -23,7 +23,7 @@
#define TOOLTIPOBJECT_H
#include <QQuickItem>
#include <QWeakPointer>
#include <QPointer>
#include <QtCore/QVariant>
#include <Plasma/Plasma>
@ -204,7 +204,7 @@ private:
bool m_tooltipsEnabledGlobally;
bool m_containsMouse;
Plasma::Types::Location m_location;
QWeakPointer<QQuickItem> m_mainItem;
QPointer<QQuickItem> m_mainItem;
QTimer *m_showTimer;
QString m_mainText;
QString m_subText;

View File

@ -24,7 +24,6 @@
#include <QTimer>
#include <QQuickWindow>
#include <QWeakPointer>
#include <QtCore/QVariant>
class QQuickItem;

View File

@ -22,7 +22,7 @@
#include <QObject>
#include <QPoint>
#include <QRect>
#include <QWeakPointer>
#include <QPointer>
#include <QDeclarativeListProperty>
#include <QDeclarativeItem>
@ -83,10 +83,10 @@ protected:
private:
QGraphicsView *m_view;
QWeakPointer<QGraphicsObject> m_mainItem;
QPointer<QGraphicsObject> m_mainItem;
DeclarativeItemContainer *m_declarativeItemContainer;
QGraphicsScene *m_scene;
QWeakPointer<QObject> m_rootObject;
QPointer<QObject> m_rootObject;
static uint s_numItems;
Background *m_background;

View File

@ -22,6 +22,7 @@
#include <QObject>
#include <QMenu>
#include <QPointer>
#include <QQmlListProperty>
#include "qmenuitem.h"
#include "enums.h"
@ -189,7 +190,7 @@ private:
QList<QMenuItem *> m_items;
QMenu *m_menu;
DialogStatus::Status m_status;
QWeakPointer<QObject> m_visualParent;
QPointer<QObject> m_visualParent;
Plasma::Types::PopupPlacement m_placement;
};

View File

@ -19,6 +19,7 @@
#include "pluginloader.h"
#include <QPointer>
#include <QStandardPaths>
#include <QDebug>
@ -64,7 +65,7 @@ public:
static QString parentAppConstraint(const QString &parentApp = QString());
static QSet<QString> s_customCategories;
QHash<QString, QWeakPointer<PackageStructure> > structures;
QHash<QString, QPointer<PackageStructure> > structures;
bool isDefaultLoader;
static QString s_dataEnginePluginDir;
@ -144,7 +145,7 @@ PluginLoader::PluginLoader()
PluginLoader::~PluginLoader()
{
typedef QWeakPointer<PackageStructure> pswp;
typedef QPointer<PackageStructure> pswp;
foreach (pswp wp, d->structures) {
delete wp.data();
}

View File

@ -89,7 +89,7 @@ public:
Storage *storage;
QBasicTimer storageTimer;
QBasicTimer checkUsageTimer;
QWeakPointer<QAbstractItemModel> model;
QPointer<QAbstractItemModel> model;
int storageCount;
bool dirty : 1;
bool cached : 1;

View File

@ -48,7 +48,7 @@ StorageJob::StorageJob(const QString &destination,
Plasma::StorageThread::self()->start();
connect(Plasma::StorageThread::self(), SIGNAL(newResult(StorageJob*,QVariant)), this, SLOT(resultSlot(StorageJob*,QVariant)));
qRegisterMetaType<StorageJob *>();
qRegisterMetaType<QWeakPointer<StorageJob> >();
qRegisterMetaType<QPointer<StorageJob> >();
}
StorageJob::~StorageJob()
@ -80,15 +80,15 @@ void StorageJob::start()
valueGroup = QStringLiteral("default");
}
QWeakPointer<StorageJob> me(this);
QPointer<StorageJob> me(this);
if (operationName() == QLatin1String("save")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "save", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "save", Qt::QueuedConnection, Q_ARG(QPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
} else if (operationName() == QLatin1String("retrieve")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "retrieve", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "retrieve", Qt::QueuedConnection, Q_ARG(QPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
} else if (operationName() == QLatin1String("delete")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "deleteEntry", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "deleteEntry", Qt::QueuedConnection, Q_ARG(QPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
} else if (operationName() == QLatin1String("expire")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "expire", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "expire", Qt::QueuedConnection, Q_ARG(QPointer<StorageJob>, me), Q_ARG(QVariantMap, params));
} else {
setError(true);
setResult(false);

View File

@ -55,7 +55,7 @@ private:
//End StorageJob
Q_DECLARE_METATYPE(StorageJob *)
Q_DECLARE_METATYPE(QWeakPointer<StorageJob>)
Q_DECLARE_METATYPE(QPointer<StorageJob>)
class Storage : public Plasma::Service
{

View File

@ -97,7 +97,7 @@ void StorageThread::initializeDb(StorageJob *caller)
m_db.transaction();
}
void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &params)
void StorageThread::save(QPointer<StorageJob> wcaller, const QVariantMap &params)
{
StorageJob *caller = wcaller.data();
if (!caller) {
@ -200,7 +200,7 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
emit newResult(caller, true);
}
void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap &params)
void StorageThread::retrieve(QPointer<StorageJob> wcaller, const QVariantMap &params)
{
StorageJob *caller = wcaller.data();
if (!caller) {
@ -273,7 +273,7 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap
emit newResult(caller, result);
}
void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariantMap &params)
void StorageThread::deleteEntry(QPointer<StorageJob> wcaller, const QVariantMap &params)
{
StorageJob *caller = wcaller.data();
if (!caller) {
@ -303,7 +303,7 @@ void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariant
emit newResult(caller, success);
}
void StorageThread::expire(QWeakPointer<StorageJob> wcaller, const QVariantMap &params)
void StorageThread::expire(QPointer<StorageJob> wcaller, const QVariantMap &params)
{
StorageJob *caller = wcaller.data();
if (!caller) {

View File

@ -22,7 +22,7 @@
#include <QThread>
#include <QSqlDatabase>
#include <QWeakPointer>
#include <QPointer>
#include "storage_p.h"
@ -43,10 +43,10 @@ public:
void closeDb();
public Q_SLOTS:
void save(QWeakPointer<StorageJob> caller, const QVariantMap &parameters);
void retrieve(QWeakPointer<StorageJob> caller, const QVariantMap &parameters);
void deleteEntry(QWeakPointer<StorageJob> caller, const QVariantMap &parameters);
void expire(QWeakPointer<StorageJob> caller, const QVariantMap &parameters);
void save(QPointer<StorageJob> caller, const QVariantMap &parameters);
void retrieve(QPointer<StorageJob> caller, const QVariantMap &parameters);
void deleteEntry(QPointer<StorageJob> caller, const QVariantMap &parameters);
void expire(QPointer<StorageJob> caller, const QVariantMap &parameters);
Q_SIGNALS:
void newResult(StorageJob *caller, const QVariant &result);

View File

@ -21,6 +21,7 @@
#define PLASMA_SVG_P_H
#include <QHash>
#include <QPointer>
#include <QSharedData>
#include <QSvgRenderer>
#include <QExplicitlySharedDataPointer>
@ -96,11 +97,11 @@ public:
void colorsChanged();
static QHash<QString, SharedSvgRenderer::Ptr> s_renderers;
static QWeakPointer<Theme> s_systemColorsCache;
static QPointer<Theme> s_systemColorsCache;
static qreal s_lastScaleFactor;
Svg *q;
QWeakPointer<Theme> theme;
QPointer<Theme> theme;
QHash<QString, QRectF> localRectCache;
QHash<QString, QSize> elementsWithSizeHints;
SharedSvgRenderer::Ptr renderer;

View File

@ -693,7 +693,7 @@ void SvgPrivate::colorsChanged()
}
QHash<QString, SharedSvgRenderer::Ptr> SvgPrivate::s_renderers;
QWeakPointer<Theme> SvgPrivate::s_systemColorsCache;
QPointer<Theme> SvgPrivate::s_systemColorsCache;
qreal SvgPrivate::s_lastScaleFactor = 1.0;
Svg::Svg(QObject *parent)

View File

@ -21,7 +21,6 @@
#define APPLETQUICKITEM_H
#include <QQuickItem>
#include <QWeakPointer>
#include <QQmlComponent>
#include <QQmlEngine>
#include <QTimer>

View File

@ -53,7 +53,7 @@ public:
ConfigModel *q;
QList<ConfigCategory *> categories;
QWeakPointer<Plasma::Applet> appletInterface;
QPointer<Plasma::Applet> appletInterface;
QHash<QString, KQuickAddons::ConfigModule *> kcms;
void appendCategory(ConfigCategory *c);

View File

@ -64,13 +64,13 @@ public:
void mainItemLoaded();
ConfigView *q;
QWeakPointer <Plasma::Applet> applet;
QPointer <Plasma::Applet> applet;
ConfigModel *configModel;
ConfigModel *kcmConfigModel;
Plasma::Corona *corona;
//Attached Layout property of mainItem, if any
QWeakPointer <QObject> mainItemLayout;
QPointer <QObject> mainItemLayout;
};
ConfigViewPrivate::ConfigViewPrivate(Plasma::Applet *appl, ConfigView *view)

View File

@ -215,7 +215,7 @@ private:
QHash<KJob *, KIO::DropJob *> m_dropJobs;
KActivities::Info *m_activityInfo;
QPointer<Plasma::Containment> m_containment;
QWeakPointer<QMenu> m_contextMenu;
QPointer<QMenu> m_contextMenu;
int m_wheelDelta;
bool m_editMode : 1;
friend class AppletInterface;