Can QtQuick1 and QtQuick2 be used in a same program?
-
Because QtQuick2 can't display transparent window on Windows, so I plan to use QtQuick1 in part of my program. Meanwhile I want to use some feature of QtQuick2, so there are both QtQuick1 and QtQuick2 in my single program. Then I faced some problems. Program will crash in many occasions. Anyone successfully use both QtQuick1 and QtQuick2 in a same program on Windows ?
Thank you :)
-
I'm afraid that it's not possible to have QtQuick1 and QtQuick2 in a same project!!! because they are in different versions of Qt
-
Not true. You can use both, although I would not recommend it. Check out the "window container":http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/?utm_source=rss&utm_medium=rss&utm_campaign=introducing-qwidgetcreatewindowcontainer.
-
We can still use QtQuick1 in Qt5:
@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativecontext.h>
@But I faced problems when use both directly.
window container sound like a solution to use both QtQuick1 and QtQuick2, but I noticed it's a Qt 5.1 feature. So I should wait the 5.1 release if no other solution.
-
Yes. Qt5.1 is only a few weeks away, anyway. You can already start testing it by compiling from git dev branch.
-
I clone code from git stable branch, and cherry-pick the windowcontainer. (https://codereview.qt-project.org/#change,44285)
Now I can use QtQuick2 contained in a QWidget, but still have problems when using QtQuick1 at the same time: there can't be MouseArea in QtQuick1 qml files. If QtQuick1 code has MouseArea and I clicked on it, then the program crashes:
Qt5Qmld.dll!QQmlData::notify(int index) Line 238 + 0xc bytes C++
Qt5Qmld.dll!QQmlData::signalEmitted(QAbstractDeclarativeData * formal, QObject * object, int index, void * * a) Line 596 + 0xc bytes C++
Qt5Cored.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Line 3338 + 0x1e bytes C++
Qt5Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3320 + 0x1e bytes C++
Qt5Declaratived.dll!QDeclarativeMouseArea::entered() Line 800 + 0x13 bytes C++
Qt5Declaratived.dll!QDeclarativeMouseArea::setHovered(bool h) Line 868 + 0x1c bytes C++
Qt5Declaratived.dll!QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent * event) Line 490 C++
Qt5Widgetsd.dll!QGraphicsItem::sceneEvent(QEvent * event) Line 6664 C++
Qt5Declaratived.dll!QDeclarativeItem::sceneEvent(QEvent * event) Line 3051 + 0xd bytes C++
Qt5Declaratived.dll!QDeclarativeMouseArea::sceneEvent(QEvent * event) Line 674 + 0xc bytes C++
Qt5Widgetsd.dll!QGraphicsScenePrivate::sendEvent(QGraphicsItem * item, QEvent * event) Line 1217 C++
Qt5Widgetsd.dll!QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent * mouseEvent) Line 1291 C++
Qt5Widgetsd.dll!QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent * mouseEvent) Line 1420 C++
Qt5Widgetsd.dll!QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent) Line 3972 C++
Qt5Declaratived.dll!QDeclarativeScene::mousePressEvent(QGraphicsSceneMouseEvent * e) Line 121 C++
Qt5Widgetsd.dll!QGraphicsScene::event(QEvent * event) Line 3340 C++
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3398 + 0x11 bytes C++
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2829 + 0x10 bytes C++
Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 767 + 0x15 bytes C++
Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 206 + 0x38 bytes C++
Qt5Widgetsd.dll!qt_sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 3659 + 0xe bytes C++
Qt5Widgetsd.dll!QGraphicsView::mousePressEvent(QMouseEvent * event) Line 3222 + 0x18 bytes C++
Qt5Widgetsd.dll!QWidget::event(QEvent * event) Line 7846 C++
Qt5Widgetsd.dll!QFrame::event(QEvent * e) Line 534 + 0xc bytes C++
Qt5Widgetsd.dll!QAbstractScrollArea::viewportEvent(QEvent * e) Line 1163 + 0xc bytes C++
Qt5Widgetsd.dll!QGraphicsView::viewportEvent(QEvent * event) Line 2925 C++
Qt5Widgetsd.dll!QAbstractScrollAreaPrivate::viewportEvent(QEvent * event) Line 105 + 0x28 bytes C++
Qt5Widgetsd.dll!QAbstractScrollAreaFilter::eventFilter(QObject * o, QEvent * e) Line 121 + 0x29 bytes C++
Qt5Cored.dll!QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject * receiver, QEvent * event) Line 863 + 0x15 bytes C++
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3394 + 0x11 bytes C++
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2962 + 0x32 bytes C++
Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 767 + 0x15 bytes C++
Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 206 + 0x38 bytes C++
Qt5Widgetsd.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous) Line 2469 + 0xe bytes C++
Qt5Widgetsd.dll!QWidgetWindow::handleMouseEvent(QMouseEvent * event) Line 403 + 0x27 bytes C++
Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) Line 155 C++
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3398 + 0x11 bytes C++
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2829 + 0x10 bytes C++
Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 767 + 0x15 bytes C++
Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 206 + 0x38 bytes C++
Qt5Guid.dll!QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent * e) Line 1417 + 0xe bytes C++
Qt5Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) Line 1249 + 0x9 bytes C++
Qt5Guid.dll!QWindowSystemInterface::sendWindowSystemEventsImplementation(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 536 + 0x9 bytes C++
Qt5Guid.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 516 + 0x9 bytes C++
qwindowsd.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 86 + 0xd bytes C++
Qt5Cored.dll!qt_internal_proc(HWND * hwnd, unsigned int message, unsigned int wp, long lp) Line 423 C++