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. Using delegate
QtWS25 Last Chance

Using delegate

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 3.9k 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.
  • A Offline
    A Offline
    azaturkmen
    wrote on last edited by
    #1

    Hi,

    I am new in Qt C++. I want to use a delegate feature as in Objective-C. How can I use such a thing?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brandont
      wrote on last edited by
      #2

      See "Wikipedia":http://en.wikipedia.org/wiki/Delegation_pattern#Complex_C.2B.2B_example . Is that what you mean?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DenisKormalev
        wrote on last edited by
        #3

        Don't know how ObjC implements delegation, but if we are speaking about OO delegation mechanism, then maybe you can do what you need with signal-slots mechanism?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          azaturkmen
          wrote on last edited by
          #4

          I have IconDownloader class. it downloads image asyncranously and i want it to trigger owner class's method.

          @Objective-C

          • (void)showImage:
            {
            IconDownloader *iconDownloader = [[IconDownloader alloc] init];
            iconDownloader.imageUrl = "http://www.a.com./image.jpg";
            iconDownloader.delegate = self;
            [iconDownloader startDownload];
            [iconDownloader release];
            }

          // called by our IconDownloader class when an icon is ready to be displayed

          • (void)appImageDidLoad:(NSIndexPath *)indexPath
            {
            ....
            }
            @
          1 Reply Last reply
          0
          • F Offline
            F Offline
            Franzk
            wrote on last edited by
            #5

            Use "signals & slots":http://doc.trolltech.com/latest/signalsandslots.html as Denis proposed.

            "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
            • A Offline
              A Offline
              azaturkmen
              wrote on last edited by
              #6

              thanks for help :)

              I understand now. we can declare our own signals. ok.

              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