Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qml live bench tool
Forum Updated to NodeBB v4.3 + New Features

qml live bench tool

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 1 Posters 810 Views
  • 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.
  • ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by ODБOï
    #1

    hi,

    Does someone know how to make my qml singleton Component available for the Qml Live Bench tool ?

    The singleton component contains my application style (colors/font ratio ..) , it looks like this

    //Style.qml
    pragma Singleton
    //imports
    Item {
         property string darkBlueColor: "#005490"  
         property string lightBlueColor: "#006BB7"
    //...
    }
    

    and i use it like this

    // MyComponent.qml
    import "style"
    
    Rectangle{
       color : Style.darkBlueColor
    }
    

    but if i run my MyComponent in QML Live Bench i get this output

     Unable to assign [undefined] to QColor
    

    I tryed to add the folder that contains Style.qml to Qml Live Bench by doing :

    File > Preferences... > Import Paths > add

    ODБOïO 1 Reply Last reply
    0
    • ODБOïO ODБOï

      hi,

      Does someone know how to make my qml singleton Component available for the Qml Live Bench tool ?

      The singleton component contains my application style (colors/font ratio ..) , it looks like this

      //Style.qml
      pragma Singleton
      //imports
      Item {
           property string darkBlueColor: "#005490"  
           property string lightBlueColor: "#006BB7"
      //...
      }
      

      and i use it like this

      // MyComponent.qml
      import "style"
      
      Rectangle{
         color : Style.darkBlueColor
      }
      

      but if i run my MyComponent in QML Live Bench i get this output

       Unable to assign [undefined] to QColor
      

      I tryed to add the folder that contains Style.qml to Qml Live Bench by doing :

      File > Preferences... > Import Paths > add

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3

        I found an alternative to this,

        i simply defined my constants in a Js lib (.pragma library) instead of QML Singleton

        // Consts.js
        .pragma library
        
         property string darkBlueColor: "#005490"  
         property string lightBlueColor: "#006BB7"
        
        1 Reply Last reply
        0

        • Login

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