I am trying to create some kind of effect :hover for my QWidget with the following CSS:
QWidget.mis--MyButton { width: 300px; height: 300px; background: white; font-family: Calibri; border-radius: 10px; border: 2px solid rgb(218, 218, 218); padding: 1px; margin-top: 2px; } QWidget.mis--MyButton:hover { border: 2px solid #007FEB; }
However, there is a slight delay of 2-3 seconds from the moment you enter the mouse into the widget until the effect appears.
Here is a screencast of what happens:
https://youtu.be/aNfEKabut-A
For drawing, I use the following code:
void MyButton::paintEvent(QPaintEvent * event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); }
Even when I try to get rid of CSS, i.e. I donβt load CSS at all, and just try to get some effect and use the Qt style, for example, as follows:
style()->drawPrimitive(QStyle::PE_PanelButtonBevel, &opt, &p, this);
and just turn off CSS, I still get the same delay.
Here's a screencast of the same effect, with no CSS loaded and with the QStyle::PE_PanelButtonBevel parameter selected in paintEvent :
https://youtu.be/kT10zdepsGk
The computer is pretty strong, Ryzen 7 on Windows 10, and I'm using VC ++ 2017, so it should not be related to anything like that.
If you need more code, please let me know.
Thanks!