def __build_main_window(self, engine):
"""
Builds the QML interface
"""
parentcontext = engine.rootContext()
#Create a context for the family tree list
self.centralviewcontext = QtDeclarative.QDeclarativeContext(parentcontext)
#Create ListModel to use
detviews = DetViewSumModel([DetailView('People')])
#register them in the context
self.centralviewcontext.setContextProperty('Const', self.const)
self.centralviewcontext.setContextProperty('CentralView', self)
self.centralviewcontext.setContextProperty('DetViewSumModel', detviews)
#create a Component to show
self.centralview = QtDeclarative.QDeclarativeComponent(engine)
self.centralview.loadUrl(QtCore.QUrl.fromLocalFile(
os.path.join(ROOT_DIR, "guiQML", 'views', 'centralview.qml')))
#and obtain the QObject of it
self.Qcentralview = self.centralview.create(self.centralviewcontext)
评论列表
文章目录