Skip to content
Snippets Groups Projects
Commit 7e917fb2 authored by Morten Sorvig's avatar Morten Sorvig
Browse files

Add minimal Qt Quick example

Include qt_qml_imports.json which preloads libquickwindowplugin.so
parent 9c860daa
Branches 6.8
No related tags found
No related merge requests found
project(dynamicquick)
cmake_minimum_required(VERSION 3.19)
find_package(Qt6 COMPONENTS Core Gui Quick)
qt_standard_project_setup()
qt_add_executable(dynamicquick
main.cpp
)
target_link_libraries(dynamicquick PUBLIC
Qt::Core
Qt::Gui
Qt::Quick
)
qt_add_resources(dynamicquick "qml"
PREFIX "/"
FILES
hello.qml
)
install(TARGETS dynamicquick
BUNDLE DESTINATION .
RUNTIME DESTINATION .
)
qt_generate_deploy_app_script(
TARGET dynamicquick
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
# Copy plugin preload files to the build directory.
configure_file(qt_plugins.json qt_plugins.json COPYONLY)
configure_file(qt_qml_imports.json qt_qml_imports.json COPYONLY)
configure_file(qt.conf qt.conf COPYONLY)
import QtQuick
import QtQuick.Window
Window {
width: 640
height: 480
visible: true
Text {
text: "Hello World from dynamically linked Qt Quick!"
font.pointSize: 12
anchors.verticalCenter: parent.verticalCenter
}
}
\ No newline at end of file
#include <QtGui>
#include <QtQml>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine("qrc:/hello.qml");
app.exec();
}
[Paths]
Prefix = /qt
[
{
"source": "$QTDIR/plugins/platforms/libqwasm.so",
"destination": "/qt/plugins/platforms/libqwasm.so"
},
{
"source": "$QTDIR/plugins/imageformats/libqjpeg.so",
"destination": "/qt/plugins/imageformats/libqjpeg.so"
},
{
"source": "qt.conf",
"destination": "/qt.conf"
}
]
[
{
"source": "$QTDIR/qml/QtQuick/Window/libquickwindowplugin.so",
"destination": "/qt/qml/QtQuick/Window/libquickwindowplugin.so"
},
{
"source": "$QTDIR/qml/QtQuick/Window/qmldir",
"destination": "/qt/qml/QtQuick/Window/qmldir"
}
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment