problems with qgraphicsview and qgraphicsitem
hello, i have some problems with using opacity in qgraphicsitem.
I have two item added to my scene. When i'mtrying to change opacity of top one, it gives me funny colors.
http://img837.imageshack.us/i/image11y.jpg/
Here you have example. On the left you have bottom layer, in te middle top one and on the right snapshot of the result. Opacity of the top is set to 0.5.
Any ideas?
Re: problems with qgraphicsview and qgraphicsitem
and here is another thing:
http://img832.imageshack.us/i/problemw.jpg/
look at the printscreen, both view are same configures with same hint on the same scane, the only difference is that the main one(1) is not scaled like second one (2)
and i know that the problem is only with 100% view, on upscaled or downscaled there is no problem
have no clue what to do, please give me some hint
Re: problems with qgraphicsview and qgraphicsitem
Can you show the code...hard to say without knowing what you are doing
Re: problems with qgraphicsview and qgraphicsitem
yeah!
Code:
(...) <-other widgets, not important
mainView->setAutoFillBackground(true);
mainView->setScene(scene);
(...)
void MainWindow::setOp_S(int o)
{
qreal opac=o/100.0;
scene->items()[1]->setOpacity(opac);
scene->update(scene->sceneRect());
mainView->update();
update();
}
and here is how i change the size of image in main view:
Code:
void MainWindow::scaleImage_S(double ratio)
{
mainView->scale(scaleBack,scaleBack);
double scaleRatio=ratio/(double)100;
scaleBack=1/(double)scaleRatio;
mainView->scale(scaleRatio,scaleRatio);
actionZoomIn->setEnabled(pWidget->getRatio()<800);
actionZoomOut->setEnabled(pWidget->getRatio()>4);
}
the problem is only when the view in main view is 100% of image, not in upscale or downscale, i'm not using any of my functions to rescale image, just build-in QGraphicsView::Scale
after rendering the scene, no matter of size and scale, the result picture is ruined... i'm stuck...
Fixed the problem. If someone is interested in the solution, just ask by posting here.