after completing our first project with QxOrm and QtQuick, we are looking at the lessons learned and also preparing for the next, bigger venture. In doing that we have decided that in order to minimize development overhead, we would like to add a few capabilities to QxOrm / QxEntityEditor which we consider quite important and which might also be useful for the general public. Before listing the requirements / capabilities, I would like to point out that if they cannot be met with the current functionality (which is our perception), we would be willing to implement them ourselves and contribute them back to the project, provided there is enough support from qxorm to enable this.
Heres the requirements:
- We need to publish our classes to QML. We dont want to work with the QxModelView module however, but rather directly QML-enable our persistent classes. This means adding Q_PROPERTY and signal declarations to the generated header code, as well as adding code for emitting the appropriate signals from the setter methods. We want to apply this only to certain class members selectively
- We want to persistence-enable certain properties in such a way that updates to these properties are immediately written through to the database. We are currently doing this by creating additional "persistent setters" in the custom cpp file which we then use in the WRITE clause of the Q_PROPERTY declaration. We yould much rather generate these setter methods
Point 1 and 2 would require additional annotations in the EntityEditor (which members should become Q_PROPERTIES? Which signals do they emit? What setter do they invoke?). For point 2 we would like to be able to automate the generation of the "auto-persistent" setter methods (see code sample below) as well.
- Code: Select all
//Header:
Q_PROPERTY(double hourlyWages READ getHourlyWages WRITE setHourlyWagesP NOTIFY dataChanged)
//Setter implementation:
void Project::setHourlyWagesP(const double & val)
{
setHourlyWagesNoAutomation(val);
qx::dao::update(*this, 0, QStringList(column_HourlyWages()));
emit(dataChanged());
}
It seems to me that the current generator customization mechanism is not flexible enough to meet these requirements. Please let me know what you would consider the best way to implement them. With regard to the additional annotations in EnityEditor we are also considering an alternative path based on text annotations inside C++ class declarations (or XML files, for that matter). This might be easier to maintain than using EntityEditor every time (and dealing with the non-versionable qxee file).
Regards,
Christian
gsvitec