Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Incorrect QDialog view in Windows 10 taskbar
QtWS25 Last Chance

Incorrect QDialog view in Windows 10 taskbar

Scheduled Pinned Locked Moved Solved General and Desktop
qdialogwindows10taskbar
8 Posts 4 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GreenSadFrog
    wrote on last edited by
    #1

    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.

    main.cpp:

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

    mainwindow.h:

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    #include <QPushButton>
    #include <QDialog>
    
    class MainWindow : public QWidget
    {
        Q_OBJECT
    
    public:
        explicit MainWindow(QWidget *parent = nullptr);
        ~MainWindow();
    
    private slots:
       void callDialog();
    
    private:
        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();
        lay->addWidget(_button);
        setLayout(lay);
    
        setMinimumSize(500, 500);
    }
    
    void MainWindow::callDialog()
    {
        if (!dialog) {
            dialog = new QDialog(this);
            dialog->setMinimumSize(200, 200);
        }
        dialog->show();
        dialog->raise();
        dialog->activateWindow();
    }
    
    MainWindow::~MainWindow()
    {
        if (dialog)
            delete dialog;
    }
    

    0_1549297501744_1.png
    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
    0_1549297684263_2d7f0142-59bf-4930-9e03-8954dab925df-image.png
    If you click on the thumbnail (activate the window), QDialog will hide quickly to the correct state.

    Qt doc examples:
    0_1549297893668_d86f8f19-25f5-4a1d-b2c1-3bb53694385f-image.png
    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?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      G 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        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.

        G Offline
        G Offline
        GreenSadFrog
        wrote on last edited by
        #3

        @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?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          G 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @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.

            G Offline
            G Offline
            GreenSadFrog
            wrote on last edited by
            #5

            @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.

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              Hi
              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

              G 1 Reply Last reply
              1
              • mrjjM mrjj

                Hi
                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

                G Offline
                G Offline
                GreenSadFrog
                wrote on last edited by
                #7

                @mrjj Thanks for the reply.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  TheProg
                  wrote on last edited by TheProg
                  #8

                  I ran into the same problem, where a closed QDialog would magically appear over a QMainWindow when hovering over the programs' TaskBar icon...
                  I understand that QDialogs do not get shown in the TaskBar thumbnail, but how does the Dialog appear out of thin air, after dismissing it??

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

                  If you click on the thumbnail (activate the window), QDialog will hide quickly to the correct state.

                  The problem OP described doesn't have anything to do with the Dialog not being shown in the Thumbnail btw


                  Seems to be a known bug https://bugreports.qt.io/browse/QTBUG-48855

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved