Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProgressBar not showing

QProgressBar not showing

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fuel
    wrote on last edited by
    #1

    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.

    0_1516475126024_Unbenannt.png

    This is my Code

    void MainWindow::on_pbInstallFilter_clicked()
    {
        QModelIndexList indexList = ui->tvAvailableFilters->selectionModel()->selectedIndexes();
        ProgressForm progress;
        progress.setWindowModality(Qt::WindowModality::WindowModal);
    
        int count = 0;
        progress.setMinimum(count);
        progress.setMaximum(indexList.count());
        progress.show();
        for (const QModelIndex &index : indexList)
        {
            progress.setValue(count);
            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);
    
            count++;
        }
        progress.setValue(count);
        progress.close();
    }
    

    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.

    K 1 Reply Last reply
    0
    • F Fuel

      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.

      0_1516475126024_Unbenannt.png

      This is my Code

      void MainWindow::on_pbInstallFilter_clicked()
      {
          QModelIndexList indexList = ui->tvAvailableFilters->selectionModel()->selectedIndexes();
          ProgressForm progress;
          progress.setWindowModality(Qt::WindowModality::WindowModal);
      
          int count = 0;
          progress.setMinimum(count);
          progress.setMaximum(indexList.count());
          progress.show();
          for (const QModelIndex &index : indexList)
          {
              progress.setValue(count);
              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);
      
              count++;
          }
          progress.setValue(count);
          progress.close();
      }
      

      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.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @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

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • F Offline
        F Offline
        Fuel
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • F Offline
            F Offline
            Fuel
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved