Const QRectF CLineItem: : boundingRect ()
{
Return shape (). ControlPointRect ();
}
Const QPainterPath CLineItem: : shape ()
{
QPainterPath path;
If (m_line==QLineF ())
Return path.
Path. The moveTo (0, 0);
Path. The lineTo (200200);
QPainterPathStroker stoker.
Stoker. SetWidth (2);
Stoker. SetJoinStyle (Qt: : MiterJoin);
Stoker. SetCapStyle (Qt: : RoundCap);
Stoker. SetDashPattern (Qt: : DashLine);
Return stoker. CreateStroke (path);
}
Void XXXGraphicsView: : mousePressEvent (QMouseEvent * event)
{
If (event - & gt; Button ()==Qt: : LeftButton)
{
QPoint point=event - & gt; Pos ();
for(int i=0; i<601; + + I)
{
for(int j=0; J<401; + + j)
{
QGraphicsItem * item1=itemAt (QPoint (I, j));
If (item1)
{
QDebug () & lt; <" The view "& lt;
QPointF pt=mapToScene (QPoint (I, j));
Item2 QGraphicsItem *=m_pScene - & gt; ItemAt (pt, the transform ());
If (item2)
{
QDebug () & lt; <" Sence "& lt;
}
}
}
QGraphicsView: : mousePressEvent (event);
}