Add QQuickView to QWidget
-
Hi Everyone
I want to add a custom list view to my existing UI project, I read this article, but I think it needs an update now.http://doc.qt.digia.com/4.7-snapshot/qml-integration.html
I am getting following error if I do it with Qt 5.0 Qt Creator 2.6.1
error: C2664: 'QBoxLayout::addWidget' : cannot convert parameter 1 from 'QQuickView' to 'QWidget *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be calledany pointers how I would be able to perform this.
-
I am afraid this is somewhat complicated in Qt5 and not even possible in 5.0. The main reason is that QQuickView is no longer a widget but a QWindow. With 5.0 there is no simple solution, but in Qt 5.1 we have added a new function QWidget::createWindowContainer which you can use to embed a QQuickView in a QWidget layout like you are trying to do. For Qt 5.0 the only solution is to use the QQuick1 module and associative QDeclarativeView classes which you were using in Qt4.
-
QQuickView is child of QWindow(a top level window) and can't add to qwidget as before. See this:
https://bugreports.qt-project.org/browse/QTBUG-25643 -
well I switched to qt 4.8 and it seems to work nice now all I needed was to have a Custom List View ontop of my chatting application, and I have tested by putting in a qml object now shall be moving towards learning qml to build a custom listview.
thanks by the way how to mark this solved.
-
[quote author="Jens" date="1361292785"]I am afraid this is somewhat complicated in Qt5 and not even possible in 5.0. The main reason is that QQuickView is no longer a widget but a QWindow. With 5.0 there is no simple solution, but in Qt 5.1 we have added a new function QWidget::createWindowContainer which you can use to embed a QQuickView in a QWidget layout like you are trying to do. For Qt 5.0 the only solution is to use the QQuick1 module and associative QDeclarativeView classes which you were using in Qt4.[/quote]
Very good solution. But i have a suggestion that, it will be nice if Qt team can provide a similar solution like QDeclarativeView.
-
[quote author="ansifpi" date="1393569020"]i have a suggestion that, it will be nice if Qt team can provide a similar solution like QDeclarativeView.[/quote]Qt 5.3 will have QQuickWidget