开发者

[Qt]paintEvent not getting called in custom button derived from QAbstractButton

开发者 https://www.devze.com 2023-01-07 16:44 出处:网络
I\'m trying to create a custom button, derived from \"QAbstractbutton\". I have overridden the paintEvent. However, my button is not visible i开发者_开发百科n my widget. What I see is that the paintEv

I'm trying to create a custom button, derived from "QAbstractbutton". I have overridden the paintEvent. However, my button is not visible i开发者_开发百科n my widget. What I see is that the paintEvent is not getting called even after calling update/repaint/show on my button. What could be the missing link here?

Thanks!


paintEvent on an object won't be called unless the object has a non-zero width and height. My guess (and absent any example code, it is a pure guess) is that you've just created one with a 0 width or height, and are expecting it to draw.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号