void StyledButton::mouseMoveEvent(QMouseEvent* e) { QButton::mouseMoveEvent( e ); #ifndef QT_NO_DRAGANDDROP if ( !mousePressed ) return; if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) { if ( edit == ColorEditor ) { QColorDrag *drg = new QColorDrag( col, this ); QPixmap pix( 25, 25 ); pix.fill( col ); QPainter p( &pix ); p.drawRect( 0, 0, pix.width(), pix.height() ); p.end(); drg->setPixmap( pix ); mousePressed = FALSE; drg->dragCopy(); } else if ( edit == PixmapEditor && pix && !pix->isNull() ) { QImage img = pix->convertToImage(); QImageDrag *drg = new QImageDrag( img, this ); if(spix) drg->setPixmap( *spix ); mousePressed = FALSE; drg->dragCopy(); } } #endif }
void ColorButton::mouseMoveEvent(QMouseEvent *e) { if (! mousepressed) return; if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { mousepressed = FALSE; setDown(FALSE); QColorDrag *cd = new QColorDrag(color(), this); cd->dragCopy(); } }