summaryrefslogtreecommitdiffstats
path: root/src/dbus/doc/snippets/code/src_qdbus_qdbusinterface.cpp
blob: 06d654b97b00a18a241c181318e0c21c8fb2bffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QDBusInterface>
#include <QDBusReply>

void DBusInterface_main()
{
//! [0]
QDBusInterface remoteApp( "com.example.Calculator", "/Calculator/Operations",
                          "org.mathematics.RPNCalculator" );
remoteApp.call( "PushOperand", 2 );
remoteApp.call( "PushOperand", 2 );
remoteApp.call( "ExecuteOperation", "+" );
QDBusReply<int> reply = remoteApp.call( "PopOperand" );

if ( reply.isValid() )
    printf( "%d", reply.value() );          // prints 4
//! [0]
}