Problem with receiving events from QDateEdit
I have a problem with QDateEdit. I want to snap its contents when it looses focus. Since QDateEdit has got only one signal,
void valueChanged ( const QDate & date ) wich is not very usefull for my purpose
I have tried to reimplement bool FD_KoderWidget::eventFilter( QObject *obj, QEvent *ev )
Inside eventFilter, I do my work if ev is a QEvent::FocusOut, and obj is my QDateEdit
otherwise I just pass the event on to QWidget::eventFilter(....)
The problem seems to be that QDateEdit never produces an event.
After a lot of thinking and various modifications of my code, I tried to simply replace QDateEdit with a QLineEdit . Then my code worked perfectly well.
What could be the problem with QDateEdit?
Re: Problem with receiving events from QDateEdit
Did you install the filter? It's not enough to just reimplement eventFilter. You can do that with event() but using eventFilter() involves the need to call installEventFilter() first. If you are subclassing QDateEdit, it might be better to simply reimplement appropriate event handler.
Re: Problem with receiving events from QDateEdit
I did install the filter, and I am not subclassing QDateEdit.
So the problem must be something else.:)
Re: Problem with receiving events from QDateEdit
Try installing the event filter for date edit's children and see if any of them receives the focus out event.
Something like:
Code:
foreach
(QObject* child, dateEdit
->children
()) child->installEventFilter(eventFilter);
Re: Problem with receiving events from QDateEdit
Thanks for your help.
I found the problem. I ran uic on the form from DOS. And I think .NET did not realize that a new object-file was needed.
I deleted the object-file to force the compiler to generate a new, and then my code worked.:)