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. QML Styling - what is happening in the back

QML Styling - what is happening in the back

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 110 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.
  • M Offline
    M Offline
    Marcos P.
    wrote on last edited by
    #1

    Re: Defining custom colors in qml

    I'm using the same approach to define item positioning in screen (which is described in QML documentation QML Styling)
    However, I'm a little concerned about what is happening in the back of my code.

    As an example, let say this is my code:

    // Style.qml
    pragma Singleton
    import QtQuick 2.0
    QtObject {
     readonly property int posx: 20
     readonly property int posy: 10
    }
    
    // qmldir
    singleton Style 1.0 Style.qml
    
    // in use
    import QtQuick 2.0
    import "."
    
    Text {
     x: Style.posx
     y: Style.posy
     text: "Hello World"
    }
    

    My expectation is that this will behave as const int or #define in C. Basically, the constant value will be replaced at compilation time by the compiler and no binding will be created.

    I have a feeling this is not actually the case, and I would like to understand what is really happening and if there is a way to achieve a behavior similar to what I'm expecting.

    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