Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83440

Dialog apps with Qt::Popup attribute do not get input when launched via shortcuts in X11

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Here is the minimal example that reproduces the problem:

      #include <QtWidgets>
      #include <QApplication>
      
      int main(int argc, char *argv[])
      {
       QApplication app(argc, argv);
       QDialog *dialog = new QDialog();
       QHBoxLayout *layout = new QHBoxLayout(dialog);
       QLineEdit *lineedit = new QLineEdit(dialog);
       layout->addWidget(lineedit);
       dialog->setLayout(layout);
       dialog->setWindowFlags(Qt::Popup);
       dialog->setAttribute(Qt::WA_QuitOnClose);
       dialog->show();
       lineedit->setFocus();
       return app.exec();
      }
      

      Running the app from terminal gives no surprises. But if I make an OS shortcut that launches this app, more often than not I end up with the dialog sticking on top of all windows and with blinking cursor waiting there for user's input, but ignoring the input entirely. Instead, the input goes to another app that was previously in focus, and I have to resort to terminal to kill the app.

      Checked with Qt version 5.12.7 on two different hosts with Ubuntu 18.04 and 19.10. It also does not depend on DE/window manager - I tried to assign shortcuts to launch the app in Gnome, xfce and i3 - the situation is the same. Also tried in Sway, a Wayland-based tiling window manager, but with XWayland backend - the same thing. (Using the app in Sway with normal wayland backend causes no input issue, but the dialog gets tiled like other regular windows despite its popup attribute - a topic probably for another issue).

      Also tried to use dialog->raise() and  dialog->windowActivate(), but they made no difference.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            galicarnax Max
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes