Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Implementing pointers to methods
Forum Updated to NodeBB v4.3 + New Features

Implementing pointers to methods

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 2 Posters 2.3k 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.
  • E Offline
    E Offline
    Eonz
    wrote on last edited by
    #1

    Hi, I would like to write a function that pops up a dialog to allow the user to edit a certain variable. I would like the dialog to be able to make a call back to the original class (or any specified class) to notify that the value changed.

    So now I have to define something like this:

    @typedef void (QObject::*NotifyEvent)();@

    And pass two extra parameters to my function: one for the method and one for the class. This seems a bit cumbersome, plus I'm now worried about inheritance problems, because what if the specified class is not simply a QObject?

    So I was wondering perhaps there are some standard Qt way of doing this sorta thing? Perhaps some defined types so that I don't have to reinvent?

    Any help would be appreciated!

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      http://doc.trolltech.com/latest/signalsandslots.html

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Eonz
        wrote on last edited by
        #3

        Thanks Franzk

        I wasn't certain if signals & slots could be used in this way but it turns out it works beautifully.

        Somehow slots can be communicated as regular character strings and I don't know how it REALLY works but they can passed on as a parameter this way to be connected to elsewhere and that's all I really care about :)

        I'm really starting to like Qt :D

        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