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. QObject::connect: No such slot Widget::on_lineEdit_textEdited()

QObject::connect: No such slot Widget::on_lineEdit_textEdited()

Scheduled Pinned Locked Moved Unsolved C++ Gurus
6 Posts 5 Posters 2.1k 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.
  • R Offline
    R Offline
    Rahul.k
    wrote on last edited by
    #1

    i try to read the data from ardunio using the serial communication but when i used the connect function then its show the error no such slot widget. The on_lineEdit_textEdited function are also present and the slot are also include in widget.h but i cant understand where is problem how to solve that error .

    QObject::connect(arduino,SIGNAL(readyRead()),this,SLOT(on_lineEdit_textEdited()));

    void Widget::on_lineEdit_textEdited(const QString)
    {
    QByteArray serialData=arduino->readAll();
    QString va_list=QString::fromStdString(serialData.toStdString());
    qDebug()<<va_list;
    }

    J.HilkJ SGaistS 2 Replies Last reply
    0
    • R Rahul.k

      i try to read the data from ardunio using the serial communication but when i used the connect function then its show the error no such slot widget. The on_lineEdit_textEdited function are also present and the slot are also include in widget.h but i cant understand where is problem how to solve that error .

      QObject::connect(arduino,SIGNAL(readyRead()),this,SLOT(on_lineEdit_textEdited()));

      void Widget::on_lineEdit_textEdited(const QString)
      {
      QByteArray serialData=arduino->readAll();
      QString va_list=QString::fromStdString(serialData.toStdString());
      qDebug()<<va_list;
      }

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      you're using the old signal slot syntax, therefore are you sure that inside your header the function
      @Rahul.k said in QObject::connect: No such slot Widget::on_lineEdit_textEdited():

      on_lineEdit_textEdited

      is in the slots section and not just public or private?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      R 1 Reply Last reply
      0
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on last edited by
        #3

        If you are using the old style connect, then you must put the argument:

        QObject::connect(arduino,SIGNAL(readyRead(const QString )),this,SLOT(on_lineEdit_textEdited(const QString)));
        
        aha_1980A 1 Reply Last reply
        1
        • mranger90M mranger90

          If you are using the old style connect, then you must put the argument:

          QObject::connect(arduino,SIGNAL(readyRead(const QString )),this,SLOT(on_lineEdit_textEdited(const QString)));
          
          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mranger90

          ... but you can omit the const and all spaces.

          Anyway, on_lineEdit_textEdited will also be called automatically whenever lineEdit is edited, so please make sure to not shoot yourself in the foot.

          Qt has to stay free or it will die.

          1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            you're using the old signal slot syntax, therefore are you sure that inside your header the function
            @Rahul.k said in QObject::connect: No such slot Widget::on_lineEdit_textEdited():

            on_lineEdit_textEdited

            is in the slots section and not just public or private?

            R Offline
            R Offline
            Rahul.k
            wrote on last edited by
            #5

            @J.Hilk In the on_lineEdit_textEdited() i define the private slots section

            1 Reply Last reply
            0
            • R Rahul.k

              i try to read the data from ardunio using the serial communication but when i used the connect function then its show the error no such slot widget. The on_lineEdit_textEdited function are also present and the slot are also include in widget.h but i cant understand where is problem how to solve that error .

              QObject::connect(arduino,SIGNAL(readyRead()),this,SLOT(on_lineEdit_textEdited()));

              void Widget::on_lineEdit_textEdited(const QString)
              {
              QByteArray serialData=arduino->readAll();
              QString va_list=QString::fromStdString(serialData.toStdString());
              qDebug()<<va_list;
              }

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              You wrote:
              @Rahul.k said in QObject::connect: No such slot Widget::on_lineEdit_textEdited():

              QObject::connect(arduino,SIGNAL(readyRead()),this,SLOT(on_lineEdit_textEdited()));

              Yet your slot implementation signature is:
              @Rahul.k said in QObject::connect: No such slot Widget::on_lineEdit_textEdited():

              void Widget::on_lineEdit_textEdited(const QString)

              So which one is the correct ?

              In any case, that name is completely misleading with respect to what that function does and to what it's connected to. Thus you should rather give it a proper name.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved