Glow effect on a widget without QML / Qt Quick
-
wrote on 29 Jul 2014, 10:34 last edited by
I'm working on enchancing my applications UI elements with Qt's graphical effects. I've read documentation about glow effects, and they all refer to using QML/Qt Quick, which I don't currently use and don't really want to use either. I managed to find QWidget::setGraphicsEffect(QGraphicsEffect * effect), and with that I create a basic drop shadow for example (using QGraphicsDropShadowEffect), but I could not find one for creating a basic glow around the whole widget?
So, my question is, is there a ready made effect for glow, or is it possible to "integrate" QML to my application afterwards, doing the necessary definitions there and continue generating the application UI without QML/Qt Quick?
Also, I know you can sub class QGraphicsEffect to create your own effect, if someone has a good article/example of this, I would gladly read it, if it comes to that :)
-
wrote on 29 Jul 2014, 11:31 last edited by
Well, usefull post. Just discorvered the QWidget::setGraphicsEffect. I will check the documentation.
At first view, there is no glow effect already made. But i think that you can make it by using the base class or you may try QGraphicsColorizeEffect or ShadowEffect. Never tried nothing of this.The documentation has so exemples of the parametrization that u can make on the effects.
Sorry i can't help more.
-
A glow is basically the same effect as a shadow. It's just a question of setting right params.
An example:
@
auto effect = new QGraphicsDropShadowEffect();
effect->setOffset(.0);
effect->setBlurRadius(20.0);
effect->setColor(Qt::red);
ui->pushButton->setGraphicsEffect(effect);
@
!http://i296.photobucket.com/albums/mm188/crossblades666/glow.jpg(glow)! -
wrote on 29 Jul 2014, 16:58 last edited by
[quote author="Chris Kawa" date="1406646609"]A glow is basically the same effect as a shadow. It's just a question of setting right params.
An example:
@
auto effect = new QGraphicsDropShadowEffect();
effect->setOffset(.0);
effect->setBlurRadius(20.0);
effect->setColor(Qt::red);
ui->pushButton->setGraphicsEffect(effect);
@
!http://i296.photobucket.com/albums/mm188/crossblades666/glow.jpg(glow)![/quote]Thank you very much! This is exactly what was needed, I though about playing with the offset -setting, but didn't.. Thank you for the answer!
1/4