Qt scalable coloring application

I am writing a screen simulator of an embedded device (which contains custom widgets on top of the main QWidget), and although the native screen size is 800x600, I want to be able to scale it up and down by dragging the corner of the window. Without permission with grid layouts and stretchers (which will not scale fonts up / down), how can I do this kind of scaling? I think part of the solution could be to create a QTransform and somehow embed it in a QWidget for the whole application or its QPaintDevice or QPaintEngine. I would like to do this without putting QTransform in every custom widget, just the “main window” of QWidget.

+3
source share
2 answers

This is possible if you use QGraphicsView as the main widget. QGraphicsScene now supports widgets as content, so you can literally scale them.

I believe that an alternative is to re-implement paint () for each widget and manually set the transform / scale before drawing the child widgets.

+5
source

A little guess here, since I have not tried this ... but you could try placing a top-level widget in a QGraphicsView, and then get a QGraphicsView for scaling. You can then enable OpenGL in the QGraphicsView and scale it at the hardware level to make it nice and fast.

0

Source: https://habr.com/ru/post/1718916/


All Articles