Scalable painting of a Qt application

后端 未结 2 1794
Happy的楠姐
Happy的楠姐 2021-01-20 22:07

I\'m writing a simulation of an embedded device\'s screen (which contains custom widgets on top of a main QWidget), and while the native size of the screen is 800x600, I wan

相关标签:
2条回答
  • 2021-01-20 23:00

    Bit of a guess here as I've not tried it... but you could try putting the top-level widget into a QGraphicsView then get the QGraphicsView to do the scaling. You could then enable OpenGL on the QGraphicsView and have it scaled in hardware so it's nice and fast.

    0 讨论(0)
  • 2021-01-20 23:03

    This is possible if you are using QGraphicsView as your main display widget. QGraphicsScene now supports widgets as content, so you can literally just scale them.

    I believe the alternative is to reimplement the paint() for each widget, and manually set the transform/scale before the painting of child widgets.

    0 讨论(0)
提交回复
热议问题