summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-05-04 08:26:31 +0200
committerhjk <hjk@qt.io>2023-05-05 13:09:02 +0000
commitd5329d56b641e690bfab9b492dee089071905a93 (patch)
tree968645dde2073618ecd5805d08ef4a5fa19d4f5a /tests
parent652e99830fe00e32b9ea774920a34fde7eb79698 (diff)
downloadqt-creator-d5329d56b641e690bfab9b492dee089071905a93.tar.gz
Layouting: Add demo
Currently almost the same as the comparison example, but planeed to grow. Change-Id: Id129266a1b5b12438e2fb643ee114e6d816581f6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/layoutbuilder/demo/CMakeLists.txt44
-rw-r--r--tests/manual/layoutbuilder/demo/main.cpp33
-rw-r--r--tests/manual/layoutbuilder/demo/mainwindow.cpp0
-rw-r--r--tests/manual/layoutbuilder/demo/mainwindow.h0
4 files changed, 77 insertions, 0 deletions
diff --git a/tests/manual/layoutbuilder/demo/CMakeLists.txt b/tests/manual/layoutbuilder/demo/CMakeLists.txt
new file mode 100644
index 0000000000..3a93056bea
--- /dev/null
+++ b/tests/manual/layoutbuilder/demo/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(layoutbuilderdemo VERSION 0.1 LANGUAGES CXX)
+
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
+
+set(PROJECT_SOURCES
+ main.cpp
+ ../../../../src/libs/utils/layoutbuilder.h
+ ../../../../src/libs/utils/layoutbuilder.cpp
+)
+
+add_executable(layoutbuilderdemo
+ ${PROJECT_SOURCES}
+)
+
+target_include_directories(layoutbuilderdemo PRIVATE
+ ../../../../src/libs/utils/
+)
+
+target_link_libraries(layoutbuilderdemo PRIVATE
+ Qt6::Widgets
+)
+
+set_target_properties(layoutbuilderdemo PROPERTIES
+ MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
+ MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
+ MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
+ MACOSX_BUNDLE TRUE
+ WIN32_EXECUTABLE TRUE
+)
+
+install(TARGETS layoutbuilderdemo
+ BUNDLE DESTINATION .
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
diff --git a/tests/manual/layoutbuilder/demo/main.cpp b/tests/manual/layoutbuilder/demo/main.cpp
new file mode 100644
index 0000000000..249c159302
--- /dev/null
+++ b/tests/manual/layoutbuilder/demo/main.cpp
@@ -0,0 +1,33 @@
+#include "layoutbuilder.h"
+
+#include <QApplication>
+#include <QDebug>
+
+using namespace Layouting;
+
+int main(int argc, char *argv[])
+{
+ Application app
+ {
+ resize(600, 400),
+ title("Hello World"),
+
+ Column {
+ TextEdit {
+ text("Hallo")
+ },
+
+ SpinBox {
+ text("Quit"),
+ onTextChanged([](const QString &text) { qDebug() << text; })
+ },
+
+ PushButton {
+ text("Quit"),
+ onClicked([] { QApplication::quit(); })
+ },
+ }
+ };
+
+ return app.exec(argc, argv);
+}
diff --git a/tests/manual/layoutbuilder/demo/mainwindow.cpp b/tests/manual/layoutbuilder/demo/mainwindow.cpp
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/manual/layoutbuilder/demo/mainwindow.cpp
diff --git a/tests/manual/layoutbuilder/demo/mainwindow.h b/tests/manual/layoutbuilder/demo/mainwindow.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/manual/layoutbuilder/demo/mainwindow.h