Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Custom Widget Class Properties
Forum Updated to NodeBB v4.3 + New Features

Custom Widget Class Properties

Scheduled Pinned Locked Moved General and Desktop
widgets
4 Posts 2 Posters 1.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andy314
    wrote on 10 Sept 2015, 08:50 last edited by Andy314 9 Oct 2015, 08:54
    #1

    Hello !
    I need some widgets derived from some standard wigets with similar additional functionality (same Properties).
    My first idea was templates, but a QObject template is not possible.
    Now I try to integrate all poperties in a QObject subclass. The custom wiget gets this class property with inclusive its subproberties.
    Is this possible ? Can I get a entry in the property explorer, which shows in expanding mode the subproperties similar to the Font property.
    I tried this, but

        TPropTest itsPropTest;        // a QObject class with properties
        Q_PROPERTY(TPropTest PropTest READ readPropTest)
        TPropTest readPropTest() { return itsPropTest; }
    

    The problem is that a QObject has no copyconstructor.
    What can I do ????

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Sept 2015, 08:59 last edited by
      #2

      Hi,

      You have to use a pointer to your QObject if you want to use it like that

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply 10 Sept 2015, 09:04
      0
      • S SGaist
        10 Sept 2015, 08:59

        Hi,

        You have to use a pointer to your QObject if you want to use it like that

        A Offline
        A Offline
        Andy314
        wrote on 10 Sept 2015, 09:04 last edited by
        #3

        @SGaist

            TPropTest itsPropTest;
            Q_PROPERTY(TPropTest* PropTest READ readPropTest)
            TPropTest* readPropTest() { return &itsPropTest; }
        

        This shows no PropTest in the explorer.
        Must I integrate a setter for the whole class ? and how ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 10 Sept 2015, 09:07 last edited by
          #4

          I missed the point about the Property Explorer, I'm really not sure it can handle an embedded object like that.

          The setter follows the same logic as any other property: setReadPropTest(TPropTest *tPropTest);

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          3/4

          10 Sept 2015, 09:04

          • Login

          • Login or register to search.
          3 out of 4
          • First post
            3/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved