[Interest] view examples\declarative\cppextensions\qwidgets\qwidgets.qml using pySide or PyQt4

Sergey sh0375 at gmail.com
Wed May 1 19:42:03 CEST 2013


Hi,

I've downloaded and installed
ftp://ftp.qt.nokia.com/qt/source/qt-win-opensource-4.8.1-vs2008.exe

examples\declarative\cppextensions\qwidgets\ is working well:
D:\QT\4.8.1\bin\qmlviewer.exe qwidgets.qml

But I can not make it working in pySide or PyQt4.
I use http://releases.qt-project.org/pyside/PySide-1.1.2.win32-py2.7.exe

This is python script:
---------------------------------------
import sys
import os

from PySide import QtCore, QtGui, QtDeclarative
basedir = os.path.dirname(os.path.realpath(__file__))
app = QtGui.QApplication(sys.argv)
view = QtDeclarative.QDeclarativeView()
view.setSource(QtCore.QUrl(basedir + '/' + sys.argv[1]))
view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
##view.setWindowIcon(QtGui.QIcon(basedir + '/icon.ico'))
view.setWindowTitle('Simple Data')
w=800
h=600
sw=QtGui.QApplication.desktop().screen().rect().width()
sh=QtGui.QApplication.desktop().screen().rect().height()
view.setGeometry((sw-w)/2, (sh-h)/2, w, h)
view.show()
sys.exit(app.exec_())
---------------------------------------

gives error:
D:\QT\4.8.1\examples\declarative\cppextensions\qwidgets/qwidgets.qml:42:1: 
import "QWidgets" has no qmldir and no namespace

Same problem if use PyQt4.

Is it possible to embed QWidget-based objects into QML in pySide or PyQT4?


--
Regards,

Sergey



More information about the Interest mailing list