mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 15:55:27 +08:00
qt 6.5.1 original
This commit is contained in:
29
tests/auto/cmake/test_dbus_module/CMakeLists.txt
Normal file
29
tests/auto/cmake/test_dbus_module/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(test_dbus_module)
|
||||
|
||||
find_package(Qt6DBus 6.0.0 REQUIRED)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(my_srcs mydbusobject.cpp)
|
||||
|
||||
qt_wrap_cpp(moc_files mydbusobject.h)
|
||||
|
||||
qt_generate_dbus_interface(
|
||||
mydbusobject.h
|
||||
${CMAKE_BINARY_DIR}/org.qtProject.Tests.MyDBusObject.xml
|
||||
)
|
||||
|
||||
qt_add_dbus_adaptor(my_srcs
|
||||
${CMAKE_BINARY_DIR}/org.qtProject.Tests.MyDBusObject.xml
|
||||
mydbusobject.h
|
||||
MyDBusObject
|
||||
)
|
||||
|
||||
add_executable(myobject ${my_srcs} ${moc_files})
|
||||
target_link_libraries(myobject PRIVATE Qt6::DBus)
|
18
tests/auto/cmake/test_dbus_module/mydbusobject.cpp
Normal file
18
tests/auto/cmake/test_dbus_module/mydbusobject.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "mydbusobject.h"
|
||||
#include "mydbusobjectadaptor.h"
|
||||
|
||||
MyDBusObject::MyDBusObject(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
new MyDBusObjectAdaptor(this);
|
||||
emit someSignal();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
MyDBusObject myDBusObject;
|
||||
return 0;
|
||||
}
|
20
tests/auto/cmake/test_dbus_module/mydbusobject.h
Normal file
20
tests/auto/cmake/test_dbus_module/mydbusobject.h
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef MYDBUSOBJECT_H
|
||||
#define MYDBUSOBJECT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class MyDBusObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.qtProject.Tests.MyDBusObject")
|
||||
public:
|
||||
MyDBusObject(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void someSignal();
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user