コード例 #1
0
ファイル: cv.cpp プロジェクト: Miguel-J/eneboo-core
void ReportCanvas::contentsMouseMoveEvent( QMouseEvent* e ) {
	QPoint p = inverseWorldMatrix().map( e->pos() );

	/*    QCanvasItemList l=canvas()->collisions(p);
	  setCursor(QCursor(Qt::ArrowCursor));
	    unsetCursor();
	    for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
	    { 
		if ((*it)->rtti() > 2000)
		{
		    CanvasReportItem *item = (CanvasReportItem*)(*it);
		    if (item->bottomRightResizableRect().contains(e->pos()))
			setCursor(QCursor(Qt::SizeFDiagCursor));
		}
	    }*/

	if ( moving ) {
		moving->moveBy( p.x() - moving_start.x(),
		                p.y() - moving_start.y() );
		/*	attempt to prevent item collisions
		        QCanvasItemList l=canvas()->collisions(moving->rect());
			if (l.count() > 2)
			{
			    moving->moveBy(-(p.x() - moving_start.x()),
					   -(p.y() - moving_start.y()));
			    canvas()->update();
			    return;
			}*/
		moving_start = p;
		moving->updateGeomProps();
		canvas() ->update();
	}
	if ( resizing ) {
		QCanvasRectangle * r = ( QCanvasRectangle * ) resizing;
		int w = r->width() + p.x() - moving_start.x();
		int h = r->height() + p.y() - moving_start.y();
		if ( ( w > 10 ) && ( h > 10 ) )
			r->setSize( w, h );
		moving_start = p;
		resizing->updateGeomProps();
		canvas() ->update();
	}
}