Results 1 to 3 of 3

Thread: Why doesn't this cast?

  1. #1
    Join Date
    Nov 2008
    Posts
    38
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Why doesn't this cast?

    Not a Qt-specific question, but here's a funny compiler error:

    error: no matching function for call to ‘QCoreApplication::sendEvent(QWidget*, QMouseEvent*&)’
    /usr/include/qt4/QtCore/qcoreapplication.h:214: note: candidates are: static bool QCoreApplication::sendEvent(QObject*, QEvent*)

    Since QWidget is a QObject and QMouseEvent is a QEvent, why is my compiler (gcc 4.2.4) complaining?

    Thanks

  2. #2
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: Why doesn't this cast?

    Please show us your code.

    Make sure that second value for sendEvent is pointer.

  3. #3
    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: Why doesn't this cast?

    Probably either one of the classes is forward declared only. Adding suitable include directives should fix the problem.
    J-P Nurmi

Similar Threads

  1. [java newbie] cast reading a file
    By mickey in forum General Programming
    Replies: 0
    Last Post: 4th October 2008, 19:01
  2. ohhh my, Getting handle to main app
    By sticcino in forum Qt Programming
    Replies: 6
    Last Post: 20th June 2008, 21:02
  3. explicit cast building own math library
    By mickey in forum General Programming
    Replies: 6
    Last Post: 7th February 2008, 05:48
  4. cast QString-GLenum
    By mickey in forum General Programming
    Replies: 1
    Last Post: 6th July 2006, 14:52
  5. Cast problem
    By yellowmat in forum Newbie
    Replies: 3
    Last Post: 7th February 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.