-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(demoForQmllsWhatsNew66 VERSION 0.1 LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(Qt6 6.4 REQUIRED COMPONENTS Quick) | ||
|
||
qt_standard_project_setup() | ||
|
||
add_subdirectory(MyModule) | ||
|
||
qt_add_executable(appdemoForQmllsWhatsNew66 | ||
main.cpp | ||
) | ||
|
||
qt_add_qml_module(appdemoForQmllsWhatsNew66 | ||
URI demoForQmllsWhatsNew66 | ||
QML_FILES Main.qml | ||
RESOURCE_PREFIX / | ||
) | ||
|
||
set_target_properties(appdemoForQmllsWhatsNew66 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 | ||
) | ||
|
||
target_link_libraries(appdemoForQmllsWhatsNew66 | ||
PRIVATE Qt6::Quick myModule | ||
) | ||
|
||
install(TARGETS appdemoForQmllsWhatsNew66 | ||
BUNDLE DESTINATION . | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import QtQuick | ||
import QtQuick.Window | ||
import MyModule | ||
|
||
Window { | ||
width: 640 | ||
height: 480 | ||
visible: true | ||
title: qsTr("Hello World") | ||
|
||
MyComponent { | ||
} | ||
component UnknownComponent: Item { | ||
} | ||
UnknownComponent { | ||
} | ||
|
||
Item { | ||
id: myItem | ||
|
||
property int i | ||
} | ||
property int i | ||
property int childI: myItem.i | ||
|
||
function getI() { | ||
f(1, 2, 3); | ||
return myItem.i; | ||
} | ||
|
||
function f(a, b, c) { | ||
if (a) { | ||
b = a + b; | ||
} else { | ||
a = a + myItem.i; | ||
} | ||
let sum = 0; | ||
for (i = a; i < b; i = i + c) { | ||
while (a) { | ||
sum = sum + b - c + a * i; | ||
{ | ||
let i = 32 // not a definition nor usage of i | ||
i = 44 // neither | ||
} | ||
} | ||
} | ||
console.log(sum); | ||
} | ||
|
||
property UnknownComponent myComponent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
qt_add_qml_module(myModule | ||
URI MyModule | ||
QML_FILES MyComponent.qml | ||
RESOURCE_PREFIX / | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import QtQuick 2.15 | ||
|
||
Item { | ||
property string data: "Hello World!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <QGuiApplication> | ||
#include <QQmlApplicationEngine> | ||
|
||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QGuiApplication app(argc, argv); | ||
|
||
QQmlApplicationEngine engine; | ||
const QUrl url(u"qrc:/demoForQmllsWhatsNew66/Main.qml"_qs); | ||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, | ||
&app, []() { QCoreApplication::exit(-1); }, | ||
Qt::QueuedConnection); | ||
engine.load(url); | ||
|
||
return app.exec(); | ||
} |