Hi list,
We've made a promise to submit any API design decisions to public
scrutiny on the mailing list, but sometimes we fail. (Big part of the
blame falls on me since I accepted the internal scrum story without
realizing that it was all about creating a new public API.)
So, here comes a "posthumous" feature proposal.
Qt allows for Qt properties to be defined on compile and run-time and
then accessed using standard setters and getters [1]. PyQt implements
this by defining QtCore.pyqtProperty method which accepts Python
functions as getters and setters in pretty much a similar fashion as
Qt's Q_PROPERTY macro [2].
Since there is really nothing wrong with the PyQt syntax except the
unfortunate name, the proposal is to deal with this in an identical
manner to signals and slots (as defined in PSEP 100 [3]). Hence, PySide
would have a QtCore.Property function which would behave identically to
PyQt's QtCore.pyqtProperty for all purposes and intents.
The current implementation, already present in PySide 0.4.0, already has
everything in place, except that the function is named QtCore.QProperty.
See the unit tests for an example how it works at the moment [4].
I prefer naming the function QtCore.Property for two reasons:
1) In that way, our renaming scheme would be consistent
(pyqtSignal->Signal, pyqtSlot->Slot, pyqtProperty->Property).
2) If the name was QProperty, one would be led to assume it's just a Qt
class among others, while in practice both the implementation and
functionality are something completely different.
I'd like to hear your comments on this. If this is a scheme everyone
accepts, I'll make a PSEP out of it, we'll fix the implementation, and
document it properly.
[1] http://doc.trolltech.com/4.6/properties.html
[2]
http://www.riverbankcomputing.com/static/Docs/PyQt4/pyqt4ref.html#writing-qt-designer-plugins
[3] http://www.pyside.org/docs/pseps/psep-0100.html
[4]
http://qt.gitorious.org/pyside/pyside/blobs/master/tests/QtCore/qobject_property_test.py
Cheers,
ma.
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside