Details
-
Bug
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
5.1.0 Beta 1
-
None
-
QtQuick 5.1beta1 (downloaded at May 5th), Windows XP (also tested on Windows 7, same result)
Description
I'm on Windows. I want to use QtQuick2 and QtQuick1 at the same time, because there are some features currently not available for QtQuick2 (transparent related problems)
#include <QtWidgets/QApplication> #include <QQmlEngine> #include <QtQml/QQmlComponent> #include <QQuickView> #include <QQmlContext> #include <QWidget> #include "quick1.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); QQuickView* win = new QQuickView(); win->setSource(QUrl::fromLocalFile("quick2.qml")); QWidget *container = QWidget::createWindowContainer(win); container->setWindowFlags(Qt::Window); container->resize(win->size()); container->show(); start_quick1_view(container); return a.exec(); }
using QtQuick2 and QtQuick1 in a same .cpp may lead to compile error, so I put QtQuick1 in a seperate .cpp file.
#pragma once #include <QWidget> void start_quick1_view(QWidget* parent);
#include "quick1.h" #include <QtDeclarative/qdeclarative.h> #include <QtDeclarative/qdeclarativeview.h> void start_quick1_view(QWidget* parent) { QDeclarativeView view0(parent); view0.move(60, 80); //view0.setWindowFlags(Qt::FramelessWindowHint); view0.setSource(QUrl::fromLocalFile("quick1.qml")); view0.show(); }
Comment this line "view0.setWindowFlags(Qt::FramelessWindowHint);" will make the program throws exception. Using Qt::FramelessWindowHint will make the Quick1's view not visible.
quick2.qml and quick1.qml is very simple:
import QtQuick 2.0 Rectangle { width: 600 height: 480 color: "red" }
import QtQuick 1.1 Rectangle { width: 480 height: 320 color: "green" }
I'm using Qt5.1beta1 (downloaded at May 5th). I also faced the problem when I'm using Qt5.0.2 patched with https://codereview.qt-project.org/#change,44285
Attachments
Issue Links
- is replaced by
-
QTBUG-35006 Qt Quick1 and Qt Quick2 cannot be mixed
- Closed