Custom Quick Controls Style not found
-
Only thing I can find for how to make a custom style is this:
https://doc.qt.io/qt-6/qtquickcontrols-customize.html#creating-a-custom-style
Trying to follow that, I created the following structure:
Test/ test.qml MyStyle/ qmldir Button.qml
When I
cd
into Test and runqml -style MyStyle test.qml
, I getmodule "MyStyle" is not installed
but it's in the current directory which is supposed to part of the import path.Anyone know what's wrong here?
qmldir:
module MyStyle Button 2.15 Button.qml
Button.qml
import QtQuick import QtQuick.Templates as T T.Button { background: Rectangle { color: "#ff9900" } contentItem: Text { text: parent.text color: "black" } }
test.qml:
import QtQuick import MyStyle Pane { width: 600 height: 600 Column { anchors.fill: parent padding: 50 spacing: 25 Row { spacing: 25 Button { text: "Button" } Button { text: "Button"; enabled: false } } Row { spacing: 25 CheckBox { text: "Checkbox" } CheckBox { text: "Checkbox"; checked: true } } Row { spacing: 25 Switch {} Switch { checked: true } } Label { text: "Label" } } }
-
Welp, even though I think the docs says that the directory containing the current file is automatically part of the import path, it doesn't seem to be the case. If I do this, it works:
QML_IMPORT_PATH=. qml -style MyStyle test.qml