{
painter.begin(this);
if (rectABorrar.isNull())
{
// Paint all the image for the first time centered on the widget
int rectW = arrodonirValor(imatge.width() * escala);
int rectH = arrodonirValor(imatge.height() * escala);
rectFoto.setRect((width() >> 1) - (rectW >> 1), (height() >> 1) - (rectH >> 1), rectW, rectH);
painter.drawImage(rectFoto, imatge);
}
else
{
// "rectSeleccio" defines the old position and size (geometry) of the rubberband and needs to be deleted with the original portion of the image, defined by "rectABorrar"
painter.
setCompositionMode(QPainter::CompositionMode_Destination);
//I don't know if this is the Composition Mode that I should use???? painter.drawImage(rectSeleccio, imatge, rectABorrar);
rectABorrar.setRect(-1, -1, 0, 0);
}
// Code to Paint the rubberband.........
painter.end()
}
void FotoEditorFotos::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
if (rectABorrar.isNull())
{
// Paint all the image for the first time centered on the widget
int rectW = arrodonirValor(imatge.width() * escala);
int rectH = arrodonirValor(imatge.height() * escala);
rectFoto.setRect((width() >> 1) - (rectW >> 1), (height() >> 1) - (rectH >> 1), rectW, rectH);
painter.drawImage(rectFoto, imatge);
}
else
{
// "rectSeleccio" defines the old position and size (geometry) of the rubberband and needs to be deleted with the original portion of the image, defined by "rectABorrar"
painter.setCompositionMode(QPainter::CompositionMode_Destination);//I don't know if this is the Composition Mode that I should use????
painter.drawImage(rectSeleccio, imatge, rectABorrar);
rectABorrar.setRect(-1, -1, 0, 0);
}
// Code to Paint the rubberband.........
painter.end()
}
To copy to clipboard, switch view to plain text mode
Bookmarks