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

Qt Remote Objects: Support setting default values of complex types in .rep file

    XMLWordPrintable

Details

    Description

      The repc tool basically copies the RHS of the `=` sign into the member initializer. However, it breaks at the next `,` unless the `,` is inside a string literal.

      // test.rep
      POD Range(int min, int max)
      
      class Device
      {
          // Supported:
          PROP(int id = 42);
          PROP(QString status = "Setting X-range to {-10, 10}...");
      
          // Not supported:
          PROP(QList<int> targetIds = {1, 2, 3});
          PROP(Range xRange = Range{-10, 10});
          PROP(Range yRange = Range{0, 20});
      }
      

       

      The supported properties above currently get converted to this...

      class DeviceSimpleSource : public DeviceSource
      {
          Q_OBJECT
      
      public:
          explicit DeviceSimpleSource(QObject *parent = nullptr) : DeviceSource(parent)
          , m_id(42)
          , m_status("Setting X-range to {-10, 10}...")
          {
          }
      
      ...
      }
      

      ...so it shouldn't be too hard to make it accept initializer lists or constructors too.

      Attachments

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

        Activity

          People

            bstottle Brett Stottlemyer
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes