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

Invisible cursor when TextField centered in Dialog under certain conditions



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.4
    • Fix Version/s: None
    • Labels:
    • Environment:
      Linux machine with integrated intel graphics with i915 driver, linux 5.2.9.

      Windows 10 1903 running inside kvm on the aforementioned linux machine.
    • Platform/s:
      Android, Linux/X11, Windows


      Sohrt-ish explanation

      The TextField blinking cursor is invisible / not rendered when the TextField is centered inside a Dialog iff the cursor is in the first position and iff Dialog has a width that is an odd number of pixels, but only if the application window itself has some specific widths.


      Longer explanation

      Included is the code for a tiny Quick application that exhibits the bug.

      Clicking the only button will open a dialog with a width of 759 pixels.

      Centered inside the dialog is a single empty TextField 739 pixels wide.

      The ApplicationWindow itself is 1024 pixels wide.


      In this configuration opening the dialog and clicking on the TextField will focus it (visible thanks to the border) but no blinking cursor will be shown.

      The cursor will show after typing any character.

      The cursor will still not be rendered if moved to the start of the text.


      Changing the width of the application window will make the blinking cursor visible even in the first position, sometimes.

      Another application window width that will reproduce the bug is 1920.


      The bug does not happen if the Dialog is not centered (comment line 21 to verify this).


      Assuming the Dialog is centered, the following holds true:

      The bug still happens if the TextField's width is an even number.

      The but does not happen if the Dialog's width is an even number.


      Moreover, as stated the bug seems to happen only for certain application window widths, such as 1024, 1280, 1920 and many others.

      At the same time, it seems like it cannot be reproduced if the application window width has some other values, such as 1176: in such case any combination of Dialog centering, Dialog width, and TextField width will correctly show the blinking cursor.


      I suggest selecting the TextField and dragging the app's left or right side to make it wider or narrower to find many more values for which the cursor is not shown (the new app width is logged in the console).


      This bug was also observed on Android, but not in the form of the specific code example provided in this bug report.

      I also suspect that the reproducibility of this issue varies greatly depending on the actual hardware device, on Android.


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



            esabraha Eskil Abrahamsen Blomfeldt
            _zero Luca Benci
            0 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes