Results 1 to 6 of 6

Thread: Can I display/print properties of QWidget?

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Can I display/print properties of QWidget?

    Hi,

    I have a situation where for the first time I receive multitouch events on QDial and then I receive touch event on only on widget. For more info click here

    What I want to do is get the state of QWidget (so something similar) when the application starts and then get the state of QWidget when I have touched it once and see what has changed which leads to change in behavior.

    Is there any way to do that?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Can I display/print properties of QWidget?

    What I want to do is get the state of QWidget
    Define 'state'.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can I display/print properties of QWidget?

    By state I meant everything about the widget, all the attributes and properties so that I can compare the (state of) widget before and after touch.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Can I display/print properties of QWidget?

    Each widget holds all kinds of attributes which you can get through the respective methods, such size() for size, geometry() for geometry and so forth.
    Where is the problem?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. The following user says thank you to high_flyer for this useful post:

    dpatel (26th November 2010)

  6. #5
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can I display/print properties of QWidget?

    I am looking for one function that does the job. I guess I will have to get all the attributes individually.

    Thanks.

  7. #6
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Can I display/print properties of QWidget?

    Use meta data, check:
    QObject::metaObject
    QMetaObject::property
    QMetaProperty

    You can fetch list of all properties or just list of properties for given class (QMetaObject::propertyOffset).
    Last edited by MarekR22; 25th November 2010 at 13:58. Reason: reformatted to look better

  8. The following user says thank you to MarekR22 for this useful post:

    dpatel (26th November 2010)

Similar Threads

  1. print a QLabel over a QWidget
    By franco.amato in forum Newbie
    Replies: 2
    Last Post: 18th March 2010, 04:42
  2. Display File Properties [Solved]
    By DrDonut in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2009, 12:45
  3. Display a QWidget using multi-screen
    By tarod in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 14:02
  4. Replies: 11
    Last Post: 5th June 2007, 09:06
  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.