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

[REG 4->5] focusInEvent is lost if window is shown and mouse cursor is inside of this window

    XMLWordPrintable

Details

    • 8eaf3352590690079735eda9fb872ec8c9c58f0a

    Description

      When a window changes its state from hidden to shown some widget gets the focus and focusInEvent fired. But if the mouse pointer is on the position where widget appears, the widget gets the focus but focusInEvent isn't fired.

      This happens only on Linux (I tested with kwin and mutter window managers and with various settings of focus stealing).

      This doesn't happen on Windows. This also doen't happen on Qt 4.

      Steps to reproduce:
      1) Build and launch the program from the code attached to this bug:
      $ mkdir build
      $ cd build
      $ cmake ..
      $ ./focus_qt5

      2) This program shows a QTextEdit widget and hides and shows it every second. Also it handles focusInEvent and focusOutEvent and shows the state of the focus:

      void FocusWidget::focusInEvent ( QFocusEvent* event )

      { setText("I have a focus"); setReadOnly(true); qDebug() << "FocusWidget Focus in" << event->reason(); }

      void FocusWidget::focusOutEvent ( QFocusEvent* event )

      { setText("I don't have a focus"); setReadOnly(false); qDebug() << "FocusWidget Focus out" << event->reason(); }

      So it shouldn't be possible to change the QTextEdit widget because when it got focus it does setReadOnly(true);

      3. Place the mouse cursor inside the window and wait one cycle (2 seconds). Now the widget has a focus, but it is editable and the "I don't have a focus" is inside it. So focusInEvent was missed.

      Attachments

        1. focus.tar
          10 kB
          Alexander Bersenev
        2. qt.patch
          2 kB
          Alexander Bersenev
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            zaps166 Błażej Szczygieł
            bay Alexander Bersenev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes