Details
-
User Story
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
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; }