Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-40045

Need smart pointers as properties

    XMLWordPrintable

Details

    Description

      In this modern era I think many people want to use smart pointers instead of raw pointers, and so it would be neat to be able to expose them to QML, like so:

      Smart class
      class Test : public QObject
      {
          Q_PROPERTY(QSharedPointer<Theme> theme READ theme CONSTANT)
      
      private:
      
          QSharedPointer<Theme> m_theme;
      }
      

      The only alternative I see right now is to have a private function which just returns the raw pointer, which doesn't look too good.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              xarxer Pontus Sjögren
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes