Important: Please read the Qt Code of Conduct -

I-beam remnants in QLineEdit after clear() function

  • I am having problems with I-beam remnants in QLineEdit widgets. I have several QLineEdit's in a main window. If they have any text in them when I use the clear() function (on each of them sequentially), I am left with an unblinking I-beam at the beginning of the box for each of them. One tip which I have already tried, is to sequentially setFocus through all of them. This worked for one program, but not for the current program. If I manually sequence through the widgets, the I-beam blinks, then disappears when moving on to the next one. This works for both tab and mouse use. Each LineEdit is part of a separate GroupBox, and the whole main window was made with Qt 4 Designer.
    I am using Qt 4.6.2 under ubuntu 10.4.

    Does anyone have a suggestion, or a permanent fix?

  • On win32, Qt 4.7beta2, the behavior I find is different. If I repeat the above steps, the I-beam vanishes from all QLineEdits. I did not setFocus on any particular QLineEdit, but sequentially cleared them

  • Hey, just found that if I setFocus to any particular QLineEdit say ledit2, and then clear all of the QLineEdits, the focus still remains on ledit2. So no need for setFocus on each LineEdit. Hope this helps.

  • It looks like this is a linux code bug. When I compile and run the same program under windows, it works fine, just like you say.

  • then please do log a bug for this

  • Bug report has been generated. Here is the link:

Log in to reply