From d740a60abcdeefeb04eaabf0a8b0adc7b257ea10 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Tue, 16 Oct 2012 09:55:43 +0200 Subject: [PATCH] Reworking the squares size --- src/board/UBBoardController.cpp | 5 ++++- src/frameworks/UBGeometryUtils.cpp | 1 + src/frameworks/UBGeometryUtils.h | 1 + src/tools/UBAbstractDrawRuler.cpp | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 180fc61b..d7c300bf 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -109,7 +109,10 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow) mMarkerColorOnDarkBackground = UBSettings::settings()->markerColors(true).at(markerColorIndex); mMarkerColorOnLightBackground = UBSettings::settings()->markerColors(false).at(markerColorIndex); - UBSettings::settings()->crossSize = UBGeometryUtils::millimetersPerCentimeter * 4; + QDesktopWidget* desktop = UBApplication::desktop(); + int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + int sPixelsPerMillimeter = qRound(dpiCommon / UBGeometryUtils::inchSize); + UBSettings::settings()->crossSize = 10*sPixelsPerMillimeter; } diff --git a/src/frameworks/UBGeometryUtils.cpp b/src/frameworks/UBGeometryUtils.cpp index cc891b85..f8e681c7 100644 --- a/src/frameworks/UBGeometryUtils.cpp +++ b/src/frameworks/UBGeometryUtils.cpp @@ -23,6 +23,7 @@ const int UBGeometryUtils::halfCentimeterGraduationHeight = 10; const int UBGeometryUtils::millimeterGraduationHeight = 5; const int UBGeometryUtils::millimetersPerCentimeter = 10; const int UBGeometryUtils::millimetersPerHalfCentimeter = 5; +const float UBGeometryUtils::inchSize = 25.4f; UBGeometryUtils::UBGeometryUtils() { diff --git a/src/frameworks/UBGeometryUtils.h b/src/frameworks/UBGeometryUtils.h index c5ac5e8e..c9b1aeb5 100644 --- a/src/frameworks/UBGeometryUtils.h +++ b/src/frameworks/UBGeometryUtils.h @@ -43,6 +43,7 @@ class UBGeometryUtils const static int millimeterGraduationHeight; const static int millimetersPerCentimeter; const static int millimetersPerHalfCentimeter; + const static float inchSize; }; #endif /* UBGEOMETRYUTILS_H_ */ diff --git a/src/tools/UBAbstractDrawRuler.cpp b/src/tools/UBAbstractDrawRuler.cpp index b2658ee2..14393e0a 100644 --- a/src/tools/UBAbstractDrawRuler.cpp +++ b/src/tools/UBAbstractDrawRuler.cpp @@ -47,7 +47,7 @@ UBAbstractDrawRuler::UBAbstractDrawRuler() //we actually need to evaluate pixels per millimeter QDesktopWidget* desktop = UBApplication::desktop(); int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; - sPixelsPerMillimeter = qRound(dpiCommon / 25.4f);//because 1inch = 25.4 mm + sPixelsPerMillimeter = qRound(dpiCommon / UBGeometryUtils::inchSize); }