Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Windows: Retrieve correct QWindow size with QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling)
Forum Updated to NodeBB v4.3 + New Features

Windows: Retrieve correct QWindow size with QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling)

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 264 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.
  • MegamouseM Offline
    MegamouseM Offline
    Megamouse
    wrote on last edited by
    #1

    Hi,

    when using QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling) the QWindow size can't be retrieved properly,
    leading to occasional 1pixel offsets to GetClientRect on windows.

    The issue here is that size() obviously can give an odd number, but the devicePixelRatio is 2.0 for example.
    This leads to an even number after multiplying them.

    But GetClientRect can be odd. Therefore we have to use and ifdef for windows and use the GetClientRect to achieve better results.

    I'd love to see a way to get the same numbers from something like QWindow::size() or QWindow::scaledSize()

    Best Regards,
    Megamouse

    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