Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved Re-use Property

    QML and Qt Quick
    2
    2
    117
    Loading More Posts
    • 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
      ThommyB last edited by

      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ï 1 Reply Last reply Reply Quote 0
      • ODБOï
        ODБOï @ThommyB last edited by ODБOï

        @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 Reply Quote 0
        • First post
          Last post