I am trying to setup something very simple but the QML is not resolving my module. Why?
I just following the tutorial below, but it does not use cmake, not sure if this is cmake issue or code.
https://www.youtube.com/watch?v=yTH5e6atHoE
I created a "Colors" subdirectory on my folder structure with a qmldir and "CustomColors_01.qml"
here is my cmake file list:
qt_add_qml_module(appDlgDemo
URI DlgDemo
VERSION 1.0
QML_FILES main.qml
QML_FILES Colors/CustomColors_01.qml
QML_FILES Colors/qmldir
)
My folder structure:
-
│ .gitignore
│ CMakeLists.txt
│ main.cpp
│ main.qml
│
└───Colors
CustomColors_01.qml
qmldir
the qmldir
module Colors
singleton CustomColors 1.0 CustomColors_01.qml
the Colors/CustomColors_01.qml
pragma Singleton
import QtQuick
QtObject{
readonly property string background: "#f6f9f8"
}
the main.qml and it won't resolve "import Colors 1.0", only if I import directly, but this is not what I need.