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. Q_PROPERTY Vs Q_INVOKABLE

Q_PROPERTY Vs Q_INVOKABLE

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 1.7k 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.
  • Q Offline
    Q Offline
    QtQmlLearner
    wrote on last edited by
    #1

    Hi,

    Can anyone help me with the understanding of Q_PROPERTY and Q_INVOKABLE.
    I am really trying to understand what are the advantages and disadvantages of using these two properties? When i can go for Q_PROPERTY and Q_INVOKABLE?

    Also i understand that :
    Q_INVOKABLE is used to make functions accessible throughout Qt meta object system. Q_PROPERTY is much more complex and offers additional features.

    But when it comes for selection of these two properties then which one i can use in my application? If i am following MVC pattern then what will be the best way to proceed?

    jsulmJ 1 Reply Last reply
    0
    • Q QtQmlLearner

      Hi,

      Can anyone help me with the understanding of Q_PROPERTY and Q_INVOKABLE.
      I am really trying to understand what are the advantages and disadvantages of using these two properties? When i can go for Q_PROPERTY and Q_INVOKABLE?

      Also i understand that :
      Q_INVOKABLE is used to make functions accessible throughout Qt meta object system. Q_PROPERTY is much more complex and offers additional features.

      But when it comes for selection of these two properties then which one i can use in my application? If i am following MVC pattern then what will be the best way to proceed?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @QtQmlLearner said in Q_PROPERTY Vs Q_INVOKABLE:

      Q_INVOKABLE is used to make functions accessible throughout Qt meta object system

      Yes, that's all it does,
      Q_PROPERTY has more possibilities to access members of a class: you can define setter and getter, notifications and more. So, what to select really depends on what you need. If you only want to make a method invocable then use Q_INVOKABLE, if you need something like a property with getter/setter/... then use Q_PROPERTY.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      5

      • Login

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