0

I have the following source code:

void Processmethod()
{

    QDialog *ProcessMessage = new QDialog;      
    Ui::DialogProcessMessage Dialog;            
    Dialog.setupUi(ProcessMessage);             
    ProcessMessage->setModal(true);
    ProcessMessage->setAttribute(Qt::WA_DeleteOnClose); 
    ProcessMessage->show();

    processmethodONE();  
    processmethodTWO();
    processmethodTHREE();                  
}

void processmethodONE()
{
    QString ProcessCommand = "w8 " + blablubli";            

    Prozess.setWorkingDirectory(Path);         //QProcess "Prozess" is globaly defined  
    Prozess.setStandardOutputFile(Path);       //in my class
    Prozess.start(ProcessCommand);


while(!Prozess.waitForFinished(2000))
   {
       qApp->processEvents();
       std::cerr << "Process running " << std::endl;
   }

QProcess::ExitStatus Status = Prozess.exitStatus(); 

if (Status == 0)
 {
   std::cout << "File created!" << std::endl;
 }
}

So, my prob is that the dialogs content is missing for some reason. In the dialog I have some text and one button. I just want to see that content when the dialog popsup and while the processes are running.Any solutions or ideas how to achieve this? greetings

Streight
  • 811
  • 4
  • 15
  • 28
  • The while loop freezes the UI thread - thus you cannot have any responsive UI, whether main dialog or progress dialog. Remove the while loop and make the dialog modal to disable the main UI for user input. – Frank Osterfeld Mar 26 '12 at 14:57
  • see http://stackoverflow.com/questions/1386043/how-to-make-qt-work-when-main-thread-is-busy – Martin Beckett Mar 26 '12 at 15:00
  • hi again, I edited my question. Maybe you could give an answer to the new question. I just want to show the dialogs content now, so everything would be ok only if also the dialogs content is shown. – Streight Mar 26 '12 at 21:48

2 Answers2

1

Try to use exec() method of the QDialog instead of show() this will serve the purpose of the modal window.

This may solve your problem too. QPushButtons and the QLabels (buttons and text) is missing this may be the problem of your layout or dialog window size(try after making it large).

Check in preview window (OPTIONS MENU -> FORM EDITOR -> PREVIEW).

Anwar Shaikh
  • 1,591
  • 3
  • 22
  • 43
  • exec() blocks the processes until the dialog is closed which is not my intention. Furthermore the preview in QTDesigner works fine :). – Streight Mar 26 '12 at 19:11
0

I used now qApp->processEvents(); in the processes while loops. The dialogs content doesn't appear instantly, but at least after about five - ten seconds, which is at least ok to me. greetings and thx for the support.

Streight
  • 811
  • 4
  • 15
  • 28