In this example descendant of QtDeclarative.QDeclarativeItemis created
in python code.
My question is about using in PySide/PyQT QML a widget, located in dll
file, created by compiling C++ QT code.
Is it possible?
02.05.2013 4:26, cckwes wrote:
Hi,
I think you need to expose you QWidget to QML using qmlRegisterType().
You can refer to this post on how to do it. :)
http://qt-project.org/forums/viewthread/7616
Regards,
Wesley
On Thu, May 2, 2013 at 1:42 AM, Sergey <[email protected]
<mailto:[email protected]>> wrote:
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
_______________________________________________
Interest mailing list
[email protected] <mailto:[email protected]>
http://lists.qt-project.org/mailman/listinfo/interest
--
Wesley Chong
Email: [email protected] <mailto:[email protected]>
Blog: http://blog.linux4us.org
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest