Verified Commit 8b45a93d authored by Fushan Wen's avatar Fushan Wen
Browse files

wallpapers/potd: Register meta type in registerTypes

This avoids calling `qmlRegisterType` multiple times to register the
same type, which can cause memory leaks.

See also: https://bugreports.qt.io/browse/QTBUG-89406
parent 0c8b8729
Pipeline #171924 passed with stage
in 1 minute and 41 seconds
......@@ -31,10 +31,12 @@ public:
{
Q_ASSERT(uri == QByteArrayLiteral("org.kde.plasma.wallpapers.potd"));
qRegisterMetaType<PotdProviderData>();
qmlRegisterType<PotdProviderModel>(uri, 1, 0, "PotdProviderModel");
qmlRegisterSingletonType<PotdProviderModel>(uri, 1, 0, "PotdProviderModelInstance", self);
qmlRegisterUncreatableType<PotdProviderModel>(uri, 1, 0, "Global", QStringLiteral("Error: only enums"));
}
};
#include "potdplugin.moc"
\ No newline at end of file
#include "potdplugin.moc"
......@@ -34,8 +34,6 @@ PotdProviderModel::PotdProviderModel(QObject *parent)
connect(&m_checkDatesTimer, &QTimer::timeout, this, &PotdProviderModel::forceUpdateSource);
m_checkDatesTimer.setInterval(10min); // check every 10 minutes
qRegisterMetaType<PotdProviderData>();
}
int PotdProviderModel::rowCount(const QModelIndex &parent) const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment