diff options
Diffstat (limited to 'examples/widgets/tools/echoplugin')
13 files changed, 0 insertions, 326 deletions
diff --git a/examples/widgets/tools/echoplugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/CMakeLists.txt deleted file mode 100644 index 93b49b43d7..0000000000 --- a/examples/widgets/tools/echoplugin/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(plugandpaint LANGUAGES CXX) - -find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/echoplugin") - -add_subdirectory(plugin) -add_subdirectory(echowindow) diff --git a/examples/widgets/tools/echoplugin/echoplugin.pro b/examples/widgets/tools/echoplugin/echoplugin.pro deleted file mode 100644 index 1e3d625b2f..0000000000 --- a/examples/widgets/tools/echoplugin/echoplugin.pro +++ /dev/null @@ -1,5 +0,0 @@ -#! [0] -TEMPLATE = subdirs -SUBDIRS = echowindow \ - plugin -#! [0] diff --git a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt deleted file mode 100644 index 29183a7c1f..0000000000 --- a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -qt_add_executable(echopluginwindow - echointerface.h - echowindow.cpp echowindow.h - main.cpp -) - -set_target_properties(echopluginwindow PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(echopluginwindow PRIVATE - Qt::Core - Qt::Gui - Qt::Widgets -) - -if(NOT QT6_IS_SHARED_LIBS_BUILD) - target_link_libraries(echopluginwindow PRIVATE - echoplugin - ) -endif() - -install(TARGETS echopluginwindow - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/widgets/tools/echoplugin/echowindow/echointerface.h b/examples/widgets/tools/echoplugin/echowindow/echointerface.h deleted file mode 100644 index c36578fd21..0000000000 --- a/examples/widgets/tools/echoplugin/echowindow/echointerface.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#ifndef ECHOINTERFACE_H -#define ECHOINTERFACE_H - -#include <QObject> -#include <QString> - -//! [0] -class EchoInterface -{ -public: - virtual ~EchoInterface() = default; - virtual QString echo(const QString &message) = 0; -}; - - -QT_BEGIN_NAMESPACE - -#define EchoInterface_iid "org.qt-project.Qt.Examples.EchoInterface" - -Q_DECLARE_INTERFACE(EchoInterface, EchoInterface_iid) -QT_END_NAMESPACE - -//! [0] -#endif diff --git a/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp b/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp deleted file mode 100644 index 718c412c33..0000000000 --- a/examples/widgets/tools/echoplugin/echowindow/echowindow.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include "echowindow.h" - -#include <QCoreApplication> -#include <QDir> -#include <QLabel> -#include <QLayout> -#include <QLineEdit> -#include <QMessageBox> -#include <QPluginLoader> -#include <QPushButton> - -//! [0] -EchoWindow::EchoWindow() -{ - createGUI(); - setLayout(layout); - setWindowTitle("Echo Plugin Example"); - - if (!loadPlugin()) { - QMessageBox::information(this, "Error", "Could not load the plugin"); - lineEdit->setEnabled(false); - button->setEnabled(false); - } -} -//! [0] - -//! [1] -void EchoWindow::sendEcho() -{ - QString text = echoInterface->echo(lineEdit->text()); - label->setText(text); -} -//! [1] - -//! [2] -void EchoWindow::createGUI() -{ - lineEdit = new QLineEdit; - label = new QLabel; - label->setFrameStyle(QFrame::Box | QFrame::Plain); - button = new QPushButton(tr("Send Message")); - - connect(lineEdit, &QLineEdit::editingFinished, - this, &EchoWindow::sendEcho); - connect(button, &QPushButton::clicked, - this, &EchoWindow::sendEcho); - - layout = new QGridLayout; - layout->addWidget(new QLabel(tr("Message:")), 0, 0); - layout->addWidget(lineEdit, 0, 1); - layout->addWidget(new QLabel(tr("Answer:")), 1, 0); - layout->addWidget(label, 1, 1); - layout->addWidget(button, 2, 1, Qt::AlignRight); - layout->setSizeConstraint(QLayout::SetFixedSize); -} -//! [2] - -//! [3] -bool EchoWindow::loadPlugin() -{ - QDir pluginsDir(QCoreApplication::applicationDirPath()); -#if defined(Q_OS_WIN) - if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") - pluginsDir.cdUp(); -#elif defined(Q_OS_MAC) - if (pluginsDir.dirName() == "MacOS") { - pluginsDir.cdUp(); - pluginsDir.cdUp(); - pluginsDir.cdUp(); - } -#endif - pluginsDir.cd("plugins"); - const QStringList entries = pluginsDir.entryList(QDir::Files); - for (const QString &fileName : entries) { - QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName)); - QObject *plugin = pluginLoader.instance(); - if (plugin) { - echoInterface = qobject_cast<EchoInterface *>(plugin); - if (echoInterface) - return true; - pluginLoader.unload(); - } - } - - return false; -} -//! [3] diff --git a/examples/widgets/tools/echoplugin/echowindow/echowindow.h b/examples/widgets/tools/echoplugin/echowindow/echowindow.h deleted file mode 100644 index 25d08162a9..0000000000 --- a/examples/widgets/tools/echoplugin/echowindow/echowindow.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#ifndef ECHODIALOG_H -#define ECHODIALOG_H - -#include <QWidget> - -#include "echointerface.h" - -QT_BEGIN_NAMESPACE -class QString; -class QLineEdit; -class QLabel; -class QPushButton; -class QGridLayout; -QT_END_NAMESPACE - -//! [0] -class EchoWindow : public QWidget -{ - Q_OBJECT - -public: - EchoWindow(); - -private slots: - void sendEcho(); - -private: - void createGUI(); - bool loadPlugin(); - - EchoInterface *echoInterface; - QLineEdit *lineEdit; - QLabel *label; - QPushButton *button; - QGridLayout *layout; -}; -//! [0] - -#endif diff --git a/examples/widgets/tools/echoplugin/echowindow/echowindow.pro b/examples/widgets/tools/echoplugin/echowindow/echowindow.pro deleted file mode 100644 index 092258dd30..0000000000 --- a/examples/widgets/tools/echoplugin/echowindow/echowindow.pro +++ /dev/null @@ -1,21 +0,0 @@ -QT += widgets - -HEADERS = echowindow.h \ - echointerface.h -SOURCES = echowindow.cpp \ - main.cpp - -TARGET = echoplugin -QMAKE_PROJECT_NAME = echopluginwindow -win32 { - CONFIG(debug, release|debug):DESTDIR = ../debug/ - CONFIG(release, release|debug):DESTDIR = ../release/ -} else { - DESTDIR = ../ -} - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/echoplugin -INSTALLS += target - -CONFIG += install_ok # Do not cargo-cult this! diff --git a/examples/widgets/tools/echoplugin/echowindow/main.cpp b/examples/widgets/tools/echoplugin/echowindow/main.cpp deleted file mode 100644 index c48af33773..0000000000 --- a/examples/widgets/tools/echoplugin/echowindow/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include <QApplication> - -#include "echowindow.h" -#include "echointerface.h" - -//! [0] -int main(int argv, char *args[]) -{ - QApplication app(argv, args); - - EchoWindow window; - window.show(); - - return app.exec(); -} -//! [0] diff --git a/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt deleted file mode 100644 index 7d63180a87..0000000000 --- a/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -qt_add_plugin(echoplugin - CLASS_NAME EchoPlugin -) - -target_sources(echoplugin PRIVATE - echoplugin.cpp echoplugin.h -) - -set_target_properties(echoplugin PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/echowindow" -) - -target_include_directories(echoplugin PUBLIC - ../echowindow -) - -target_link_libraries(echoplugin PUBLIC - Qt::Core - Qt::Gui - Qt::Widgets -) - -install(TARGETS echoplugin - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/widgets/tools/echoplugin/plugin/echoplugin.cpp b/examples/widgets/tools/echoplugin/plugin/echoplugin.cpp deleted file mode 100644 index 55ccedb39e..0000000000 --- a/examples/widgets/tools/echoplugin/plugin/echoplugin.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include "echoplugin.h" - -//! [0] -QString EchoPlugin::echo(const QString &message) -{ - return message; -} -//! [0] diff --git a/examples/widgets/tools/echoplugin/plugin/echoplugin.h b/examples/widgets/tools/echoplugin/plugin/echoplugin.h deleted file mode 100644 index 13e630da03..0000000000 --- a/examples/widgets/tools/echoplugin/plugin/echoplugin.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#ifndef ECHOPLUGIN_H -#define ECHOPLUGIN_H - -#include <QObject> -#include <QtPlugin> -#include "echointerface.h" - -//! [0] -class EchoPlugin : public QObject, EchoInterface -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EchoInterface" FILE "echoplugin.json") - Q_INTERFACES(EchoInterface) - -public: - QString echo(const QString &message) override; -}; -//! [0] - -#endif diff --git a/examples/widgets/tools/echoplugin/plugin/echoplugin.json b/examples/widgets/tools/echoplugin/plugin/echoplugin.json deleted file mode 100644 index 0967ef424b..0000000000 --- a/examples/widgets/tools/echoplugin/plugin/echoplugin.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/examples/widgets/tools/echoplugin/plugin/plugin.pro b/examples/widgets/tools/echoplugin/plugin/plugin.pro deleted file mode 100644 index a4b54b18f6..0000000000 --- a/examples/widgets/tools/echoplugin/plugin/plugin.pro +++ /dev/null @@ -1,18 +0,0 @@ -#! [0] -TEMPLATE = lib -CONFIG += plugin -QT += widgets -INCLUDEPATH += ../echowindow -HEADERS = echoplugin.h -SOURCES = echoplugin.cpp -TARGET = $$qtLibraryTarget(echoplugin) -DESTDIR = ../plugins -#! [0] - -EXAMPLE_FILES = echoplugin.json - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/echoplugin/plugins -INSTALLS += target - -CONFIG += install_ok # Do not cargo-cult this! |