Unsolved QObject::connect: No such slot Widget::on_lineEdit_textEdited()
-
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;
} -
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 justpublic
orprivate
? -
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)));
-
... 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. -
@J.Hilk In the on_lineEdit_textEdited() i define the private slots section
-
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.