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. DPI and widthMM() heightMM() on windows
Forum Updated to NodeBB v4.3 + New Features

DPI and widthMM() heightMM() on windows

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.3k 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.
  • Z Offline
    Z Offline
    Zingam
    wrote on last edited by
    #1

    Does anybody has an idea what are these functions for?
    In reality they return invalid data on Windows, so they appear to be useless?

    Is it impossible to get the DPI of the screen (and even the diagonal size) in Qt?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      [quote author="Zingam" date="1357432180"]Does anybody has an idea what are these functions for?[/quote]

      According to the docs:

      int QPaintDevice::widthMM() const
      Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

      [quote author="Zingam" date="1357432180"]In reality they return invalid data on Windows, so they appear to be useless?

      Is it impossible to get the DPI of the screen (and even the diagonal size) in Qt?[/quote]

      What exactly do you expect?

      Even with the same "DPI" setting it is impossible to know what the "physical" size of a widget will be on a specific screen. Even if we know how "logical" pixels are mapped to "physical" (device) pixels, based on the DPI setting, we don't know the real size of a "physical" pixel - unless you know exactly what display model the user is using. For example: There are many displays with a "physical" pixel resolution of 1920x1080 on the market. Still the diagonal size, in inches, of these screens may vary greatly! Consequently a widget that is drawn with a certain number of (physical) pixels may appear larger or smaller, depending on the display hardware being used...

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      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