Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's painter.setViewport exactly do?

I know how painter.setWindow works. for example, if I maximize the widget larger, whatever I drew in that widget gets larger also in the same ratio.

but I can't understand what painter.setViewport exactly do. Can anyone explain to me how it works and give me an example?

like image 975
Tito Tito Avatar asked Feb 01 '26 21:02

Tito Tito


1 Answers

As the documentation writes, it is the device coordinate system, and not the logical. They are not necessarily equal to each other even though the default is the same.

This functionality mostly presents because of the API compatibility. That was necessary at the Qt 3 days before the real transformation feature support.

You can do everything with translate and scale what you can also do with viewports. It is just personal preference, albeit the former is more inline with the Vector API in Qt.

like image 200
lpapp Avatar answered Feb 04 '26 14:02

lpapp