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. Slot never called
Forum Updated to NodeBB v4.3 + New Features

Slot never called

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 5 Posters 6.1k Views 4 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #6

    Hi,
    please post the full source code.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #7

      @Helson said:

      C2248: 'Downloader::finished' : cannot access protected member declared in class 'Downloader'

      Looks like you misplaced something. finished() should be a public method (a signal). Posting your code is a good idea as @Wieland suggested.

      kshegunovK 1 Reply Last reply
      0
      • H Offline
        H Offline
        Helson
        wrote on last edited by Helson
        #8

        Here is the code:

        http://pastebin.com/H9dVD3QZ

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #9

          Hi
          note:
          its Qt4

          1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            @Helson said:

            C2248: 'Downloader::finished' : cannot access protected member declared in class 'Downloader'

            Looks like you misplaced something. finished() should be a public method (a signal). Posting your code is a good idea as @Wieland suggested.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #10

            @Chris-Kawa

            Looks like you misplaced something. finished() should be a public method (a signal).

            Chris, in Qt4 signals used to be protected, so it might be simply that he's using a bit older version than we assumed. ;)

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #11

              awww, ok. Good catch guys.

              @Helson so just replace

              connect(d, &Downloader::finished, d, &Downloader::deleteLater);
              

              with

              connect(d, SIGNAL(finished()), d, SLOT(deleteLater()));
              

              and think about upgrading to Qt5. Especially since you're following tutorials there's no point in learning obsolete stuff.

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @Chris-Kawa said:
                connect(d, SIGNAL(finished()), d, SLOT(deleteLater()));

                we did. still said it was protected ?!
                so we moved to ctor in Download class

                1 Reply Last reply
                0
                • Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  @mrjj

                  so we moved to ctor in Download class

                  Don't do that. It makes your class dependent on being created on the heap, which you can't guarantee. If someone creates it on the stack you will crash on double delete.

                  mrjjM 1 Reply Last reply
                  1
                  • Chris KawaC Chris Kawa

                    @mrjj

                    so we moved to ctor in Download class

                    Don't do that. It makes your class dependent on being created on the heap, which you can't guarantee. If someone creates it on the stack you will crash on double delete.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #14

                    @Chris-Kawa
                    Ah yes I see. Luckily we did not do it, ;)
                    we moved to dodownload member function and
                    used old syntax.

                    Im not used to Qt4 so the whole protected signals were
                    confusing.

                    kshegunovK 1 Reply Last reply
                    1
                    • mrjjM mrjj

                      @Chris-Kawa
                      Ah yes I see. Luckily we did not do it, ;)
                      we moved to dodownload member function and
                      used old syntax.

                      Im not used to Qt4 so the whole protected signals were
                      confusing.

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #15

                      Im not used to Qt4 so the whole protected signals were
                      confusing.

                      If you think about it, semantically it's more correct that signals are protected. A signal is raised from the object itself to notify others and in principle shouldn't be available for others to emit it! My suspicion is that they're now public because of the new way of connecting, which by my opinion is not such an improvement over the old one.

                      PS.
                      Is it me, or the forum is going nuts? I have the distinct feeling that I see Helson's posts as mrjj's?

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      2
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        hi, I talked with him in chat also, so I did post here.
                        Forums crash every 2 minutes for me though.

                        kshegunovK 1 Reply Last reply
                        1
                        • mrjjM mrjj

                          hi, I talked with him in chat also, so I did post here.
                          Forums crash every 2 minutes for me though.

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #17

                          @mrjj
                          Yes, but who are you? Are you indeed mrjj, or there's some bug in the forum and you're in fact Helson? :)

                          Read and abide by the Qt Code of Conduct

                          mrjjM 1 Reply Last reply
                          0
                          • kshegunovK kshegunov

                            @mrjj
                            Yes, but who are you? Are you indeed mrjj, or there's some bug in the forum and you're in fact Helson? :)

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by mrjj
                            #18

                            @kshegunov
                            Heh. Im mrjj
                            (i hope)

                            kshegunovK 1 Reply Last reply
                            1
                            • mrjjM mrjj

                              @kshegunov
                              Heh. Im mrjj
                              (i hope)

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by
                              #19

                              @mrjj
                              Ok, because I would have expected this:

                              Ah yes I see. Luckily we did not do it, ;)
                              we moved to dodownload member function and
                              used old syntax.

                              to be written by Helson. So it's my mistake, sorry for the misunderstanding. :)

                              Read and abide by the Qt Code of Conduct

                              mrjjM 1 Reply Last reply
                              0
                              • kshegunovK kshegunov

                                @mrjj
                                Ok, because I would have expected this:

                                Ah yes I see. Luckily we did not do it, ;)
                                we moved to dodownload member function and
                                used old syntax.

                                to be written by Helson. So it's my mistake, sorry for the misunderstanding. :)

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #20

                                @kshegunov
                                well You should have the credits as you solved it :)
                                and sorry for writing a bit unclear :)

                                kshegunovK 1 Reply Last reply
                                1
                                • mrjjM mrjj

                                  @kshegunov
                                  well You should have the credits as you solved it :)
                                  and sorry for writing a bit unclear :)

                                  kshegunovK Offline
                                  kshegunovK Offline
                                  kshegunov
                                  Moderators
                                  wrote on last edited by
                                  #21

                                  @mrjj
                                  Thanks for the credits, although I'm not sure how much I care about them, still I appreciate the sentiment. :)

                                  Read and abide by the Qt Code of Conduct

                                  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