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. Re-use Property
QtWS25 Last Chance

Re-use Property

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 261 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.
  • T Offline
    T Offline
    ThommyB
    wrote on last edited by
    #1

    Hello, everybody,

    I would like to define Probertys like colors, width, height etc. globel and save them in a separate QML file:

    // ProbertyFile.qml
    import QtQuick 2.0
    Item {
    id : probertys
    proberty int aX : 10
    proberty int aY: 12
    proberty int aHeight : 3
    proberty int aWidth : 5
    proberty color aColorBlack : "#000000"
    // etc.
    }

    If I want to access these probertys, they will unfortunately not be used:

    e.g.:
    ...
    color : ProbertyFile.aColorBlack
    ...

    Can someone give me an impression of where my mistake is?

    Thanks for your help, ThommyB

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

      Hello, everybody,

      I would like to define Probertys like colors, width, height etc. globel and save them in a separate QML file:

      // ProbertyFile.qml
      import QtQuick 2.0
      Item {
      id : probertys
      proberty int aX : 10
      proberty int aY: 12
      proberty int aHeight : 3
      proberty int aWidth : 5
      proberty color aColorBlack : "#000000"
      // etc.
      }

      If I want to access these probertys, they will unfortunately not be used:

      e.g.:
      ...
      color : ProbertyFile.aColorBlack
      ...

      Can someone give me an impression of where my mistake is?

      Thanks for your help, ThommyB

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @thommyb hi

      One solution is to define a Singleton
      see here Approach 2: Style Singleton

      @thommyb said in Re-use Property:

      Can someone give me an impression of where my mistake is?

      Reading the Approach 1: Custom Component you should understand where the error is.
      Application output tab of QtCreator sould also show the error line/description

      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