im new to Qt, i need to use another thread for the member function below
int length=interface->get_message(channelnumber_uint, &identifier, message, &can_flag_uint, timeout_uint);
i tried this:
QFuture <int> future = QtConcurrent::run(interface, &can_handler::get_message, channelnumber_uint, &identifier, message, &can_flag_uint, timeout_uint);
int length = future.result();
im getting an error in qtconcurrentfunctioncall.h
/usr/include/x86_64-linux-gnu/qt5/QtConcurrent/qtconcurrentstoredfunctioncall.h:1200: error: array used as initializer
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
^
ive seen that someone just used std::array instead of unsigned char array, but im not allowed to change this. Is there another solution?
whole (i cutted off unrelated code):
void MainWindow::on_pushButton_canreceivemessage_clicked()
{
QString channelnumber_qstr, timeout_qstr;
unsigned int channelnumber_uint, timeout_uint, can_flag_uint, identifier, length;
unsigned char message[8];
channelnumber_qstr=ui->lineEdit_cancommunicationchannel->text();
timeout_qstr=ui->lineEdit_cantimeoutreceive->text();
channelnumber_uint = channelnumber_qstr.toUInt(&ok, 10);
timeout_uint = timeout_qstr.toUInt(&ok,10);
//the function that has to be called from another thread
//int length=interface->get_message(channelnumber_uint, &identifier, message, &can_flag_uint, timeout_uint);
QFuture <int> future = QtConcurrent::run(interface, &can_handler::get_message, channelnumber_uint, &identifier, message, &can_flag_uint, timeout_uint);
int length = future.result();
}