How can I prevent QDialog from making an entry in the taskbar?

qt

Solution

You need to set parent, so dialog will use parents entry:

QDialog *dlg = new QDialog(this);
dlg->exec();

Or, you can use Qt::Tool flag:

QDialog *dlg = new QDialog();
dlg->setWindowFlags(Qt::Tool);
dlg->exec();

But if you use Qt::Tool flag, dialog will not close, but hide.

Problem

By taskbar I mean the bar that's usually at the bottom where you have your startmenu button etc. You know how when you open a program it has an entry in the task bar? For example if you start qt creator, it has an entry there and you can click on it to minimize qt creator and open it again. I was wondering if there's a property in QDialog that I can set, so that this QDialog won't create any entries in the taskbar. I want to do this because I have a program where I click on a button and it creates a new dialog and calls .exec(). The problem is that I now get 2 entries in the task bar, one for the main window and another one for this dialog.

Original source