Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Screen aspect ratio and QWebView
QtWS25 Last Chance

Screen aspect ratio and QWebView

Scheduled Pinned Locked Moved Solved Qt WebKit
qwebviewaspect ratiodpiscaledimensions
3 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aragats
    wrote on 20 Nov 2017, 20:32 last edited by
    #1

    Is there any way to change the aspect ratio in 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. In other words, the screen DPI is different for X and Y. Basically I need to scale/zoom only one dimension.

    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.

    Currently I'm using Qt 5.7.1.
    Thanks for ideas!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Konstantin Tokarev
      wrote on 20 Nov 2017, 21:47 last edited by
      #2

      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

      A 1 Reply Last reply 21 Nov 2017, 19:05
      2
      • K Konstantin Tokarev
        20 Nov 2017, 21:47

        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

        A Offline
        A Offline
        aragats
        wrote on 21 Nov 2017, 19:05 last edited by
        #3

        @Konstantin-Tokarev , thanks!
        QGraphicsView::scale() works great.

        1 Reply Last reply
        0

        2/3

        20 Nov 2017, 21:47

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved