title: Get physical screen size in Qt
body: <p>I'km working in Qt, i need help to get the physical size of the screen (monitor), </p>
  
  <p>In Qt one can get a <code>QDesktopWidget</code> from <code>QApplication</code>, I mean:</p>
  
  <pre><code>QDesktopWidget *mydesk = QApplication::desktop();
  </code></pre>
  
  <p>The <code>QDesktopwidget</code> has some methods to get the resolution in pixels and some to get the the size in milimethers:</p>
  
  <pre><code>mydesk-&gt; widthMM(); mydesk-&gt;heightMM();
  </code></pre>
  
  <p>However, this does not correspond to the physical size, when I measure my screen with a ruler, there is a considerable difference.</p>
  
  <p>Also one can get the DPI measurement and calculate the size of the screen:</p>
  
  <pre><code>mydesk-&gt;physicalDpiX(); mydesk-&gt;physicalDpiY();
  
  double Winches = (double)mydesk.width() / (double)mydesk.physicalDpiX();
  double Hinches = (double)mydesk.Height() / (double)mydesk.physicalDpiY();
  </code></pre>
  
  <p>where <code>mydesk.width()</code>  and <code>mydesk.height()</code> give the size in pixels(resolution)</p>
  
  <p>However the measurement is also wrong and very close to <code>mydesk.widthMM()</code> and <code>mydesk.heightMM()</code></p>
  
  <p>Also I have triyed <code>mydesk.logicalDpiX()</code> and it has similar results.</p>