开发者

QCheckBox Indicator, SVG Image

开发者 https://www.devze.com 2023-04-09 19:21 出处:网络
Is it possible to prevent a QCheckBox indicator within a QGraphicsView from becoming pixelated when scaling t开发者_如何学Gohe graphics view?

Is it possible to prevent a QCheckBox indicator within a QGraphicsView from becoming pixelated when scaling t开发者_如何学Gohe graphics view?

I have tried using a SVG image by setting the CheckBox's style sheet but that hasn't resolved the issue.


I'm assuming you're using a QGraphicsWidget. I believe the problem you are having is that Qt asks the widget to paint itself, and then scales whatever it painted - so I don't think that you're going to be able to use a QCheckBox and get the clean scaling that you're looking for.

There are a couple of options I can think of:

  • Subclass QGraphicsSvgItem - This would give you the ability to use your SVG image, but you would have to essentially re-implement all of the QCheckBox functionality yourself in your new subclass.

  • Subclass QGraphicsItem and create your own QGraphicsView-capable checkbox from scratch. This would give you the ability to paint your checkbox however you'd like using the paint() function, but once again you'd still have to re-implement the QCheckBox functionality.

0

精彩评论

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