summaryrefslogtreecommitdiff
path: root/tests/manual/layoutbuilder/demo/main.cpp
blob: 2dd95dfddbf7953fadbdcd4d0285dd30c433a557 (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include "layoutbuilder.h"

#include <QApplication>

using namespace Layouting;

int main(int argc, char *argv[])
{
    ID textId;

    Application app
    {
        resize(600, 400),
        title("Hello World"),

        Column {
            TextEdit {
                id(textId),
                text("Hallo")
            },

            Row {
                SpinBox {
                    onTextChanged([&](const QString &text) { setText(textId, text); })
                },

                Stretch(),

                PushButton {
                    text("Quit"),
                    onClicked(QApplication::quit)
                },
             }
        }
    };

    return app.exec(argc, argv);
}