Results 1 to 7 of 7

Thread: [solved] Which object type is QObject::sender()?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Wink [solved] Which object type is QObject::sender()?

    Hi mates!

    When I receive a signal, I'd like to know in my SLOT if the sender is a QDockWidget, how can I test which kind of object is QObject::sender()?

    There is a method called isA but I guess is obsolete because is not available on qt4.5

    Any idea?
    Thanks in advance.


    EDIT:

    BTW, Why doesn't work this:
    QDockWidget* dock=(QDockWidget*) QObject::sender();
    But this works perfectly:
    QObject* sender = const_cast<QObject*>(QObject::sender());
    QDockWidget* dock = static_cast<QDockWidget*>(sender);
    Last edited by ricardo; 8th May 2009 at 21:08.

Similar Threads

  1. Replies: 4
    Last Post: 19th February 2009, 11:10
  2. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  3. Getting type of object
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 29th November 2007, 14:38
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  5. Replies: 3
    Last Post: 15th April 2007, 19:16

Tags for this Thread

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.