Results 1 to 5 of 5

Thread: Problem with receiving events from QDateEdit

  1. #1
    Join Date
    Apr 2006
    Location
    Narvik, NORWAY
    Posts
    9
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default 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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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.

  3. #3
    Join Date
    Apr 2006
    Location
    Narvik, NORWAY
    Posts
    9
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default 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.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default 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:
    Qt Code:
    1. foreach (QObject* child, dateEdit->children())
    2. child->installEventFilter(eventFilter);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  5. #5
    Join Date
    Apr 2006
    Location
    Narvik, NORWAY
    Posts
    9
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default 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.

Similar Threads

  1. Problem with events changing behavior of QListWidget
    By riklaunim in forum Qt Programming
    Replies: 10
    Last Post: 22nd December 2008, 19:10
  2. Problem in Mouse Press Events & Vectors
    By dheeraj in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2008, 18:08
  3. QDateEdit emiting signal problem
    By anafor2004 in forum Newbie
    Replies: 1
    Last Post: 17th June 2008, 07:59
  4. Replies: 0
    Last Post: 2nd May 2007, 10:53
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.