Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
None
-
None
Description
From qt4-preview-feedback:
It would be useful to have a Q_PROPERTY extension that works on simple data
fields by itself (kind of using implicit accessor methods) – e.g. it would
save some typing to be able to replace
class Something:public QObject {
Q_OBJECT
Q_PROPERTY(QString something READ something WRITE setSomething)
public:
const QString &something() const
void setSomething(const QString &whatever)
{ m_something=whatever; } QString m_something;
};
with
class Something:public QObject {
Q_OBJECT
Q_PROPERTY(QString something IS m_something)
public:
QString m_something;
};
or even
class Something:public QObject {
Q_OBJECT
public:
Q_PROPERTY(QString something READABLE true WRITABLE true); //
<--- "something" is declared as a QString member and is accessible as
property "something"
};
I know that most of the time having a member variable exposed directly without
an accessor function is a bad idea, but for a few things it actually makes
sense.