Cmake integration of Design Studio and Creator
-
Hi
I am attempting to create a project where the frontend is done in Design Studio, and all the backend logic in QT Creator. I am using CMake and ideally I'd like to be able to work in both simultaneously, rather than designing first, then converting the project to write the backend.
I have followed this guide: Converting UI Projects to Applications but I receive errors related to not being able to load library:
qrc:/qml/imports/<project_name>/Constants.qml:3:1: Cannot load library in C:\<PATH>\QtQuick\Studio\Application\quickstudioapplicationplugin.dll: The specified module could not be found.
Could this be because I am using Cmake but following the guide for Qmake?
Is there updated documentation for a Cmake integration of Design Studio and Creator?
Are there other available resources that explain how a project can be used simultaneously in DS and Creator?Thank you
Edit:
I have also followed the steps in Designer-Developer Workflow using the AuroraCluster example code from Git and still get the same error. -
@Naza @hamilt thanks for pointing this out! The CMake support is really problematic still I agree, but we are fixing those as they are discovered. If I look at the qmake branch on github, I can see: "This branch is 1 commit ahead, 15 commits behind dev." meaning it has probably diverged from the dev branch. What we do release-wise (again AFAIK) is that Qt 5 kit pulls the components from 5.15 branch, not qmake and Qt6 pulls from 'dev' branch.
It's clear to mention here these steps apply to Studio-category elements. If there are other things missing preventing the compilation - that's another story. Qt Quick Timeline for example is a separate module that needs to be installed with maintenance tool (or installer). I checked and it's present in installer for 5.15 and 6.x environments.
I kinda took the plunge and did it myself too. So started from Qt DS and created basic 2D scene project, added some Studio components to it. Clicked 'Generate CMakefiles' and closed Qt DS. Opened the CMakefiles.txt with Qt Creator and tried to compile -> faced the same error you have been facing.
Pulled the components from the repo, compiled with Qt Creator (on clangd as I'm on mac) and installed it to Qt 6.4 (tick 'install' box in build settings). Then re-opened my own application - at least my basic app worked now ok and I could see my button on the screen.
-
Hey!
So, let's get the first some right. You have project done in Qt Design Studio and you are transferring that to Qt Creator, right? I cannot see what is the module your error is about in detail but from the path I can see that the so-called 'Studio' components are missing perhaps from your Qt environment. One thing also I cannot see is that are you using Qt5 or Qt6 kit.The error you see is that Qt Creator does not find the designer components. From the wiki you mentioned: https://doc.qt.io/qtdesignstudio/quick-converting-ui-projects.html there is a section 'Adding Qt Quick Designer Components to Qt Installations'. which describes the steps you should take.
Qt Design Studio (latest version out there is 3.6) supports CMake creation, so unless you selected 'Generate CMake build files' from the menu of Qt DS, you should do it now.
Do the steps there help you forward? If not, feel free to reply and let's work on your problem together.
We are currently working on a solution that allows user to install the Qt Design Studio components into Qt kit so Qt Creator can use those directly, we'll publish more information about that later.
-
@Jarko-Vihriala Thank you for your reply. I am using Qt 6.3.0, Qt DS 3.6.0 and Cmake 3.24.1.
In the section "Adding Qt Quick Designer Components to Qt Installations" I was able to install the Designer components through qmake, but not cmake. (Used Visual Studio 2022 Command Prompt, x64 Native Tools for nmake.) I have generated cmake files through Qt DS, but there are still issues present.
I have tried three different approaches: creating my own project in Qt DS and transfer it to Creator, running and building the AuroraCluster example mentioned in the previous post in Qt DS and transferred it to a Creator project, and running the Design Studio examples provided in the Welcome tab of Qt Creator, e.g. CoffeeMachine.
When I try to build and run projects from Creator I get errors that types are unavailable, and either that a library cannot be loaded, or that modules are missing. Take these examples below:
My own Qt DS program:
qrc:/qml/contents/Screen01.ui.qml: Type Constans unavailable qrc:/qml/imports/UntitledProject/Constants.qml:3:1: Cannot load library <path>\QtQuick\Studio\Application\quickstudioapplicationplugin.dll: The specified module could not be found.
I have created this project in Qt DS, built cmake files, moved the files to a freshly created Creator project and added them to a resource file. I have also confirmed that the path leads to an existing dll file.
AuroraCluster:
file:///c:/QTproj/build-aurora-Desktop-Debug/qml/content/CarViewScreen.ui.qml:16:5: Type Kphdial unavailable file:///c:/QTproj/build-aurora-Desktop-Debug/qml/content/ClusterDials/Kphdial.ui.qml:2:1: module "QtQuick.Timeline" is not installed.
I have run this code example in Qt DS, and followed the same process as above for my own project, but get slightly different errors.
CoffeMachine:
<path>/qtcreator/examples/CoffeeMachine/content/App.qml:41:5: Type ApplicationFlow unavailable <path>/qtcreator/examples/CoffeeMachine/content/ApplicationFlow.qml:54:5: Type ApplicationFlowForm unavailable <path>/qtcreator/examples/CoffeeMachine/content/ApplicationFlowForm.ui.qml:53:1: module "QtQuick.Timeline" is not installed
This project is shown as one of the examples in Qt Creator on the Welcome page. No modifications were made, I just tried to run it as-is, and it shows the same type of errors as AuroraCluster.
What could be the cause of these issues? The example code seems to have the same exact same issues, but the documentation says that Timeline modules should not be an issue since I am using a version newer than Qt 5.14. The project I created myself from scratch claims a dll file that exists in that path could not be found. Do I need to reconfigure Qt Creator, or the projects themselves somehow to be able to detect the missing modules/dll files, or what could be the issue?
Thank you for your help.
-
Hello, I have the same problem。when i run Qt DS project in Qt creator , i get the error follow.
qrc:/Qmlprotype/Constants.qml:3:1: module "QtQuick.Studio.Application" is not installed”
I used qmake to install Adding Qt Quick Designer Components to Qt Installations。
When i checked the qtquickdesigner-components source files. I found there is no QtQuick.Studio.Application module in branch qmake, but found in dev branch.
Then i use cmake and gcc(clang is not avaliable) to build it , as expected it runs successfully.
-
@Naza @hamilt thanks for pointing this out! The CMake support is really problematic still I agree, but we are fixing those as they are discovered. If I look at the qmake branch on github, I can see: "This branch is 1 commit ahead, 15 commits behind dev." meaning it has probably diverged from the dev branch. What we do release-wise (again AFAIK) is that Qt 5 kit pulls the components from 5.15 branch, not qmake and Qt6 pulls from 'dev' branch.
It's clear to mention here these steps apply to Studio-category elements. If there are other things missing preventing the compilation - that's another story. Qt Quick Timeline for example is a separate module that needs to be installed with maintenance tool (or installer). I checked and it's present in installer for 5.15 and 6.x environments.
I kinda took the plunge and did it myself too. So started from Qt DS and created basic 2D scene project, added some Studio components to it. Clicked 'Generate CMakefiles' and closed Qt DS. Opened the CMakefiles.txt with Qt Creator and tried to compile -> faced the same error you have been facing.
Pulled the components from the repo, compiled with Qt Creator (on clangd as I'm on mac) and installed it to Qt 6.4 (tick 'install' box in build settings). Then re-opened my own application - at least my basic app worked now ok and I could see my button on the screen.
-
After a fresh installation I was able to get it working by selecting the correct components. I could not find them in the maintenance tool or installer but could be found in Qt/tools/QtCreator/8.0/bin/qml/QtQuick and had to be moved to the corresponding Design studio folder. Thanks for the help!
-
@Jarko-Vihriala said in Cmake integration of Design Studio and Creator:
We are currently working on a solution that allows user to install the Qt Design Studio components into Qt kit so Qt Creator can use those directly, we'll publish more information about that later.
This feature is also expected for me, Hope to come soon.
-
@Jarko-Vihriala said in Cmake integration of Design Studio and Creator:
We are currently working on a solution that allows user to install the Qt Design Studio components into Qt kit so Qt Creator can use those directly, we'll publish more information about that later.
Those components were based on the deprecated Qt Graphical Effects module.
Now that Qt Quick Effect Maker is published (https://www.qt.io/blog/introducing-qt-quick-effect-maker ), I'd imagine that the Qt Design Studio Components would be ported to the new technology, is that right?
-
I'm running into this same issue - specifically, with the step on the "Adding Qt Quick Designer Components to Qt Installations" section that says to run nmake and nmake install on the module. I opened a terminal using the build environment at the root folder of my project, and that allowed me to run qmake, but doesn't seem to allow nmake or make. Is there something else I need to install to do this?
-
Hey guys! I was in a similar situation, where I wanted to work on both Creator and Design Studio at the same time. I got a setup working that allows me to do so.
Basically, I created a Design Studio project. This created a bunch of files and automatic things that lets Design Studio build/run the project.
I then also created a Qt Creator project with its own cmake files and everything.
The general file structure is as follows:
parentQtCreatorFolder
--Main.cpp
--CMakeLists.txt
--cppSrcFolder (contains handlers and rest of app)
--qmlSrcFolder
----DSProjectFolder (ENTIRE project folder that DesignStudio generates)
------DSProject.qrc (created this using DS's export function)
------ all typical DS project files along with my qml using the standard defaultimports/content/etc structureIn parentQtCreatorFolder's CMakeLists, I target the qrc file so that QtCreator knows where to find my QML resources
# App import dirs list(APPEND QML_IMPORT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/qml/DS_Project/imports/DS_Project") list(APPEND QML_IMPORT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/qml/DS_Project/content") set (QML_IMPORT_PATH ${QML_IMPORT_PATH} CACHE STRING "Qt Creator extra qml import paths" FORCE) # Executable target file(GLOB_RECURSE SOURCES "./cpp/*.h" "./cpp/*.hpp" "./cpp/*.cpp" "main.cpp") file(GLOB_RECURSE QML_SOURCES "./qml/DS_Project/App.qml") file(GLOB_RECURSE LOCAL_QRC_FILES "./qml/DS_Project/DS_Project.qrc") add_executable(my-app ${SOURCES} ${QML_SOURCES} ${QRC_SOURCES} )
With this, I was able to target the correct qml resources in my app's main.cpp
// Set engine to look for subfolders which could be modules engine.addImportPath(QStringLiteral("qrc:/")); engine.addImportPath("qrc:/imports/"); // Adding imports paths engine.addImportPath("qrc:/content/"); // Adding imports paths // Load main.qml from path with respect to current main.cpp engine.load(QStringLiteral("../QtCreatorParentFolder/qml/DS_Project/content/App.qml"));