QML Custom Style with Qt 6.1.1 and CMake
-
I'm failing at making a custom style for static-compiled Qt 6.1.1 project using CMake. Stumped on what I've missed. Set up a gitlab project that tries to have just the parts I think I need that hopefully will be a useful public reference once I get it working.
https://gitlab.com/christoferjennings/qml-custom-styleThe README has links to docs I tried to follow. The project structure is...
qml-custom-style ├── AStyle │ ├── Button.qml │ ├── astyle.qrc │ └── qmldir ├── CMakeLists.txt ├── README.md ├── main.cpp ├── main.qml └── qml.qrc
There is no
qtquickcontrols2.conf
because I'm trying to make this work for static builds, and as far as I can tell the docs say I should justimport AStyle
inmain.qml
When I run the app I get this...
QQmlApplicationEngine failed to load component qrc:/main.qml:6:1: module "AStyle" is not installed
I'm trying to get the style on the path with this in
CMakeLists.txt
(Modified from this QT Creator doc)set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/qml ${CMAKE_BINARY_DIR}/imports ${CMAKE_PREFIX_PATH}/qml ${CMAKE_PREFIX_PATH}/imports CACHE STRING "" FORCE)
I'm pretty sure there are too many paths in there. Maybe just the first line matters(?) but I've been experimenting and just left the code as-is for now.
I wish I could form a clear question about this. But I feel like I'm just going in circles reading this then that then this then that etc. in the docs. All I can ask is, "what'd I miss?"