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

Replace private members with protected for SimpleSource

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Remote Objects
    • None

    Description

      The documentations states https://doc.qt.io/qt-5/qtremoteobjects-source.html

      If you need to hide your implementation details, use the second class declared in the header file, the <Type>Source class. This class' definition does not provide data members, and also makes the getter/setter functions pure virtual. While you may need to write more code, using this class gives you more flexibility in your implementation.
      

      But I don't understand the reasoning here. Wouldn't it be clearer to mark the members protected so I only have to override the setters I need to? Currently, because the members are private, I cannot override the setter because I have no access to the variable.

      Also this change would be quite simple to implement:

      // reocodegenerator.cpp:970
       out << "private:" << endl;
      
          //Next output data members
          if (mode == SIMPLE_SOURCE) {
              for (const ASTProperty &property : astClass.properties)
                  out << "    " << typeForMode(property, SOURCE) << " " << "m_" << property.name << ";" << endl;
          }
      
          if (mode != SIMPLE_SOURCE)
              out << "    friend class QT_PREPEND_NAMESPACE(QRemoteObjectNode);" << endl;
      

      to

          //Next output data members
          if (mode == SIMPLE_SOURCE) {
              out << "protected:" << endl;
              for (const ASTProperty &property : astClass.properties)
                  out << "    " << typeForMode(property, SOURCE) << " " << "m_" << property.name << ";" << endl;
          }
      
          if (mode != SIMPLE_SOURCE) {
              out << "private:" << endl;
              out << "    friend class QT_PREPEND_NAMESPACE(QRemoteObjectNode);" << endl;
          }
      

      Attachments

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

        Activity

          People

            bstottle Brett Stottlemyer
            kelteseth Elias Steurer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes