On Friday 14 January 2011 13:23:52 Fars- mo wrote: > Ilkka Laukkanen wrote: > > I'd favor forms that allow you to keep a reference to the app object > > with the minimum fuss and magic, because for some apps you might need > > it... the forms in your first e-mail, to be exact. > > On the other hand, due to the dynamic nature of Python's type system, > QApplication.instance() will return the current QApplication. This is not > true in C++ as ::instance() only returns a QCoreApplication*, although I'm > not sure what the rationale for not providing QApplication::instance() is. > > What does the PySide team think about using QApplication.instance() in this > way? Is it discouraged?
In C++ QCoreApplication::instance returns a QCoreApplication pointer and QApplication::instance returns a QApplication pointer. In Python both return the correct type because the bindings always try to discover the real type of a C++ variable, i.e. app = QApplication([]) type(app) == type(QCoreApplication.instance()) # True > > Farsmo > > _______________________________________________ > PySide mailing list > PySide@lists.openbossa.org > http://lists.openbossa.org/listinfo/pyside -- Hugo Parente Lima INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list PySide@lists.openbossa.org http://lists.openbossa.org/listinfo/pyside