mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
* Try to always rely on DPI settings.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "DpiScaler.h"
|
#include "DpiScaler.h"
|
||||||
#include "TomahawkUtilsGui.h"
|
#include "TomahawkUtilsGui.h"
|
||||||
|
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
namespace TomahawkUtils
|
namespace TomahawkUtils
|
||||||
{
|
{
|
||||||
@@ -140,6 +141,9 @@ DpiScaler::ratioX( const QPaintDevice* pd )
|
|||||||
qreal ratioFromFH = ratioFromFontHeight();
|
qreal ratioFromFH = ratioFromFontHeight();
|
||||||
qreal ratioYFromDpi = pd->logicalDpiY() / s_baseDpi; //using Y because we compare with height
|
qreal ratioYFromDpi = pd->logicalDpiY() / s_baseDpi; //using Y because we compare with height
|
||||||
|
|
||||||
|
//HACK: don't trust font settings
|
||||||
|
return ratioYFromDpi;
|
||||||
|
|
||||||
//if the error is less than 1%, we trust that the logical DPI setting has the best value
|
//if the error is less than 1%, we trust that the logical DPI setting has the best value
|
||||||
if ( qAbs( ratioFromFH / ratioYFromDpi - 1 ) < 0.01 )
|
if ( qAbs( ratioFromFH / ratioYFromDpi - 1 ) < 0.01 )
|
||||||
return pd->logicalDpiX() / s_baseDpi;
|
return pd->logicalDpiX() / s_baseDpi;
|
||||||
@@ -154,6 +158,9 @@ DpiScaler::ratioY( const QPaintDevice* pd )
|
|||||||
qreal ratioFromFH = ratioFromFontHeight();
|
qreal ratioFromFH = ratioFromFontHeight();
|
||||||
qreal ratioYFromDpi = pd->logicalDpiY() / s_baseDpi; //using Y because we compare with height
|
qreal ratioYFromDpi = pd->logicalDpiY() / s_baseDpi; //using Y because we compare with height
|
||||||
|
|
||||||
|
//HACK: don't trust font settings
|
||||||
|
return ratioYFromDpi;
|
||||||
|
|
||||||
//if the error is less than 1%, we trust that the logical DPI setting has the best value
|
//if the error is less than 1%, we trust that the logical DPI setting has the best value
|
||||||
if ( qAbs( ratioFromFH / ratioYFromDpi - 1 ) < 0.01 )
|
if ( qAbs( ratioFromFH / ratioYFromDpi - 1 ) < 0.01 )
|
||||||
return ratioYFromDpi;
|
return ratioYFromDpi;
|
||||||
|
Reference in New Issue
Block a user