What is signficance of mapToScene and mapRect and QMatrix
-
void createCoreBox(QRect rect)
{QMatrix matrix
QRect p = matrix.inverted().mapRect(mapToScene(rect).boundingRect().toRect()); -
@Qt-Enthusiast
Hi
The
http://doc.qt.io/qt-5/graphicsview.html
section Item Coordinates
explain what mapToScene does and whyIts used to get the global coordinates of the rect for the transformation ( matrix)
-
Yes I went through the same , but did the significance of the same
-
Yes I went through the same , but did the significance of the same
Do you mean: Why would I need these transformations?
The view may contain just a small sub-area inside the whole area of where all your objects lie (which is the scene). So you need some transformation (mapping) between the small sub-area to the whole area (-> mapToScene).
Technically there are (will be) functions that you call with view coordinates and others that you call with scene coordinates. You may even write some yourself. Then the mapping functions come in handy.
-Michael.