Screen aspect ratio and QGraphicsWebView or QWebView

165 views Asked by At

Is there any way to change the aspect ratio with QGraphicsWebView or QWebView? The problem is that the LCD screen (800x480) has non-square pixels, thus the web pages are displayed incorrectly, e.g. circles become ovals. The software is used in Linux with Xorg, however, the graphics driver doesn't have an option to set the aspect ratio, it's a very simple framebuffer.

Thanks for ideas!

1

There are 1 answers

0
SergeyM On BEST ANSWER

I'm copying the answer provided by Konstantin Tokarev at forum.qt.io:

There are at least two ways to do this:
In user style sheet set transform: scaleX(...) (or scaleY) for html element. Use prefixed version -webkit-tranform if you don't use QtWebKit 5.212
Use QGraphicsView::scale with different values for x and y (if using QGraphicsWebView)

Note that performance may decrease because of scaling

The original: https://forum.qt.io/topic/85209/screen-aspect-ratio-and-qwebview