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. How to create progress bar showing the progress of task running in background
Forum Updated to NodeBB v4.3 + New Features

How to create progress bar showing the progress of task running in background

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.3k Views
  • 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.
  • A Offline
    A Offline
    anuj nogja
    wrote on 16 Apr 2018, 06:44 last edited by
    #1

    Hi All,
    In my project, there are some tasks that runs in background and as tasks gets completed, results are displayed in Gui.
    I want to create a progress bar that will display the progress of tasks running in background.

    Please suggest..how this can be achieved..

    Regards,
    Anuj

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gojir4
      wrote on 16 Apr 2018, 07:04 last edited by
      #2

      Hello,

      You can put the progress bar in status bar if you are using a QMainWindow:

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          //class initialization
          //...
          m_progress = new QProgressBar;
          statusBar()->addPermanentWidget(m_progress);
          m_progress->hide();
          //...
      }
          
          
      void MainWindow::onProcessStarted()
      {
          m_progress->show();
      }
      
      void MainWindow::onProcessFinished()
      {
          m_progress->hide();
      }
      
      void MainWindow::onProgressValueChanged(int progressValue)
      {
          m_progress->setValue(progressValue);
      }
      
      void MainWindow::onProgressMaxChanged(int progressMax)
      {
          m_progress->setMaximum(progressMax);
      }
      

      If you want to show several progress bars at the same time, a list view of progress bars could be a better approach

      1 Reply Last reply
      3

      1/2

      16 Apr 2018, 06:44

      • Login

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