how to use .qmlproject .ui.qml forms from Design Studio in Qt Creator .pro project?



  • I'm involved in a project that has a designer working in Design Studio to develop .ui.qml forms (with related assets) and me, the developer, working on an existing Qt Creator .pro project. I would like to keep the two projects in separate repositories.

    I'm certain that this is not a new request, but in my initial searches here in the forums, etc. I have not found the information I'm seeking.

    Can I be pointed to a tutorial that covers this? Or a wiki page? Or some other resource on the web that explains how to do what I want to do i.e. use the .ui.qml resources from the .qmlproject in the QtQuick QML files in my .pro project.

    Thanks for any an all pointers.



  • @oria66 Yes, I had read through that portion of the Design Studio manual, but it was still unclear what alternative there is to either copying the resources from the QDS project workspace into the .pro application workspace, or creating the application project from the QDS project in the same workspace.

    Two things helped me achieve the results I was seeking:

    1. set up a separate qds_project.qrc resource file in the application workspace that contains references to the desired .ui.qml files from the QDS project with relative path names as well as an alias attribute on the <file/> elements:
    <qresource prefix="/forms">
        <file alias="AForm">../other_workspace/AForm.ui.qml</file>
    </qresource>
    
    1. add an import "qrc:/forms" to my application .qml wrapper resource file(s)




  • @oria66 Yes, I had read through that portion of the Design Studio manual, but it was still unclear what alternative there is to either copying the resources from the QDS project workspace into the .pro application workspace, or creating the application project from the QDS project in the same workspace.

    Two things helped me achieve the results I was seeking:

    1. set up a separate qds_project.qrc resource file in the application workspace that contains references to the desired .ui.qml files from the QDS project with relative path names as well as an alias attribute on the <file/> elements:
    <qresource prefix="/forms">
        <file alias="AForm">../other_workspace/AForm.ui.qml</file>
    </qresource>
    
    1. add an import "qrc:/forms" to my application .qml wrapper resource file(s)


  • @alpartis yes, indeed. That's the only way I use it. Consider marking this post as "SOLVED".



  • Hello @alpartis

    Thank you for the info. What about import statement of Qt Desing Studio project (in my Qt Creator project)?

    import QtQuick
    import QtQuick.Controls
    import MyQTDesignStudioProject  ###(my project)
    

    I manage to import the ui.qml file but of course, it has the import "MyQTDesignStudioProject" and I get the error:

    "Qml module not found (MyQTDesignStudioProject)"
    or
    "module "MyQTDesignStudioProject" is not installed"

    Are there any extra steps I'm missing? (QML_DESIGNER_IMPORT_PATH? Another path?)

    Thanks, afalsa