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.1k 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 23 Jan 2019, 12:00 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

    R 1 Reply Last reply 23 Jan 2019, 18:19
    0
    • S Offline
      S Offline
      ScyllaIllciz
      wrote on 23 Jan 2019, 17:49 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
        23 Jan 2019, 12:00

        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

        R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 23 Jan 2019, 18:19 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

        2/3

        23 Jan 2019, 17:49

        • Login

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