Fix bug 1029 - "qmlRegisterType Fails to Increase the Ref Count"

This commit is contained in:
Hugo Parente Lima 2011-11-01 17:29:01 -02:00
commit dde75099f2
4 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,29 @@
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtDeclarative import *
import sys
import gc
def register_qml_types():
class TestClass(QDeclarativeItem):
def __init__(self, parent = None):
QDeclarativeItem.__init__(self, parent)
qmlRegisterType(TestClass, "UserTypes", 1, 0, "TestClass")
def main():
app = QApplication([])
# reg qml types here
register_qml_types()
# force gc to run
gc.collect()
view = QDeclarativeView()
url = QUrl(__file__.replace(".py", ".qml"))
view.setSource(url)
if __name__ == "__main__":
main()