[Qt-interest] QLineEdit loosing its selection

Daniel Vérité daniel.verite at gmail.com
Mon Aug 3 21:16:19 CEST 2009


	 Oliver Demetz writes

> Well, the thing is that as soon as (any) other widget is clicked, the 

> selection is removed.
> So, at the moment the widget gets a mouse down event and I could 
react, 
> the selection *is already gone*.
> The mechanism is built deep into Qt and I don't know how to disable 
it.

You might need to mimic the way QCompleter works: it installs an 
eventfilter for both widgets (the lineedit and the popup), with some 
hack to avoid the problem of the lost focus, as well as an 
event-routing logic. The result is that you can still type in the 
lineedit while the popup is shown, which seems a bit like the problem 
you're trying to solve. I doubt the selection gets lost in this case.

Or maybe you could just use setFocusProxy() if it works for you, but my 
own experience with it was not conclusive at all.

Best regards,
-- 
 Daniel
 PostgreSQL-powered mail user agent and storage: 
http://www.manitou-mail.org 



More information about the Qt-interest-old mailing list