Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How do those crazy Q Macros work?
Qt 6.12 LTS is out! See what's new in the release blog

How do those crazy Q Macros work?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 341 Views 3 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.
  • D Offline
    D Offline
    DSpUz
    wrote on last edited by
    #1

    Hello fellow Qt Devs,

    I do not quite understand how the so called "signal" can change value of a property(whatever hides behind that keyword) while there is no visible Object instance.
    And what is the "FINAL" custom type meant for in the Q_PROPERTY signature cause it doesn't change the result.
    crazy_macros.png

    https://github.com/DSpUz

    JKSHJ 1 Reply Last reply
    0
    • D Offline
      D Offline
      DSpUz
      wrote on last edited by
      #2

      Apparently the QML_SINGLETON macro the Singleton object is automatically created with default constructor when a QML Engine accesses it so thats why one can call its setters or whatever, at least it is said like that in the next video after the implementation

      https://github.com/DSpUz

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        You can find everything around Q_PROPERTY in this chapter of the Qt documentation.

        FINAL means that you cannot shadow this property in a subclass.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • D DSpUz

          Hello fellow Qt Devs,

          I do not quite understand how the so called "signal" can change value of a property(whatever hides behind that keyword) while there is no visible Object instance.
          And what is the "FINAL" custom type meant for in the Q_PROPERTY signature cause it doesn't change the result.
          crazy_macros.png

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          @DSpUz said in How do those crazy Q Macros work?:

          there is no visible Object instance.

          There IS an object instance! The singleton is an instance.

          I do not quite understand how the so called "signal" can change value of a property

          A NOTIFY signal tells the QML engine to discard the old (cached) property value and read it again.

          When your Globals singleton (instance) emits the numberChanged signal, the QML engine re-reads Globals.number and updates the text.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          2
          • D DSpUz has marked this topic as solved on

          • Login

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