Results 1 to 3 of 3

Thread: How to use property name in every class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2014
    Posts
    15
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default How to use property name in every class

    Hi
    I have two issues:
    1. I have created a property name using QProperty but i am unable to access this property name in the same class and other classes.
    2. Although using setter function the value of property get set but is this possible that i write property name=somevalue and automatically setter function is called
    Thanks.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: How to use property name in every class

    1. We have no idea what your code is doing or trying to do.

    2. No. If you want to set the property then either call the setter on an instance of the specific class or use the generic QObject::setProperty() function on a QObject instance.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: How to use property name in every class

    Quote Originally Posted by GAURAV PANT View Post
    2. Although using setter function the value of property get set but is this possible that i write property name=somevalue and automatically setter function is called
    Additional to what ChrisW67 wrote: if the object is exported to QML or instantiated from QML then yes.

    Cheers,
    _

Similar Threads

  1. Replies: 5
    Last Post: 13th January 2014, 10:24
  2. Replies: 0
    Last Post: 26th November 2013, 16:11
  3. show object (scene) in widget in class class mainwindow
    By rimie23 in forum Qt Programming
    Replies: 8
    Last Post: 1st May 2012, 17:15
  4. Replies: 7
    Last Post: 18th August 2011, 15:43
  5. Replies: 3
    Last Post: 27th December 2008, 20:34

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.