QGraphicsPixmapItem * pMapItemB;
QPixmap PIC;
PView CMapGraph *;
PView=new CMapGraph (pParent);
PScene=new QGraphicsScene;
PMapItemB=new QGraphicsPixmapItem;
PScene - & gt; AddItem (pMapItemB);
PIC. The load (" F:/_yz __zhmap zhmap - 20190114-20190114. The PGM ");
QBitmap btMap=PIC. CreateMaskFromColor (QColor (0, 255, 0, 255), Qt: : MaskOutColor);
PIC. SetMask (btMap);
PMapItemB - & gt; SetPixmap (PIC);
PMapItemB - & gt; SetFlag (QGraphicsItem: : ItemIsSelectable, true);
PMapItemB - & gt; SetFlag (QGraphicsItem: : ItemIsMovable, true);
Above this code is used to display an image with the mask, and want to make the image can be moved, is now set up the mask can't move, remove the lines of code set the mask, you can use the mouse to move the picture, teach a great god, how can move one with the picture of the mask,
CodePudding user response:
Didn't see what's the problem, help top, if mask hindered mouse events (arguably, should not be)