Debian Codegraph @

src/dbus/doc/snippets/code/src_qdbus_qdbusinterface.cpp

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 #include <QDBusInterface>
4 #include <QDBusReply>
5
6 void DBusInterface_main()
7 {
8 //! [0]
9 QDBusInterface remoteApp( "com.example.Calculator", "/Calculator/Operations",
10 "org.mathematics.RPNCalculator" );
11 remoteApp.call( "PushOperand", 2 );
12 remoteApp.call( "PushOperand", 2 );
13 remoteApp.call( "ExecuteOperation", "+" );
14 QDBusReply<int> reply = remoteApp.call( "PopOperand" );
15
16 if ( reply.isValid() )
17 printf( "%d", reply.value() ); // prints 4
18 //! [0]
19 }