Search code examples
c++qtdeployment

This deplyment error occurs when I use Connect signal and slots


when I execute like this at Desktop it works fine but when try to deploy on remote device then error occurs.

connect(ui->lineEdit, &QLineEdit::returnPressed, this, [=]()->void
{
    QString str = ui->lineEdit->text();
    qDebug()<<"Input (HEX) = " << str;
    bool ok;
    int iVal = str.toInt(&ok,16);
    QString binnumber = str.setNum(iVal, 2);
    if(ok)
        ui->lineEdit_2->setText(binnumber);
    else
        ui->lineEdit_2->setText("Not a number");
    qDebug()<<"output in binary = " << binnumber;
});

errors:

1).
/usr/local/Qt-4.8.7-arm/include/QtGui/qlineedit.h:196: error: ‘void QLineEdit::textEdited(const QString&)’ is protected
     void textEdited(const QString &);
          ^
2). 
/home/ijaz/Qt_applications/update_automatically/mainwindow.cpp:24: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
     });
     ^
3).
/home/ijaz/Qt_applications/update_automatically/mainwindow.cpp:24: error: no matching function for call to ‘MainWindow::connect(QLineEdit*&, void (QLineEdit::*)(const QString&), MainWindow* const, MainWindow::MainWindow(QWidget*)::__lambda0)’
     });
      ^

Solution

  • As it's shown on the error message, your target device has Qt on this path /usr/local/Qt-4.8.7-arm which shows that the Qt version is 4.8.7. Lambda expressions on signal/slot need Qt 5 and is not available on Qt 4.8.7. Either update Qt version on your target device or do your desktop development on the same version as used on your target embedded device.