diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-17 08:32:43 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-17 08:32:43 +0200 |
commit | d49d076431d7579ecb33147187fe07eb148112ba (patch) | |
tree | 668370fb9a2eec50000e371125136921ef4518ab /examples/widgets/tools/echoplugin/echowindow | |
parent | b01e69684b9b36492cc43472edeb72058be9f706 (diff) | |
parent | 35cdcddd605d8823b7b57129e8d7279133a3ca89 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ic1fd51143f903b7e9086fc19ca960dfd9654ee00
Diffstat (limited to 'examples/widgets/tools/echoplugin/echowindow')
3 files changed, 14 insertions, 5 deletions
diff --git a/examples/widgets/tools/echoplugin/echowindow/echointerface.h b/examples/widgets/tools/echoplugin/echowindow/echointerface.h index 1915330e21..fb07f7fb79 100644 --- a/examples/widgets/tools/echoplugin/echowindow/echointerface.h +++ b/examples/widgets/tools/echoplugin/echowindow/echointerface.h @@ -51,13 +51,14 @@ #ifndef ECHOINTERFACE_H #define ECHOINTERFACE_H +#include <QObject> #include <QString> //! [0] class EchoInterface { public: - virtual ~EchoInterface() {} + virtual ~EchoInterface() = default; virtual QString echo(const QString &message) = 0; }; diff --git a/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp b/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp index 6886a4cd88..dce6bdedc3 100644 --- a/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp +++ b/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp @@ -48,10 +48,17 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "echowindow.h" +#include <QCoreApplication> +#include <QDir> +#include <QLabel> +#include <QLayout> +#include <QLineEdit> +#include <QMessageBox> +#include <QPluginLoader> +#include <QPushButton> + //! [0] EchoWindow::EchoWindow() { @@ -101,7 +108,7 @@ void EchoWindow::createGUI() //! [3] bool EchoWindow::loadPlugin() { - QDir pluginsDir(qApp->applicationDirPath()); + QDir pluginsDir(QCoreApplication::applicationDirPath()); #if defined(Q_OS_WIN) if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") pluginsDir.cdUp(); @@ -121,6 +128,7 @@ bool EchoWindow::loadPlugin() echoInterface = qobject_cast<EchoInterface *>(plugin); if (echoInterface) return true; + pluginLoader.unload(); } } diff --git a/examples/widgets/tools/echoplugin/echowindow/main.cpp b/examples/widgets/tools/echoplugin/echowindow/main.cpp index 50e3c2763b..d3cf45fcde 100644 --- a/examples/widgets/tools/echoplugin/echowindow/main.cpp +++ b/examples/widgets/tools/echoplugin/echowindow/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include <QtWidgets> +#include <QApplication> #include "echowindow.h" #include "echointerface.h" |