summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-05-05 15:19:58 +0200
committerhjk <hjk@qt.io>2023-05-05 15:08:23 +0000
commit62f3d29be4e57324d04fa7e0487f0330d684bd1c (patch)
treee68d696843af01a13e20fdbf9174eb4b63b68c49 /tests
parent7581dcd3690b7b52bc7796e30a42fba178b1e4fe (diff)
downloadqt-creator-62f3d29be4e57324d04fa7e0487f0330d684bd1c.tar.gz
Layouting: Introduce Ids for Items
Intenally just wrapping a 'bindTo' result, but less trigger potential for pointer related peladophobia Change-Id: I25171a2675fb0474ce97c04552ac1cf5ffd6ee56 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/layoutbuilder/demo/main.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/manual/layoutbuilder/demo/main.cpp b/tests/manual/layoutbuilder/demo/main.cpp
index 249c159302..fe8d7541ba 100644
--- a/tests/manual/layoutbuilder/demo/main.cpp
+++ b/tests/manual/layoutbuilder/demo/main.cpp
@@ -1,12 +1,16 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
#include "layoutbuilder.h"
#include <QApplication>
-#include <QDebug>
using namespace Layouting;
int main(int argc, char *argv[])
{
+ Id textId;
+
Application app
{
resize(600, 400),
@@ -14,18 +18,22 @@ int main(int argc, char *argv[])
Column {
TextEdit {
+ id(textId),
text("Hallo")
},
- SpinBox {
- text("Quit"),
- onTextChanged([](const QString &text) { qDebug() << text; })
- },
+ Row {
+ SpinBox {
+ onTextChanged([&](const QString &text) { setText(textId, text); })
+ },
- PushButton {
- text("Quit"),
- onClicked([] { QApplication::quit(); })
- },
+ Stretch(),
+
+ PushButton {
+ text("Quit"),
+ onClicked([] { QApplication::quit(); })
+ },
+ }
}
};