Important: Please read the Qt Code of Conduct -

QProgressBar not showing

  • I have an Extra Form with a QProgressBar that i want to use at different Points. First im using it at the start of the Application, where i download a JSon File. That works fine.

    Now i want to download Git Repositories, that are listed in a QTableView. The download works, but the Form with the QProgressBar makes Problems. The Form shows up and closes, but the Form didnt show up the Progress.


    This is my Code

    void MainWindow::on_pbInstallFilter_clicked()
        QModelIndexList indexList = ui->tvAvailableFilters->selectionModel()->selectedIndexes();
        ProgressForm progress;
        int count = 0;
        for (const QModelIndex &index : indexList)
            QString name, repo;
            name = index.model()->index(index.row(), 0, QModelIndex()).data().toString();
            repo = index.model()->index(index.row(), 1, QModelIndex()).data().toString();
            if (!mRepo.fetchRepository(name, repo))
                QMessageBox::warning(this, "Git Repo Download Error", mRepo.getError(), QMessageBox::Ok);

    When i use ProgressForm progress(this) instead of just ProgressForm progress, then he shows the QProgressBar, but the Window is very buggy and dont shows centered and is a little bit transparent.

  • @Fuel

    When ProgressForm is based on QProcessDialog the subsequent might describe the issue of not showing for a while

    A common problem with progress dialogs is that it is difficult to know when to use them; operations take different amounts of time on different hardware. QProgressDialog offers a solution to this problem: it estimates the time the operation will take (based on time for steps), and only shows itself if that estimate is beyond minimumDuration() (4 seconds by default).

    Third paragraph in here

  • Its not a QProgressDialog. I created only a new Form and put in a QProgressBar. Thats it.

    The Problem still exists. Maybe someone has some additional Ideas. This Thing with the Duration i will try later.

  • Lifetime Qt Champion


    Depending on how fetchRepository is implemented you'll be blocking the event loop thus your dialog won't show up until everything is done so closed also immediately.

  • I remembered that i had a similar Problem long ago. So i took a look in my old Code. I put the Process now in a different Thread. So the Problem is now solved.

Log in to reply