Open ochagnon opened 3 years ago
In this commit I solve the C++ side of the problem.
Now it build and link and run:
QQmlApplicationEngine failed to load component
qrc:/main.qml:3:1: Qaterial.ApplicationWindow is not a type
But , that is a bit weird, shouldn't that just work? because in main.cpp
, there is:
qaterial::loadQmlResources();
qaterial::registerQmlTypes();
So, the binary start and can load QML, but the UI of Qt creator still complains that QML module not found (Qaterial)
Ok, so for now all your problems are not related to qt creator but to cmake (which are the one everyone is struggling with starting with cmake) I saw your code and I Will investigate. It is strange since you added the addImportPath
@OlivierLDff thanks, this doc give a few possible fixes for the missing qml in creator itself, I'm also investigating
You should use https://github.com/OlivierLDff/QaterialGallery as a reference
This kind of fix is ugly, because it is hard coded path. When deploying your app it will be a nightmare. Anyway, qaterial's qml files should be embedded in qrc/Qaterial. And there should be a qrc/Qaterial/qmldir in there.
This kind of fix is ugly, because it is hard coded path. When deploying your app it will be a nightmare.
that don't solve everything, there is additional issues
module: "Qaterial.Impl.Icons" is not installed
Anyway, qaterial's qml files should be embedded in qrc/Qaterial. And there should be a qrc/Qaterial/qmldir in there.
how?
Anyway, qaterial's qml files should be embedded in qrc/Qaterial. And there should be a qrc/Qaterial/qmldir in there.
I'm looking at gallery as a reference and I don't see an obvious command that embed Qaterial into the gallery
Yes because you are missing a file in qrc:/Qaterial/Impl/Icons which is only in qrc (because generated)
I opened your example on windows
git clone https://github.com/ochagnon/qaterial-qtcreator-bug
cd qaterial-qtcreator-bug
mkdir build
cd build/
cmake ..
cmake --build . -j
And the app launched.
Did you clean your cmake build folder?
Yes because you are missing a file in qrc:/Qaterial/Impl/Icons which is only in qrc (because generated)
But, how can I add this resource with mine?
I don't see anything in this directory
There is no additional .qrc
loaded in Main.cpp
I don't get any cmake build steps that combine project qml with the Qaterial dependencies :(
You shouldn't have anything to do, that is why it is strange.
For me it worked without any problem.
You should try to rm -rf *
your build folder and do cmake ..
again.
And the app launched. Did you clean your cmake build folder?
yes, the application build and run, but the problem is when I try to open QtCreator designer (very important for development).
First, I had to add import QtQuick 2.12
to my Main.qml
and:
This is where the missing icons error show up. This is probably because I don't use any icons at this point in my Main.qml
. The very minimalistic things I tried to do don't trigger that error.
I tried with Gallery demo app, and I have an other problem.
The problem is only in QtCreator in "Design" mode
I never used design, I know qaterial should be compiled as a plugin for it to work and there is special requirements. Qaterial isn't only qml files. Sorry I don't have time to support that on my free time since I'm not using it but feel free to create a pull request that address the issue
The file you are missing are located in your build folder res/Icons/Generated
& res/Fonts/Generated
Warning: I'm not familiar with
cmake
, my experience had been withqmake
so far. My question will probably be asked again and again, as QT Creator is a popular IDE for Qt/QML applications.I'm trying to use Qaterial with QTCreator. In this Github repo, I provide the code I use to reproduce this problem, with 1 commit per change I perform. You can very easily try yourself.
So, I start from scratch and create a
Test
project that usecmake
. This commit just the initial output of Qt Creator.Then, I add this commit that switch C++ and QML to Qaterial and add dependency build.
But, that don't works, build fail with
Sure, the reason is those files are in
build-Test-Desktop_Qt_5_15_1_clang_64bit-Debug/_deps/qaterial-src/
.From QtCreator cmake integration doc:
So, I tried
find_package(Qaterial)
and output of cmake is:In Qaterial repository, there is no
*config*.cmake
norFind*.cmake
.So, how can I use Qaterial with Qt Creator?