Results 1 to 2 of 2

Thread: Getting Type of an variable

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting Type of an variable

    If you want type information about non-Qt objects you will have to use some reflection mechanism(there are a few libraries available).

    For Qt objects, you have QObject::inherits and QMetaObject::className and QMetaObject::superClass.

    Or you can use dynamic_cast:
    Qt Code:
    1. if(dynamic_cast<QComboBox*>(combo) != null)
    2. // do someyhing
    To copy to clipboard, switch view to plain text mode 
    Note in this case you need a pointer to QComboBox.

    Regards

  2. The following user says thank you to marcel for this useful post:

    hgedek (9th September 2007)

Similar Threads

  1. Installation on Fedora Core 4
    By jcr in forum Installation and Deployment
    Replies: 3
    Last Post: 29th January 2009, 01:34
  2. Replies: 6
    Last Post: 21st September 2007, 13:51
  3. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  4. How to dinamically change the type of a QCheckListItem
    By kalos80 in forum Qt Programming
    Replies: 4
    Last Post: 12th March 2007, 15:25
  5. custom plugin designer property with out a variable?
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:11

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
  •  
Qt is a trademark of The Qt Company.