I currently have an image displayed in the graphics view with the following function:
void Form::setImage(std::string filename)
{
image
= image.
transformed(QMatrix().
rotate(-90), Qt
::FastTransformation);
ui.graphicsView->setBackgroundBrush(image);
}
void Form::setImage(std::string filename)
{
QPixmap image(filename.c_str());
image = image.transformed(QMatrix().rotate(-90), Qt::FastTransformation);
ui.graphicsView->setBackgroundBrush(image);
}
To copy to clipboard, switch view to plain text mode
That seems to work fine (it takes the original image and rotates it 90 degrees cclockwise). So here's the problem, when I use the following function, to rotate the image further, it rotates the image but leaves the original image in the background. I went through the 40000 chips example, and I don't necessarily see anything different with my code. If anyone knows why the original image is shown beneath the rotation, please let me know. Here is the function:
void Form::scaleView(qreal scaleFactor)
{
qreal scale = pow(2.0, (scaleFactor) );
matrix.scale(scale, scale);
matrix.rotate(levelRotate);
ui.graphicsView->setMatrix(matrix);
}
void Form::scaleView(qreal scaleFactor)
{
qreal scale = pow(2.0, (scaleFactor) );
QMatrix matrix;
matrix.scale(scale, scale);
matrix.rotate(levelRotate);
ui.graphicsView->setMatrix(matrix);
}
To copy to clipboard, switch view to plain text mode
Bookmarks