Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-14 Thread Murphy, Sean
> 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 an

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-14 Thread John Weeks
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. > On Aug 14, 2019, at 9:35 AM, Murphy, Sean wrote: > >> I used the QLineEdit focusOutEvent() event.

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-14 Thread Murphy, Sean
> I used the QLineEdit focusOutEvent() event. Can you elaborate on that? Because when I tested yesterday, if the user clicks on something that does NOT grab focus (for example, any whitespace that exists in the layout between widgets), the line edit never gets a focusOutEvent(). I need it to w

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-14 Thread John Weeks
I used the QLineEdit focusOutEvent() event. > On Aug 13, 2019, at 1:21 PM, Murphy, Sean wrote: > >> Hmm, about that extra step, to remember the filter stuff, since you already >> have a custom line edit class, why not embed the MouseFilter class inside it? >> I mean, the filter does not have to

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-13 Thread Murphy, Sean
> Hmm, about that extra step, to remember the filter stuff, since you already > have a custom line edit class, why not embed the MouseFilter class inside it? > I mean, the filter does not have to reside in MainWindow, it needs only the > qApp pointer, so you could wire it up in your custom line edi

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-13 Thread Henry Skoglund
Hmm, about that extra step, to remember the filter stuff, since you already have a custom line edit class, why not embed the MouseFilter class inside it? I mean, the filter does not have to reside in MainWindow, it needs only the qApp pointer, so you could wire it up in your custom line edit's

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-13 Thread Murphy, Sean
> Hi, had a similar problem, couldn't find any other solution than using an > event filter, but it turned out being not so bad, made a small class: > > In my MainWindow I have an instance of that class, and in MainWindows's > ctor I initialize it: > > MouseFilter mf; > ... > mf.setWidget(ui->line

Re: [Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-13 Thread Henry Skoglund
Hi, had a similar problem, couldn't find any other solution than using an event filter, but it turned out being not so bad, made a small class: #include "qevent.h" class MouseFilter : public QObject {     Q_OBJECT     QWidget* pW;  // ptr to widget to check for inside/outside mouse clicks    

[Interest] Finish QLineEdit editing when user clicks anywhere outside the QLineEdit

2019-08-13 Thread Murphy, Sean
I'm trying to create a custom QLineEdit where while editing, the user can click anywhere *outside* the QLineEdit to finish editing. The default QLineEdit behavior appears to be that once the user has clicked inside the QLineEdit and begins editing the text, if the user then clicks on some other