QMessageBox Dont work



  • hi guys!
    I'm trying to call a msgbox like that:

    msg.setText("Parada de Emergência Selecionada: Aguarde 1 min");
           msg.setIcon(QMessageBox::Critical);
           msg.setModal(true);
           msg.show();
           this->printer_object->scramPrinter();
           msg.accept();
    

    Because i need that the message on the screen when the this->printer_object->scramPrinter(); is running.
    But when the msg shows, the dialog is black. Can anyone tell's me whats wrong?



  • @Lays147

    How about you check the condition first and then show the message?

    Example:

           if (this->printer_object->scramPrinter())
          // I dont know what this function returns. But as per my assumption, if this is running then it shall return a bool value?
    {
           msg.setText("Parada de Emergência Selecionada: Aguarde 1 min");
           msg.setIcon(QMessageBox::Critical);
           msg.setModal(true);
           msg.show();
           msg.accept();
    }
    

  • Lifetime Qt Champion

    Hi,

    What does scramPrinter do ? If it's something blocking then it's normal that your dialog doesn't who anything, it might just have the time to get shown and then the event loop is getting blocked by scramPrinter thus no update happens anymore


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.