Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

Style singleton



  • Hi
    I want to implement the 'Style singleton' pattern.
    My project files are contained in a folder and this has one subfolder named Style
    This subfolder contains 2 files :
    Style.qml -

    import QtQuick 2.0
    
    QtObject {
        property color systemControlColor: "#B7B865"
    }
    

    and qmldir -

    module Style
    singleton Style 1.0 Style.qml
    

    Then I attempt to import -

    import Style 1.0
    

    But this gives me an error

    module "Style" is not installed
    

    What am I missing ?

    Thanks



  • I'm using a subfolder "style/Style.qml + qmldir" and in qml file just import "style", works for me.


  • Moderators

    @GrahamLa said in Style singleton:

    My project files are contained in a folder and this has one subfolder named Style

    is this folder in (one of) the qml import path? If not you need to add the path to folder containing the Style-folder to it.

    Also you can put the folder (in a relative) subfolder to the qml file importing it inside the qrc file.


Log in to reply