Resizing QQuickWidget window changes positions of inner QML objects on the Map component
-
wrote on 11 Jun 2020, 15:43 last edited by
Hi everyone!
I have a problem resizing a QQuickWidget window that contains QML Map and MapQuickItem objects.
When I resize the window, MapQuickItems that on the Map component change their window position and it turns to normal position only after zooming or dragging the map. How to solve?int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QQuickWidget *widget = new QQuickWidget;
widget->setResizeMode(QQuickWidget::ResizeMode::SizeRootObjectToView);
widget->setSource(QUrl("../map_test/main.qml"));
setCentralWidget(widget);
}Item {
width: 1000
height: 1000
Map {
anchors.fill: parent
plugin: Plugin {
name: "osm"
}
MapQuickItem {
coordinate: QtPositioning.coordinate(20, 20)
sourceItem: Rectangle {
color: "red"
width: 100
height: 100
}
}
}
} -
wrote on 31 Jan 2022, 10:17 last edited by
Did you find a solution to this?
-
wrote on 21 Apr 2025, 19:11 last edited by
Hi! This is my problrem too any advice? :(