I'm trying to add a blur effect on my graphicsView but i have to trigger the action twice to apply the effect.The first time i trigger it, it applies the effect on the graphicsView's borderline and on the second trigger it applies it on the scene.Here is my code(the same with colorize effect):
void MainWindow::on_actionBlur_triggered()
{
QGraphicsBlurEffect *a=new QGraphicsBlurEffect;
a->setBlurHints(QGraphicsBlurEffect::QualityHint);
a->boundingRectFor(ui->graphicsView->viewport()->rect());
ui->graphicsView->setGraphicsEffect(a);
}
Can you spot the mistake or propose a different way fo doing this?