Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. When to use Q_PROPERTY
Forum Updated to NodeBB v4.3 + New Features

When to use Q_PROPERTY

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 707 Views 1 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.
  • B Offline
    B Offline
    br1ghtch1p
    wrote on last edited by
    #1

    When does one need to declare and define Q_PROPERTY in a class. Or putting the question another way around, when does a class require Q_PROPERTY?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rolias
      wrote on last edited by
      #2

      Well one case where you would "need" to use it is if you wanted to access a property indirectly through it's name, or wanted to have a class that could be "discovered" through its meta properties. The "help topic":http://qt-project.org/doc/qt-5/properties.html has a pretty good description.

      I know when I'm using Qt Quick for my front end and I want the QML to have access to my C++ getters and setters Q_PROPERTY is the tool I reach for.

      Check out my third course in the trilogy on Qt
      "Integrating Qt Quick with C++"
      http://bit.ly/qtquickcpp
      published by Pluralsight

      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