Fix plugintest crash on startup: qApp needed.

This commit is contained in:
David Faure 2016-06-12 15:14:35 +02:00
parent f5ad210742
commit fc673146a6
3 changed files with 7 additions and 8 deletions

View File

@ -3,7 +3,7 @@ add_executable(plugintest
plugintest.cpp
)
target_link_libraries(plugintest KF5::Plasma KF5::I18n KF5::Service Qt5::DBus Qt5::Gui)
target_link_libraries(plugintest KF5::Plasma KF5::I18n KF5::Service Qt5::DBus Qt5::Widgets)
#install(TARGETS plugintest ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})

View File

@ -58,7 +58,7 @@ public:
};
PluginTest::PluginTest(int &argc, char **argv, QCommandLineParser *parser) :
QGuiApplication(argc, argv)
QApplication(argc, argv) // QApp needed for CursorNotificationHandler (QWidget)
{
d = new PluginTestPrivate;
d->parser = parser;
@ -144,7 +144,7 @@ bool PluginTest::loadFromKService(const QString &name)
if (api.isEmpty()) {
if (offers.first()) {
KPluginLoader plugin(*offers.first());
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
if (Plasma::isPluginVersionCompatible(plugin)) {
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
}
}
@ -236,7 +236,7 @@ bool PluginTest::loadKService(const QString &name)
if (api.isEmpty()) {
if (offers.first()) {
KPluginLoader plugin(*offers.first());
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
if (Plasma::isPluginVersionCompatible(plugin)) {
//KPluginInfo::List infos = KPluginInfo::fromServices(offers.first());
//qDebug() << " plugininfo:" << info.name();
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
@ -282,7 +282,7 @@ bool PluginTest::loadKService(const QString &name)
void PluginTest::dataUpdated(QString s, Plasma::DataEngine::Data d)
{
// qDebug() << "new data for source: " << s << d;
qDebug() << "new data for source:" << s << d;
}
} // namespace Plasma

View File

@ -20,8 +20,7 @@
#ifndef PLUGINTEST_H
#define PLUGINTEST_H
#include <QCoreApplication>
#include <QtGui/QGuiApplication>
#include <QApplication>
#include <Plasma/DataEngine>
@ -32,7 +31,7 @@ namespace Plasma
class PluginTestPrivate;
class PluginTest : public QGuiApplication
class PluginTest : public QApplication
{
Q_OBJECT