File tree Expand file tree Collapse file tree 6 files changed +119
-0
lines changed
Expand file tree Collapse file tree 6 files changed +119
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ set(CMAKE_PROJECT_LICENSE "${PROJECT_LICENSE}")
1212add_subdirectory (pivoter)
1313#add_subdirectory(core)
1414add_subdirectory (src)
15+ add_subdirectory (qmldemo)
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.16)
2+
3+ project (demoForQmllsWhatsNew66 VERSION 0.1 LANGUAGES CXX)
4+
5+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
6+
7+ find_package (Qt6 6.4 REQUIRED COMPONENTS Quick)
8+
9+ qt_standard_project_setup()
10+
11+ add_subdirectory (MyModule)
12+
13+ qt_add_executable(appdemoForQmllsWhatsNew66
14+ main.cpp
15+ )
16+
17+ qt_add_qml_module(appdemoForQmllsWhatsNew66
18+ URI demoForQmllsWhatsNew66
19+ QML_FILES Main.qml
20+ RESOURCE_PREFIX /
21+ )
22+
23+ set_target_properties (appdemoForQmllsWhatsNew66 PROPERTIES
24+ MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
25+ MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
26+ MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR} .${PROJECT_VERSION_MINOR}
27+ MACOSX_BUNDLE TRUE
28+ WIN32_EXECUTABLE TRUE
29+ )
30+
31+ target_link_libraries (appdemoForQmllsWhatsNew66
32+ PRIVATE Qt6::Quick myModule
33+ )
34+
35+ install (TARGETS appdemoForQmllsWhatsNew66
36+ BUNDLE DESTINATION .
37+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
38+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
39+ )
Original file line number Diff line number Diff line change 1+ import QtQuick
2+ import QtQuick.Window
3+ import MyModule
4+
5+ Window {
6+ width: 640
7+ height: 480
8+ visible: true
9+ title: qsTr (" Hello World" )
10+
11+ MyComponent {
12+ }
13+ component UnknownComponent: Item {
14+ }
15+ UnknownComponent {
16+ }
17+
18+ Item {
19+ id: myItem
20+
21+ property int i
22+ }
23+ property int i
24+ property int childI: myItem .i
25+
26+ function getI () {
27+ f (1 , 2 , 3 );
28+ return myItem .i ;
29+ }
30+
31+ function f (a , b , c ) {
32+ if (a) {
33+ b = a + b;
34+ } else {
35+ a = a + myItem .i ;
36+ }
37+ let sum = 0 ;
38+ for (i = a; i < b; i = i + c) {
39+ while (a) {
40+ sum = sum + b - c + a * i;
41+ {
42+ let i = 32 // not a definition nor usage of i
43+ i = 44 // neither
44+ }
45+ }
46+ }
47+ console .log (sum);
48+ }
49+
50+ property UnknownComponent myComponent
51+ }
Original file line number Diff line number Diff line change 1+
2+ qt_add_qml_module(myModule
3+ URI MyModule
4+ QML_FILES MyComponent.qml
5+ RESOURCE_PREFIX /
6+ )
Original file line number Diff line number Diff line change 1+ import QtQuick 2.15
2+
3+ Item {
4+ property string data: " Hello World!"
5+ }
Original file line number Diff line number Diff line change 1+ #include < QGuiApplication>
2+ #include < QQmlApplicationEngine>
3+
4+
5+ int main (int argc, char *argv[])
6+ {
7+ QGuiApplication app (argc, argv);
8+
9+ QQmlApplicationEngine engine;
10+ const QUrl url (u" qrc:/demoForQmllsWhatsNew66/Main.qml" _qs);
11+ QObject::connect (&engine, &QQmlApplicationEngine::objectCreationFailed,
12+ &app, []() { QCoreApplication::exit (-1 ); },
13+ Qt::QueuedConnection);
14+ engine.load (url);
15+
16+ return app.exec ();
17+ }
You can’t perform that action at this time.
0 commit comments