Fix bug 1029 - "qmlRegisterType Fails to Increase the Ref Count"
This commit is contained in:
parent
64ffc4f61b
commit
dde75099f2
4 changed files with 48 additions and 0 deletions
29
tests/QtDeclarative/bug_1029.py
Normal file
29
tests/QtDeclarative/bug_1029.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue