Important: Please read the Qt Code of Conduct -

Incorrect QDialog view in Windows 10 taskbar

  • Hello everyone!
    I have some problems with QDialog. I have a MainWindow class, where I call method callDialog() after clicking the QPushButton.
    It initializes a pointer to QDialog.


    int main(int argc, char *argv[])
        QApplication a(argc, argv);
        MainWindow w;;
        return a.exec();


    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include <QMainWindow>
    #include <QPushButton>
    #include <QDialog>
    class MainWindow : public QWidget
        explicit MainWindow(QWidget *parent = nullptr);
    private slots:
       void callDialog();
        QPushButton* _button;
        QDialog* dialog;
    #endif // MAINWINDOW_H

    and mainwindow.cpp:

    #include "mainwindow.h"
    #include <QGridLayout>
    MainWindow::MainWindow(QWidget *parent) :QWidget(parent), dialog(0)
        _button = new QPushButton("Push");
        connect(_button, SIGNAL(clicked(bool)), SLOT(callDialog()));
        QGridLayout* lay = new QGridLayout();
        setMinimumSize(500, 500);
    void MainWindow::callDialog()
        if (!dialog) {
            dialog = new QDialog(this);
            dialog->setMinimumSize(200, 200);
        if (dialog)
            delete dialog;

    This is how the program looks after pressing the button. That is all right.
    Then I close QDialog, hover my mouse over the thumbnail in the taskbar and see the open QDialog, but it is hidden
    If you click on the thumbnail (activate the window), QDialog will hide quickly to the correct state.

    Qt doc examples:
    If I use first (modal) example, then all right (QDialog hided on preview, because deleted). But i need pointer to QDialog to pass parameters from other functions to it.
    Is this a feature of the system, a Qt bug or my hand curves?

  • Lifetime Qt Champion

    When I open the 'About' Dialog in Visual Studio and then take a look at the taskbar preview I don't see the About dialog. Tested also other programs an none showed a dialog in the preview.

  • @Christian-Ehrlicher
    OK, but I used an example from the documentation and it didn't work properly. If u tested other programs, so it's not an OS bug. I'm trying to figure out what's wrong: my code or QDialog?

  • Lifetime Qt Champion

    @GreenSadFrog said in Incorrect QDialog view in Windows 10 taskbar:

    If u tested other programs, so it's not an OS bug

    I don't understand you - I tested other programs and all don't show a modal dialog box in the preview so Qt behaves the same as the rest.

  • @Christian-Ehrlicher
    OK. So can you explain me whats wrong in my code? I just copied example. By the way this code works correctly when tested on windows 7.

  • Lifetime Qt Champion

    I dont think any thing is wrong.
    Even notepad dont show any dialogs over its preview.
    So i think its works as expected when on windows 10.

    alt text

  • @mrjj Thanks for the reply.