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. QProgressDialog doesn't show up
Forum Updated to NodeBB v4.3 + New Features

QProgressDialog doesn't show up

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • X Offline
    X Offline
    xalam
    wrote on last edited by SGaist
    #1

    I am monitoring progress of the function which emits signals to show progress. The signals are caught in the slots below and I can debug through them, only thing the progress never shows up. In fact it was showing up but it somehow stopped doing that.

    void MainWindow::InitiateProgress(int numFiles)
    {
        QString msg("Creating '%1' files...");
        progress = (QSharedPointer<QProgressDialog>) new QProgressDialog(msg, "Cancel", 0, numFiles, this, Qt::Dialog) ;
        progress->setAutoClose( false );
        progress->setMinimumDuration(0);
        progress->setWindowModality(Qt::WindowModal);
        progress->setModal( true );
        progress->setAutoReset( false );
        progress->setWindowTitle( APP_NAME );
    
        QSize size = progress->size();
        size.setWidth( size.width() + 180 );
        progress->resize( size );
    }
    
    void MainWindow::SetProgress(int filesProcessed)
    {
        progress->setValue( filesProcessed );
    }
    
    void MainWindow::FinishProgress()
    {
        progress->setLabelText("Finished creating files");
        progress->setCancelButtonText("Finish");
    }
    

    I did made sure I am calling QApplication::processEvents(); in the function loop so messages are processed in GUI. Also tried putting the caller function into a seperate through via the call (below) but it still not display. The debugger tell me the slots are executed and has correct values as expected.

    QtConcurrent::run( this, &MainWindow::convertFiles, sourceDir.absolutePath(), destDir.absolutePath() ) ;
    

    [edit: update coding tags SGaist]

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

      Hi,

      Are you updating progress directly in your slot ?

      Also note that you are recreating a new dialog each time you call InitiateProgress and not really correctly since you are using a QSharedPointer. If you really want to recreate the progress dialog, call reset on progress

      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
      0

      • Login

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