Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Style singleton
Forum Updated to NodeBB v4.3 + New Features

Style singleton

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmldirstyling
3 Posts 3 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GrahamLa
    wrote on last edited by
    #1

    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

    raven-worxR 1 Reply Last reply
    0
    • S Offline
      S Offline
      ScyllaIllciz
      wrote on last edited by ScyllaIllciz
      #2

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

      1 Reply Last reply
      0
      • G GrahamLa

        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

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by raven-worx
        #3

        @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.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved