void MainW::foo(){
    if(ui->progressBar->value()<50){
        ui->progressBar->setValue(79);
    }
    else{
        ui->progressBar->setValue(23);
    }
}void MainW::on_output_excel_butt_clicked()
{
    QThread trd;
    moveToThread(&trd);
    connect(&trd, SIGNAL(started()), this, SLOT(foo()));
    trd.start();
}QEventLoop loop;
QFutureWatcher watcher = QConcurrent::run(someFunc);
connect(&watcher, &QFutureWatcher::finished,  &loop, &QEventLoop::quit);
loop.exec();
auto result = watcher.result();connect(&trd, SIGNAL(started()), this, SLOT(foo()), Qt::QueuedConnection);