title: Changing Qt Scale Factor
body: <p>I'd like to change my Qt app's scale based on the resolution of my devices screen. I'm trying to determine the resolution of the device and set     </p>
  
  <pre><code>QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
  QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); // HiDPI pixmaps
  qputenv("QT_SCALE_FACTOR", scaleAsQByteArray);
  </code></pre>
  
  <p>before my QApplication is initialized, scaleAsQByteArray to 1 if it's around the size where my app looks decent, and > 1 depending on the difference between my intended resolution and the large display resolution of the current device. </p>
  
  <p>This doesn't seem to be possible, at least from what I understand, as you need an initialized QApplication to get screen information, but I also can't use qputenv after that happens.</p>
  
  <p>Does anyone have a solution for how I could go about setting the scale factor of a QApplication based on screen resolution? Or to simplify things, how to get the height and width of the device monitor before I initialize the QApplication window.</p>
  
  <p>I was thinking about using a Scale {} in qml: hiding the main Window and showing the scaled version instead, though this might have some performance drawbacks, but that's basically what I'm trying to do.</p>