7 setCursor( Qt::OpenHandCursor );
12 return( pix.rect( ) );
15 void GraphicsItem::paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget ) {
18 painter->drawPixmap( pix.rect( ), pix );
33 if( QLineF( event->screenPos( ),
event->buttonDownScreenPos( Qt::LeftButton ) ).length( ) <
34 QApplication::startDragDistance( ) ) {
38 qDebug( ) << objectName( );
39 QDrag *drag =
new QDrag( event->widget( ) );
40 QMimeData *mime =
new QMimeData;
42 mime->setText( objectName( ) );
44 drag->setMimeData( mime );
45 drag->setPixmap( pix.scaledToWidth( 100 ) );
47 drag->exec( Qt::CopyAction, Qt::CopyAction );
53 setCursor( Qt::OpenHandCursor );
GraphicsItem(QString name, QPixmap pix, QFileInfo file)
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
void setPix2(const QPixmap &value)
virtual QRectF boundingRect() const Q_DECL_OVERRIDE
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE
void Image(const QPixmap &, const QFileInfo &)
QFileInfo fileInfo() const