The question is very simple. Is it possible to show QDialog
or QMessageBox
without creating a tab in the task bar for it? I tried using exec(), show(), changing value of modal, but the tab is always on.
You need to specify parent window for the QMessageBox
:
QApplication a(argc, argv);
qt_test_dialog w;
w.show();
// with additional button
// QMessageBox box(QMessageBox::Information, "Title", "Hello there!", QMessageBox::Ok);
// without additional button!
QMessageBox box(QMessageBox::Information, "Title", "Hello there!", QMessageBox::Ok, &w);
Or simply:
QMessageBox box(&w);
box.setText("Hello");
box.exec();
Note that parent parameter can even be empty QWidget
:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// plain wrong (you will not be able to exit application) - but it demonstrates
// the case
QMessageBox box(new QWidget());
box.setText("Hello");
box.exec();
return a.exec();
}