summaryrefslogtreecommitdiffstats
path: root/examples/interfaceframework/remote/Main.qml
blob: 4e66f12258d53f9c4ec2a3b7927d988db0870a3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Controls
import QtQuick.Window
//! [0]
import Example.If.RemoteModule

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("QtIF Remote example")

    UiProcessingService {
        id: processingService
    }
//! [0]

    Column {
        anchors.fill: parent
        anchors.margins: 10

        Row {
            //! [1]
            Button {
                text: "Process"

                onClicked: processingService.process(inputField.text).then(
                    function(result) { //success callback
                        resultLabel.text = result
                    },
                    function() { //failure callback
                        resultLabel.text = "failed"
                    } )
            }
            //! [1]
            TextField {
                placeholderText: "text to process"
                id: inputField
            }
        }

        Row {
            Text { text: "Processing result: " }
            Text { id: resultLabel }
        }
        //! [2]
        Row {
            Text { text: "Last message: " }
            Text {
                id: serverMessage
                text: processingService.lastMessage
            }
        }
        //! [2]
    }
}