def testQDeclarativeNetworkFactory(self): view = QDeclarativeView() url = QUrl.fromLocalFile(adjust_filename('hw.qml', __file__)) view.setSource(url) view.show() self.assertEqual(view.status(), QDeclarativeView.Ready) self.app.exec_()
def testModelExport(self): view = QDeclarativeView() dataList = [MyObject("Item 1"), MyObject("Item 2"), MyObject("Item 3"), MyObject("Item 4")] ctxt = view.rootContext() ctxt.setContextProperty("myModel", dataList) url = QUrl.fromLocalFile(adjust_filename("viewmodel.qml", __file__)) view.setSource(url) view.show() self.assertEqual(view.status(), QDeclarativeView.Ready)
def testQDeclarativeViewList(self): view = QDeclarativeView() dataList = ["Item 1", "Item 2", "Item 3", "Item 4"] ctxt = view.rootContext() ctxt.setContextProperty("myModel", dataList) url = QUrl.fromLocalFile(adjust_filename('view.qml', __file__)) view.setSource(url) view.show() self.assertEqual(view.status(), QDeclarativeView.Ready)