[Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit
smurphy at walbro.com
Wed Aug 14 20:10:54 CEST 2019
> Ah. In our case, the QLineEdit is inside (and parented by) a widget that
> provides the background of the window. That parent widget can accept
> focus, so I guess our cases are not quite the same.
Ok, good! I thought I missed something. In my case, that is a problem since the user can click anywhere, including widgets that don't accept focus. And to make my custom line edit class portable, I shouldn't know or care anything about what other widgets are out there in the entire application.
I'm going down a path that seems to be working so far - using an event filter installed on the qApp instance that looks for mouse clicks and reports back to the line edit whether the click occurred within the line edit or not. If it is within, I just let QLineEdit handle it normally, if it's outside, then I finish editing. I still need to test more, but so far it's looking like what I want to do.
This message has been scanned for malware by Forcepoint. www.forcepoint.com
More information about the Interest