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. Is Qt DPI Aware?
Forum Updated to NodeBB v4.3 + New Features

Is Qt DPI Aware?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 5.1k 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.
  • O Offline
    O Offline
    OlafMeding
    wrote on last edited by
    #1

    Are Qt4 and Qt5 DPI aware (according to the link below)? And if so, is this turned on my default or do I have to explicitly turn this on?

    Writing DPI-Aware Desktop and Win32 Applications:
    http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx

    Thanks much for your help
    Olaf

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tomme
      wrote on last edited by
      #2

      Hi,

      "Read this":http://qt-project.org/doc/qt-4.8/scalability.html

      It worked for me.

      Bye

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        Better read the docs from Qt 5, there have been API changes in that area, and some new classes added. "Link":http://qt-project.org/doc/qt-5/scalability.html.

        (Z(:^

        1 Reply Last reply
        0
        • O Offline
          O Offline
          OlafMeding
          wrote on last edited by
          #4

          Let me ask again: Does Qt (not Qt Quick) support the DPI Aware mechanism as described in the MSDN link of my initial post?

          Your answers appear to apply to Qt Quick and QML. I have a large and existing Qt application, re-writing everything to use Qt Quick is not an option.

          Again, thanks for your replies.
          Olaf

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            See the "QScreen":http://qt-project.org/doc/qt-5/qscreen.html class, which actually described in the document I have linked before.

            (Z(:^

            1 Reply Last reply
            0
            • D Offline
              D Offline
              digorydoo
              wrote on last edited by
              #6

              Here's how I solved this problem in my Qt app: I created a C++ class called Dims, which holds CONSTANT properties for most dimension constants such as distances, widths, heights, etc. These constants are dynamically adapted to the size of the screen and the target platform in the constructor of Dims. Then I pass Dims to QML like this:

              @
              QQmlApplicationEngine engine;
              QQmlContext *r = engine.rootContext();
              Dims dims; // contains my dimension constants
              r->setContextProperty ("Dims", &dims);
              @

              Now I can simply use these dimensions in QML, e.g.:

              @
              width: (Dims.msgLineLRMargin + msgText.width + Dims.msgLineLRMargin);
              @

              I created another C++ class called Fonts that serves as an abstraction for font names and sizes on different platforms. With this technique, I can use the same QML files for most cases, with an exception only where a different layout is appropriate (e.g. grid versus column).

              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