Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

[Qt5, Windows] Qt::Tool / Qt::Popup flag does not work properly on QQuickView

$
0
0
I also post this thread at: https://bugreports.qt-project.org/browse/QTBUG-29294 There are screenshots there. The first QQuickView is the father of the second QQuickView, the second view is set a ‘Qt::Tool’ flag. Then second view should be upon the first view, and the second view should be able to move outsize the area of first view.  QQuickView view;  view.setSource(QUrl::fromLocalFile("qml/view.qml"));  view.show();    QQuickView view2(&view);  view2.setFlags(Qt::Tool);  view2.rootContext()->setContextProperty("window", &view2);  view2.setSource(QUrl::fromLocalFile("qml/view2.qml"));  view2.show();  qDebug() << view2.winId() << view2.parent()->winId(); But the result is view2 cannot moved outside the area of first view. Here are the code of the two qml files: qml/view.qml import QtQuick 2.0   Rectangle {  id: main     width: 640     height: 480  color: "red" } qml/view2.qml import QtQuick 2.0   Rectangle {  id: window_rect  color: "pink"      width: 240  height: 480    MouseArea {   anchors.fill: parent   property variant clickPos     onPressed: {    clickPos  = Qt.point(mouse.x, mouse.y)   }     onPositionChanged: {    var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)    window.x += delta.x;    window.y += delta.y;   }  } } HOWEVER, when I’m using Qt4, it works properly. Qt4Code:         QDeclarativeView *view = new QDeclarativeView();  view->setSource(QUrl::fromLocalFile("qml/_view.qml"));    QDeclarativeView *view2 = new QDeclarativeView(view);    view2->setWindowFlags(Qt::Tool);  view2->rootContext()->setContextProperty("window", view2);  view2->setSource(QUrl::fromLocalFile("qml/_view2.qml"));    view->show();  view2->show(); view2 is upon view, and view2 can be moved freely, without the restriction of the first view. It just like the behavior of the toolbar of VisualStudio 2010, very common, but now I can’t implement it using QQuickView.. Meanwhile, there are also problems using Qt::Popup. When I set Qt::Popup on a QQuickView, it behaves as if it has no father(top level window). Microsoft Spy++ also proved that it has no father. But I printed it’s father using parent():   qDebug() << view2.winId() << view2.parent()->winId(); view2.parent() is not zero. My environment is Windows XP. I havn’t tested these on linux. I guess is it related to the new mechanism of QQuickWindow ?

Viewing all articles
Browse latest Browse all 4972

Trending Articles