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

moc with templated types and const keyword in slots and signals

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.3
    • Core: Object Model
    • None
    • 01648005f1f546dc0281155fecd94b4f47a94584

    Description

      A simple example of this bug:

      // A simple templated class (we need 2 or more templated types)
      template<typename T1, typename T2> class TestTemplate {};

      class Object : public QObject
      {
      Q_OBJECT
      public slots:
      // The second templated type must be const
      void testSlot(TestTemplate<int, const short*>);

      signals:
      // The second templated type must be const
      void testSignal(TestTemplate<int, const short*>);
      };

      The moc file move "const" keyword at the first templated type as we can see here:

      case 0: testSignal((reinterpret_cast< TestTemplate<const int, short>>(_a[1]))); break;
      case 1: testSlot((reinterpret_cast< TestTemplate<const int, short>>(_a[1]))); break;

      So there are differents types, we can by-pass this bug with a simple "typedef const short* const_short_ptr" and use "const_short_ptr" instead of "const short*".

      (Sorry for my bad english)

      Attachments

        1. TestTemplate.hpp
          0.4 kB
          Virant Jérémy
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            nydhu Virant Jérémy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes