Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how do I reference "styles" from a related QtDS project in my QtQuick application?



  • I'm struggling with knowing how to integrate a Qt Design Studio project into my QtQuick application. For reference, my projects are available here in my github account:

    The QtDS project: https://github.com/alpartis/sunnygui
    The QtQuick app:  https://github.com/alpartis/sunrise
    

    These projects are meant to sit side-by-side on the filesystem so that sunrise can reference sunnygui forms and styles by way of the use of sunnygui.qrc in the sunrise project. sunnygui.qrc contains aliases and references to .ui.qml forms, which, in turn, make use of "styles" also contained in the sunnygui project.

    The problem I'm having at the moment is in successfully referencing the SunScreen.ui.qml (with alias "SunScreenForm") and the "styles" contained therein from SunScreen.qml in the sunrise application.

    Everything appears to be correct in the QtDS project and I'm able to use styles in sunnygui/SunScreen.ui.qml something like this:

    import QtQuick 2.12
    import sunnygui 1.0
    
    Rectangle {
        color: SunStyles.sunshineYellow
    }
    

    There is a qmldir file in sunnygui/imports/sunnygui/ that defines SunStyles.

    Now, over in the QtQuick application project, I have included a sunnygui.qrc resource file that sets up the "SunScreenForm" alias in reference to the ../sunnygui/SunScreen.ui.qml. Consequently, I have sunrise/SunScreen.qml that looks something like this:

    import QtQuick 2.12
    import "qrc:/forms/SunScreenForm"
    
    Item {
        SunScreenForm {    <--- "Unknown component"
        }
    }
    

    What is the "typical" way to integrate the .ui.qml forms from a Qt Design Studio project into a QtQuick application?