Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QDialog not reappearing after hiding parent window on Ubuntu

    General and Desktop
    qdialog qwidget tray bug
    3
    7
    1528
    Loading More Posts
    • 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.
    • A
      artudi54 last edited by

      I have a program that hides in a system tray area. It uses few dialogs for interactions with user. The problem is when i hide my app to tray with some dialogs still open. After restoring the windows to normal stated, dialogs disappear. The problem occurs on Ubuntu 17.10 with Qt 5.9.2, but I suppose that other Linux distributions may have this problem as well. I tested it with Plasma, GNOME and Unity. Same result. Windows version of my program works correctly, windows are hidden and restored as expected. Simple code can present the issue:

      #include <QtWidgets>
      #include <QtGui>
       
      int main(int argc, char *argv[]) {
          QApplication a(argc, argv);
          QWidget w;
          QDialog d(&w);
          QTimer::singleShot(1000, [&] { w.show(); });
          QTimer::singleShot(2000, [&] { d.show(); });
          QTimer::singleShot(3000, [&] { w.showMinimized(); });
          QTimer::singleShot(4000, [&] { w.hide(); });
          QTimer::singleShot(5000, [&] { w.show(); });
          QTimer::singleShot(6000, [&] { w.showNormal(); });
          a.exec();
      }
      

      After w.hide() dialog won't show again. Any additional calls of dialog methods like show(), showNormal() do nothing. Any ideas? Is this a bug, or is there something wrong with my code?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        What do you mean by disappear ?
        Do they get hidden by the other window or just invisible ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • A
          artudi54 last edited by

          Invisible. I can't manage to get the dialog shown with parent window.
          Before: QWidget and QDialog on top of it.
          After: QWidget only. QDialog disappeared.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Are you using your distribution provided Qt ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 1
            • A
              artudi54 last edited by

              I use Qt installed with MaintenanceTool. I asked this question on other forum and one person has confirmed having same issue on Ubuntu 18.04, so I think that this problem is not only related to my configuration.

              A 2 Replies Last reply Reply Quote 0
              • A
                ambershark @artudi54 last edited by ambershark

                @artudi54 Is the QDialog modal using QDialog::exec() or is it shown with QDialog::show()?

                Edit: nevermind I see the code above, lol.. I'll test for you on my linux real quick.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply Reply Quote 1
                • A
                  ambershark @artudi54 last edited by ambershark

                  @artudi54 Tested with gnome on arch and it does the same thing. I'd say this is a bug since d.show() never pulls the window back up.

                  I would file the bug with Qt.

                  To work around it I just made sure to call d.hide() before hiding the main window. Then after w.show() just call d.show() again.

                  My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                  1 Reply Last reply Reply Quote 3
                  • First post
                    Last post