Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
QQuickWindow : Center contentItem
dvdk last edited by
I am trying to fit the contentItem() in a QQuickWindow, like the fitInView function from QGraphicsView.
Scaling the contentItem()->childrenRect() to QQuickWindow::width() and height() is no problem, but centering the content in the QQuickWindow seems more difficult.
I fail to understand how to convert QQuickWindow coordinates to scene coordinates (mapToView equivalent)
Basically if I can determine the center of the QQuickWindow in scene coordinates, I can re-position the contentItem to be centered in the window.
What is the best way to center the contentItem in a QQuickWindow ?