first attempt to connect qml gui to pyside
[pywienerlinien] / itip_qml
1 #!/usr/env/python
2
3 from PySide import QtCore, QtGui, QtDeclarative
4
5 class iTip(QtCore.QObject):
6     @QtCore.Slot(str, str)
7     def search(self, line, station):
8         print line
9         print station
10
11 if __name__ == '__main__':
12     import sys
13
14     app = QtGui.QApplication(sys.argv)
15
16     view = QtDeclarative.QDeclarativeView()
17
18     # instantiate the Python object
19     itip = iTip()
20
21     # expose the object to QML
22     context = view.rootContext()
23     context.setContextProperty("itip", itip)
24
25     view.setSource(QtCore.QUrl('gotovienna/qml/main.qml'))
26     view.show()
27
28     sys.exit(app.exec_())