FedoraQt / adwaita-qt

A style to bend Qt applications to look like they belong into GNOME Shell
Other
488 stars 48 forks source link

Qt Quick Controls apps support #198

Open versusvoid opened 7 months ago

versusvoid commented 7 months ago

After setting QT_STYLE_OVERRIDE=Adwaita (or -style Adwaita) Qt Quick Controls app will fail to start (testing on Text Editor example)

$ env QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1 QT_STYLE_OVERRIDE=Adwaita ./texteditorexample
...
qt.core.plugin.loader: Found metadata in lib /usr/lib/qt6/plugins/styles/adwaita.so, metadata=
{
    "IID": "org.qt-project.Qt.QStyleFactoryInterface",
    "MetaData": {
        "Keys": [
            "Adwaita",
            "Adwaita-Dark",
            "Adwaita-HighContrast",
            "Adwaita-HighContrastInverse",
            "HighContrast",
            "HighContrastInverse"
        ]
    },
    "archlevel": 3,
    "className": "StylePlugin",
    "debug": false,
    "version": 394752
}
...
QQmlApplicationEngine failed to load component
qrc:/qml/texteditor.qml: module "Adwaita" is not installed

This is due Qt Quick Controls using the name of global style override to search for QML module implementing the style.\ (this only happens if such style plugin exists, with QT_STYLE_OVERRIDE=non-existent app will run fine)

To allow app to run there should exist QML module for custom style /usr/lib/qt6/qml/Adwaita/qmldir:

module "Adwaita"
ApplicationWindow 1.0 ApplicationWindow.qml

with at least one .qml file (using ApplicationWindow as example)

//  /usr/lib/qt6/qml/Adwaita/ApplicationWindow.qml
import QtQuick
import QtQuick.Templates as T

T.ApplicationWindow {
    color: 'black'
}

(and analogous for Adwaita-Dark)


Not sure if you actually should implement such, more of heads up to people stumbling on same problem.