Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116060

Reg 6.4.3->6.5.1 QTimer - signal/slot connection not working

    XMLWordPrintable

Details

    • 4368179c3 (dev), 7efe78bb5 (6.6), 9eb6c8e48 (6.5)

    Description

      QTimer where a signal/slot connection with the old syntax of QObject::connect is used and the function signature has a blank between the function name and the opening brackets. Slots will not be called in Qt6.5.1. But before Qt 6.4.3,There is no bug. We can prove that by the code below:

      class MyObject : public QObject
      {
          Q_OBJECT
      signals:
          void mySignalb ();
          public slots:
          void mySlotb () { qDebug() << "test B"; }
      };
      
      int main(int argc, char *argv[])
      {
          QCoreApplication app (argc,argv);
          MyObject ob; QObject::connect (&ob, SIGNAL (mySignalb ()), &ob, SLOT (mySlotb ()));
          QTimer::singleShot (0, &ob, SLOT(mySlotb ()));
          emit ob.mySignalb ();
          return app.exec ();
      }
      

      output of  this code 

      A:  QMetaObject::invokeMethod: No such method MyObject::mySlotb ()
           test B
      B:  test B
           test B
      
      • A is  the output of Qt 6.5.1
      • B is  the output of Qt 6.4.3

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            nigel.lu Nigel Lu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes