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. Why i am getting error when use new signal slot method ?
Forum Updated to NodeBB v4.3 + New Features

Why i am getting error when use new signal slot method ?

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 4 Posters 914 Views 2 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.
  • Q Qt embedded developer

    I am using below code in constructor. BlinkLabel is public slot.

    when i use below line in my constructor error not come.
    QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel()));

    but when i use new signal slot method i am getting error:

    • error: no matching function for call to &G3_Scan::BlinkLabel

    • error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'

    • /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293: error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'

    INIT_OBJ(qTScanning);
        qTScanning  = new QTimer(this);
        //        time1->setSingleShot(true);
        QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel);
        qTScanning->start(500);
    

    How to resolve this error? what mistake i have done ?

    KroMignonK Offline
    KroMignonK Offline
    KroMignon
    wrote on last edited by
    #3

    @Qt-embedded-developer said in Why i am getting error when use new signal slot method ?:

    QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel);

    As far as I can see, qTScanning is a pointer
    ==> QObject::connect(qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel); is more correct!

    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

    1 Reply Last reply
    4
    • raven-worxR raven-worx

      @Qt-embedded-developer
      are there multiple BlinkLabel methods available (with different signatures)?
      if so, see qOverload

      Q Offline
      Q Offline
      Qt embedded developer
      wrote on last edited by Qt embedded developer
      #4

      @raven-worx no there is only one public slot named BlinkLabel()

      raven-worxR 1 Reply Last reply
      0
      • Q Qt embedded developer

        @raven-worx no there is only one public slot named BlinkLabel()

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by raven-worx
        #5

        @Qt-embedded-developer
        the this pointer is an instance of the class G3_Scan?

        btw: using the old connect syntax might silently fail, but it doesnt mean that the old syntax is working. You would need to check the return value if the connection was successfully established.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        Q 2 Replies Last reply
        0
        • raven-worxR raven-worx

          @Qt-embedded-developer
          the this pointer is an instance of the class G3_Scan?

          btw: using the old connect syntax might silently fail, but it doesnt mean that the old syntax is working. You would need to check the return value if the connection was successfully established.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #6

          @raven-worx i made the mistake due to use of &qTScanning. now my code is working . but i am not getting why i can not use &qTScanning?

          CP71C 1 Reply Last reply
          0
          • Q Qt embedded developer

            @raven-worx i made the mistake due to use of &qTScanning. now my code is working . but i am not getting why i can not use &qTScanning?

            CP71C Offline
            CP71C Offline
            CP71
            wrote on last edited by CP71
            #7

            @Qt-embedded-developer
            Hi
            because qTScanning is already a pointer

            1 Reply Last reply
            1
            • raven-worxR raven-worx

              @Qt-embedded-developer
              the this pointer is an instance of the class G3_Scan?

              btw: using the old connect syntax might silently fail, but it doesnt mean that the old syntax is working. You would need to check the return value if the connection was successfully established.

              Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #8

              @raven-worx How to check return value of successful connection ?

              raven-worxR 1 Reply Last reply
              0
              • Q Qt embedded developer

                @raven-worx How to check return value of successful connection ?

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by raven-worx
                #9

                @Qt-embedded-developer
                return true -> success, false -> failed

                but simply dont use the old connect syntax anymore

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                Q 1 Reply Last reply
                1
                • raven-worxR raven-worx

                  @Qt-embedded-developer
                  return true -> success, false -> failed

                  but simply dont use the old connect syntax anymore

                  Q Offline
                  Q Offline
                  Qt embedded developer
                  wrote on last edited by
                  #10

                  @raven-worx sorry but can you give sample example ?

                  raven-worxR 1 Reply Last reply
                  0
                  • Q Qt embedded developer

                    @raven-worx sorry but can you give sample example ?

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by
                    #11

                    @Qt-embedded-developer

                    if( QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel())) )
                        qDebug() << "GOOD";
                    else
                        qDebug() << "BAD";
                    

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    Q 2 Replies Last reply
                    2
                    • raven-worxR raven-worx

                      @Qt-embedded-developer

                      if( QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel())) )
                          qDebug() << "GOOD";
                      else
                          qDebug() << "BAD";
                      
                      Q Offline
                      Q Offline
                      Qt embedded developer
                      wrote on last edited by
                      #12

                      @raven-worx Thank you

                      1 Reply Last reply
                      1
                      • raven-worxR raven-worx

                        @Qt-embedded-developer

                        if( QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel())) )
                            qDebug() << "GOOD";
                        else
                            qDebug() << "BAD";
                        
                        Q Offline
                        Q Offline
                        Qt embedded developer
                        wrote on last edited by Qt embedded developer
                        #13
                        This post is deleted!
                        CP71C 1 Reply Last reply
                        0
                        • Q Qt embedded developer

                          This post is deleted!

                          CP71C Offline
                          CP71C Offline
                          CP71
                          wrote on last edited by CP71
                          #14

                          @Qt-embedded-developer
                          try delete the build folder from file explorer and rebuild all

                          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