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. Q_INVOKABLE vs. slots
QtWS25 Last Chance

Q_INVOKABLE vs. slots

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 25.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.
  • M Offline
    M Offline
    mario
    wrote on 17 Aug 2010, 08:12 last edited by
    #1

    I'm just curious, is it more lightweight to mark a method with Q_INVOKABLE than as a slot?

    Is it more of a design question to mark a method with Q_INVOKABLE, for instance a method that calculates and returns a value but is not inteeded to be used with signals.

    1 Reply Last reply
    1
    • K Offline
      K Offline
      kkoehne
      Moderators
      wrote on 18 Aug 2010, 14:12 last edited by
      #2

      Invokable methods are like slots are made available through the metatype system, so I don't think it's more "lightweight". The difference is rather a semantic one (do you want to use it for signal/slot connections? Or is it just about making a method available in QtScript?). Also, constructors can be marked as Q_INVOKABLE, while they cannot be slots.

      Director R&D, The Qt Company

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mario
        wrote on 18 Aug 2010, 19:26 last edited by
        #3

        Thanks kkoehne, you confirmed what I expected.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on 26 Aug 2010, 13:18 last edited by
          #4

          Can I somehow mark static methods with Q_INVOKABLE and use them in QtScript without needance to write huge binding for this method?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Smar
            wrote on 26 Aug 2010, 15:19 last edited by
            #5

            You might want create separate thread for this...

            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