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
Forum Updated to NodeBB v4.3 + New Features

Screen aspect ratio and QWebView

Scheduled Pinned Locked Moved Solved Qt WebKit
qwebviewaspect ratiodpiscaledimensions
3 Posts 2 Posters 2.2k Views 1 Watching
  • 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.
  • aragatsA Offline
    aragatsA Offline
    aragats
    wrote on 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 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

      aragatsA 1 Reply Last reply
      2
      • K Konstantin Tokarev

        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

        aragatsA Offline
        aragatsA Offline
        aragats
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

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