Results 1 to 13 of 13

Thread: User defined property & compound properties

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default User defined property & compound properties

    I just need some direction on this one.

    I want to create MyClass with some Q_PROPERTY fields then declare MyClass as a metatype so I can use it in QVarient and set it as a Q_PROPERTY of my main widget. Then MyClass properties will get added as compound properties (like geometry or font on QWidget).

    I run a Q_DECLARE_METATYPE() at the end of MyClass and qRegisterMetaType<MyClass>(); in the constructor of the widget. Declaring:
    Q_PROPERTY(MyClass myClass READ myClass WRITE setMyClass) in the header.

    It runs the setMyClass method but doesn't display anything...

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: User defined property & compound properties

    Maybe a little compiling example code?
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

Similar Threads

  1. QUrl with user-defined structure
    By csoler in forum Qt Programming
    Replies: 0
    Last Post: 5th April 2010, 10:29
  2. QSqlQueryModel + user defined roles
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 7th December 2009, 07:29
  3. Resizing user defined QGraphicsItem
    By manti_madhu in forum Qt Programming
    Replies: 0
    Last Post: 9th September 2009, 09:35
  4. Using User Defined Libraries
    By csvivek in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 19:47
  5. User Defined Signal?
    By rajeshs in forum Newbie
    Replies: 2
    Last Post: 18th December 2007, 11:42

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.