Home > front end >  Qt pop-up dialog to display information and close without expecting any user inputs
Qt pop-up dialog to display information and close without expecting any user inputs

Time:12-17

this is reference image of what i want, but i need the dialog without any buttons I have built a Qt application which has a feature to record video. I'm trying to add a popup window which says recording is done and closes itself after few seconds without expecting any input from user.

I tried using QMessageBox

void MainWindow::on_toolButton_clicked() {
  count  ;
  qDebug() << "count value" << count;
  if(count == 2){
    QMessageBox msgBox;
    msgBox.setText("Video recording is done.");
    msgBox.exec();
    count = 0;
  }
}

I need a pop-up as above without any standard buttons.

CodePudding user response:

QMessageBox msgBox;
msgBox.setText("Video recording is done.");

QTimer::singleShot(1000, [&msg]() { msg.close(); });

msg.exec();
  • Related