qt 6.5.1 original

This commit is contained in:
kleuter
2023-10-29 23:33:08 +01:00
parent 71d22ab6b0
commit 85d238dfda
21202 changed files with 5499099 additions and 0 deletions

View File

@ -0,0 +1,41 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(pingpong LANGUAGES CXX)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/pingpong")
find_package(Qt6 REQUIRED COMPONENTS Core DBus)
qt_standard_project_setup()
qt_add_executable(ping
ping.cpp
ping-common.h
)
target_link_libraries(ping PRIVATE
Qt6::Core
Qt6::DBus
)
qt_add_executable(pong
ping-common.h
pong.cpp
)
target_link_libraries(pong PRIVATE
Qt6::Core
Qt6::DBus
)
install(TARGETS ping pong
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -0,0 +1,4 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#define SERVICE_NAME "org.example.QtDBus.PingExample"

View File

@ -0,0 +1,40 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "ping-common.h"
#include <QCoreApplication>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusReply>
#include <iostream>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
auto connection = QDBusConnection::sessionBus();
if (!connection.isConnected()) {
qWarning("Cannot connect to the D-Bus session bus.\n"
"To start it, run:\n"
"\teval `dbus-launch --auto-syntax`\n");
return 1;
}
QDBusInterface iface(SERVICE_NAME, "/");
if (iface.isValid()) {
QDBusReply<QString> reply = iface.call("ping", argc > 1 ? argv[1] : "");
if (reply.isValid()) {
std::cout << "Reply was: " << qPrintable(reply.value()) << std::endl;
return 0;
}
qWarning("Call failed: %s\n", qPrintable(reply.error().message()));
return 1;
}
qWarning("%s\n", qPrintable(connection.lastError().message()));
return 1;
}

View File

@ -0,0 +1,8 @@
QT -= gui
QT += dbus
HEADERS += ping-common.h
SOURCES += ping.cpp
target.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong
INSTALLS += target

View File

@ -0,0 +1,3 @@
TEMPLATE = subdirs
win32:CONFIG += console
SUBDIRS = ping.pro pong.pro

View File

@ -0,0 +1,49 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "ping-common.h"
#include <QObject>
#include <QCoreApplication>
#include <QDBusConnection>
#include <QDBusError>
class Pong : public QObject
{
Q_OBJECT
public slots:
QString ping(const QString &arg);
};
QString Pong::ping(const QString &arg)
{
QMetaObject::invokeMethod(QCoreApplication::instance(), &QCoreApplication::quit);
return QString("ping(\"%1\") got called").arg(arg);
}
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
auto connection = QDBusConnection::sessionBus();
if (!connection.isConnected()) {
qWarning("Cannot connect to the D-Bus session bus.\n"
"To start it, run:\n"
"\teval `dbus-launch --auto-syntax`\n");
return 1;
}
if (!connection.registerService(SERVICE_NAME)) {
qWarning("%s\n", qPrintable(connection.lastError().message()));
exit(1);
}
Pong pong;
connection.registerObject("/", &pong, QDBusConnection::ExportAllSlots);
app.exec();
return 0;
}
#include "pong.moc"

View File

@ -0,0 +1,8 @@
QT -= gui
QT += dbus
HEADERS += ping-common.h
SOURCES += pong.cpp
target.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong
INSTALLS += target