Home > Back-end >  QGraphicsPixmapItem: : setRotation () function call after the mouse zoom view, image disappear?
QGraphicsPixmapItem: : setRotation () function call after the mouse zoom view, image disappear?

Time:03-23

The code is as follows:
The
reference
if (! M_vehicleItem)
{
QString filename=QDir: : currentPath () + "/vehicle. PNG";
QDebug () & lt; <"Filename:" & lt; QPixmap image (filename);
If (image. The isNull ())
{
QDebug () & lt; <"Error: the image is not exist!" ;
}
QPixmap img=image. Three (4000, 2000, Qt: : KeepAspectRatio, Qt: : SmoothTransformation);
M_vehicleItem=new QGraphicsPixmapItem ();

M_vehicleItem - & gt; SetPixmap (img);
//m_vehicleItem - & gt; SetShapeMode (QGraphicsPixmapItem: : HeuristicMaskShape);
M_vehicleItem - & gt; SetOffset (m_vehicleItem - & gt; BoundingRect (). The width ()/2, m_vehicleItem - & gt; BoundingRect (), height ()/2);
M_vehicleItem - & gt; SetFlag (QGraphicsItem: : ItemIsMovable);
Scene () - & gt; AddItem (m_vehicleItem);
}
M_vehicleItem - & gt; SetPos (point);
M_vehicleItem - & gt; SetRotation (60);
Scene () - & gt; The update ();



The
reference
m_TestRouteView=new TestRouteView (scene);
Scene - & gt; SetView (m_TestRouteView);
//scene - & gt; SetSceneRect (m_TestRouteView - & gt; Viewport () - & gt; The rect ());
M_TestRouteView - & gt; SetRenderHint (QPainter: : Antialiasing);
M_TestRouteView - & gt; SetCacheMode (QGraphicsView: : CacheBackground);
M_TestRouteView - & gt; SetOptimizationFlags (QGraphicsView: : DontSavePainterState);
M_TestRouteView - & gt; SetViewportUpdateMode (QGraphicsView: : SmartViewportUpdate);
//m_TestRouteView - & gt; SetViewportUpdateMode (QGraphicsView: : FullViewportUpdate);
M_TestRouteView - & gt; SetTransformationAnchor (QGraphicsView: : AnchorUnderMouse);


As long as I call setRotation () function scaling occurs after rotation, don't call ok,
Use the Transform complete rotation operation is the same question!
Bosses, river's lake emergency!
  • Related