DPI and widthMM() heightMM() on windows



  • 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?



  • [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...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.