Results 1 to 5 of 5

Thread: Know Number of Property Exposed by the Widget

  1. #1
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Know Number of Property Exposed by the Widget

    HI
    I just want to know is there any method through which u can know that this widget or dialog will expose some property . I have read about Qt Meta object but it is not working .

  2. #2
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    164
    Thanks
    1
    Thanked 26 Times in 26 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Know Number of Property Exposed by the Widget

    Will this work for you?

    Qt Code:
    1. QVariant QObject::property ( const char * name ) const
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Know Number of Property Exposed by the Widget

    Hi
    Thanks, But what i want that by any method i will get the toal No of Property from the widget . In this case what we actually get the value of that property ,I want just name of the Property
    So for QWidget if there 30 Property I want a fn which will return that QWidget has 30 property. Also either through indexing or by any means i want to know the property exposed by the QWidget So like Enabled ,Geometry maximumheight etc

  4. #4
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    164
    Thanks
    1
    Thanked 26 Times in 26 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Know Number of Property Exposed by the Widget

    Doesn't this work?

    Qt Code:
    1. const QMetaObject* metaObject = obj->metaObject();
    2. QStringList properties;
    3. for(int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i)
    4. properties << QString::fromLatin1(metaObject->property(i).name());
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Know Number of Property Exposed by the Widget

    Hi
    Thanks This works

Similar Threads

  1. File dialog for custom widget property?
    By TheJim01 in forum Newbie
    Replies: 1
    Last Post: 6th May 2010, 10:14
  2. Qt types exposed as Variant in javascript
    By dioselin in forum Newbie
    Replies: 1
    Last Post: 15th April 2010, 17:08
  3. Designer plugin widget property not recognized
    By janus in forum Qt Programming
    Replies: 7
    Last Post: 14th April 2009, 21:26
  4. Replies: 3
    Last Post: 19th October 2006, 22:13
  5. Replies: 5
    Last Post: 16th May 2006, 20:38

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.