
Originally Posted by
marcel
Can you show me again the code?
if ( !readonly ){
if( band ){
band->move( e->pos()- mouseRectOffset );
return;
}
//some other stuffs regarding application
}
}
if( e->button() == LeftButton ){
if ( !readonly ){
if(canvasMode == CM_DragDropMode ){
hilitObject->hilight( this, FALSE );
dragSelection( e->pos() );
leftDown = TRUE;
return;
}
//some other stuffs regarding application
}
}
}
if( leftDown ){
leftDown = FALSE;
if( band ){
cacluateNewObjectPosition(e->pos());
delete band;
band = 0;
// If the pasteList is not empty (meaning we didn't cancel the
// paste operation), then do the following:
if( ! pasteList.isEmpty() ){
// Update the pixel coordinates
}
update();
return;
}
//some other stuffs regarding application
}
void myClass::pasteObjects(){
//first calculate pasteRect
if( !band )
band->setGeometry( pasteRect );
band->show();
}
void myClass
::dragSelection( QPoint clickedP
){ //first calculate pasteRect
if( !band )
band->setGeometry( pasteRect );
band->show();
}
void myClass::mouseMoveEvent( QMouseEvent *e ){
if ( !readonly ){
if( band ){
band->move( e->pos()- mouseRectOffset );
return;
}
//some other stuffs regarding application
}
}
void myClass::mousePressEvent( QMouseEvent *e ){
if( e->button() == LeftButton ){
if ( !readonly ){
if(canvasMode == CM_DragDropMode ){
hilitObject->hilight( this, FALSE );
dragSelection( e->pos() );
leftDown = TRUE;
return;
}
//some other stuffs regarding application
}
}
}
void myClass::mouseReleaseEvent( QMouseEvent *e ){
if( leftDown ){
leftDown = FALSE;
if( band ){
cacluateNewObjectPosition(e->pos());
delete band;
band = 0;
// If the pasteList is not empty (meaning we didn't cancel the
// paste operation), then do the following:
if( ! pasteList.isEmpty() ){
// Update the pixel coordinates
}
update();
return;
}
//some other stuffs regarding application
}
void myClass::pasteObjects(){
//first calculate pasteRect
if( !band )
band = new QRubberBand(QRubberBand::Rectangle, this);
band->setGeometry( pasteRect );
band->show();
}
void myClass::dragSelection( QPoint clickedP ){
//first calculate pasteRect
if( !band )
band = new QRubberBand(QRubberBand::Rectangle, this);
band->setGeometry( pasteRect );
band->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks