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

Q_GADGET should not require the whole class to be exported

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.3.0 Alpha
    • 4.8.7, 5.6.1, 5.7.0
    • Core: Object Model
    • None
    • Linux AMD64, GCC 6.1
    • 8
    • a0f9aef11bd3a692f9fa9c6069ca27200ef82893 (qt/qtbase/dev)
    • Team 2 Foundation_Sprint 47

    Description

      Unlike Q_OBJECT, which is used in QObject subclasses, which can be considered exported (because of the vtable), Q_GADGET is used in value classes, which should not be exported as a whole.

      Requiring exporting the class for Q_GADGET use will make people export classes which shouldn't be exported, exacerbating the problems with exported value classes (like QPolygon) we already have and thwarting attempts to reduce the number of exported value classes.

      Example:

      class QNetworkRawHeader
      {
          Q_GADGET
          Q_PROPERTY(QByteArray name READ name)
          Q_PROPERTY(QByteArray value READ value)
      public:
          // ...
      };
      

      yields:

      ../../../../../include/QtCore/../../../qtbase/src/corelib/kernel/qmetatype.h:1430: error: undefined reference to 'QNetworkRawHeader::staticMetaObject'
      

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes