personview.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:guiQML 作者: gramps-project 项目源码 文件源码
def __build_main_window(self, engine):
        """
        Builds the QML interface
        """
        parentcontext = engine.rootContext()
        #Create a context for the family tree list
        self.qmlpersonlistcontext = QtDeclarative.QDeclarativeContext(parentcontext)
        #Create ListModel to use
        personlistmodel = QMLPersonListModel(self.dbstate.db)

        #register them in the context
        self.qmlpersonlistcontext.setContextProperty('Const', self.const)
        self.qmlpersonlistcontext.setContextProperty('QMLPersonList', self)
        self.qmlpersonlistcontext.setContextProperty('QMLPersonListModel', personlistmodel)

        #create a Component to show
        self.qmlpersonlist = QtDeclarative.QDeclarativeComponent(engine)
        self.qmlpersonlist.loadUrl(QtCore.QUrl.fromLocalFile(
                os.path.join(ROOT_DIR, "guiQML", 'views', 'peopleview.qml')))
        #and obtain the QObject of it
        self.Qpersonlist = self.qmlpersonlist.create(self.qmlpersonlistcontext)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号