[Qt-interest] Extend property system to include relationships?
Chris Meyer
cmeyer1969+qt at gmail.com
Thu Mar 10 21:17:12 CET 2011
Could the Qt property system be extended to support relationships in
addition to properties?
For example, the following macro could be added to the Qt property
system to support to-many relationships:
QT_RELATIONSHIP(relationship name, class name,
READ getFunction,
COUNT countFunction,
INSERT insertFunction,
REMOVE removeFunction,
etc.)
There might be a similar macro for a to-one relationship.
Having such relationship information would allow QAbstractItemModels
to be automatically available to represent items in a relationship,
allow automatic archiving/unarchiving, and generally facilitate a
bunch of other generic algorithms that could function on the data
model. It would also be helpful to reduce C++ code in complex QML data
models.
Has thought been given to this type of extension to the property
system for a future version of Qt? (And is this the right forum to
discuss such an extension?)
class Team : public QObject
{
Q_OBJECT
public:
Q_PROPERTY(teamName);
Q_RELATIONSHIP(players, Player);
};
class Player : public QObject
{
Q_OBJECT
public:
Q_PROPERTY(fullName);
};
More information about the Qt-interest-old
mailing list