title: Qt Quick Controls 2 Scaling
body: <p>I'm developing the application that should run on the mobile and desktop platforms. The problem that I found that sizes of controls is vary on different screens: in high density screens controls is too small and in low density screens is rather big.</p>
  
  <p>I can calculate the scale factor for each screen (i.e. use Android's Density-independent Pixels) and use it to define item sizes, margins, etc in <code>dp</code>:</p>
  
  <pre><code>ApplicationWindow {
      ...
      property real dp: Screen.pixelDensity * 10 * 2.54 / 160
      Item {
          width: 50*dp
          height: 50*dp
          ...
          Label {
              font.pixelSize: 16*dp
              ...
          }
      }
  }
  </code></pre>
  
  <p>It work well but it seems that sizes of standard controls in Qt Quick Controls 2 is defined in pixels, so they doesn't scale. The only way that I see is to redefine all controls in Qt Quick Controls 2 using <code>dp</code> instead of pixels.</p>
  
  <p>So I'm looking for method to scale standard controls without redefining them all.</p>
  
  <p><strong>UPD1.</strong>
  I've tried High-DPI Support, it makes situation better but still there is some issue.
  Here is some some parameters of primary screen (<a href="http://doc.qt.io/qt-5/qscreen.html" rel="nofollow noreferrer">see paramter description here</a>) from different devices before and after applying High-DPI Support:</p>
  
  <pre><code>// samsung tab t-280 without high dpi support
  devicePixelRatio 1
  geometry QRect(0,0 800x1280)
  logicalDotsPerInch 95.85
  physicalDotsPerInch 216.458
  physicalSize QSizeF(94, 150) (7')
  
  // samsung tab t-280 with high dpi support
  devicePixelRatio 1.33125
  geometry QRect(0,0 601x962)
  logicalDotsPerInch 72
  physicalDotsPerInch 162.648
  physicalSize QSizeF(94, 150) (7')
  
  
  // xiaomi redmi 2 without high dpi support
  devicePixelRatio 1
  geometry QRect(0,0 720x1280)
  logicalDotsPerInch 144
  physicalDotsPerInch 315.48
  physicalSize QSizeF(58, 103) (4.6')
  
  // xiaomi redmi 2 with high dpi support
  devicePixelRatio 2
  geometry QRect(0,0 360x640)
  logicalDotsPerInch 72
  physicalDotsPerInch 157.74
  physicalSize QSizeF(58, 103) (4.6')
  
  
  // macbook pro retina 13' without high dpi support
  devicePixelRatio 2
  geometry QRect(0,0 1280x800)
  logicalDotsPerInch 72
  physicalDotsPerInch 113.5
  physicalSize QSizeF(286.449, 179.031) (13')
  
  // macbook pro retina 13' with high dpi support
  devicePixelRatio 2
  geometry QRect(0,0 1280x800)
  logicalDotsPerInch 72
  physicalDotsPerInch 113.5
  physicalSize QSizeF(286.449, 179.031) (13')
  
  
  // generic 20' display without high dpi support
  devicePixelRatio 1
  geometry QRect(0,0 1280x1024)
  logicalDotsPerInch 72
  physicalDotsPerInch 72
  physicalSize QSizeF(451.556, 361.244) (22.6')
  
  // generic 20' display with high dpi support
  devicePixelRatio 1
  geometry QRect(0,0 1280x1024)
  logicalDotsPerInch 72
  physicalDotsPerInch 72
  physicalSize QSizeF(451.556, 361.244) (22.6')
  
  
  // asus zenbook 13' without high dpi support
  devicePixelRatio 1
  geometry QRect(0,0 1366x768)
  logicalDotsPerInch 96
  physicalDotsPerInch 71.9833
  physicalSize QSizeF(482, 271) (21.6'!)
  
  // asus zenbook 13' with high dpi support
  devicePixelRatio 1
  geometry QRect(0,0 1366x768)
  logicalDotsPerInch 96
  physicalDotsPerInch 71.9833
  physicalSize QSizeF(482, 271) (21.6'!)
  </code></pre>
  
  <p>It seems that situation becomes better for some Hight-DPI displays (Samsung tablet and Xiaomi Phone). DPI of both devices become near 160 after High-DPI support applying.</p>
  
  <p>But DPI of Retina display and low-density displays doesn't change and items on the screen looks bigger than it should be. So it solves only half of original problem. Maybe somebody knows how to manually set scale factor for all Qt application at runtime?</p>