Results 1 to 2 of 2

Thread: qobject_cast

  1. #1
    Join Date
    Mar 2010
    Location
    spain
    Posts
    25
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qobject_cast

    Is there any reason why this code works perfectly in windows and in linux failed

    Qt Code:
    1. void Button::dropEvent(QDropEvent *event){
    2.  
    3.  
    4. Button* source = qobject_cast<Button*>(event->source()); // craaaaf Failure only in linux
    5.  
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 


    thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qobject_cast

    What do you mean with "failed"?

    Does the qobject_cast return 0?
    Is the event->source of type Button*?

    Cheers,
    _

Similar Threads

  1. qobject_cast vs dynamic_cast
    By mike_c in forum Qt Programming
    Replies: 5
    Last Post: 19th April 2010, 18:51
  2. qobject_cast and sender()
    By ksrarc in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2009, 16:57
  3. Problem with qobject_cast
    By Tepi in forum Qt Programming
    Replies: 6
    Last Post: 31st August 2009, 08:03
  4. qobject_cast for Qt3 ?
    By sunil.thaha in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2006, 05:12
  5. qobject_cast not working right?
    By Mike in forum Qt Programming
    Replies: 6
    Last Post: 30th May 2006, 14:56

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.