Pregunta

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

¿Fue útil?

Solución 2

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.

Otros consejos

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).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top