comparison view/ViewManager.cpp @ 894:d4446f267e12 alignment_view

Scale drag thresholds according to actual display resolution
author Chris Cannam
date Thu, 15 Jan 2015 10:42:00 +0000
parents 8bb9320f78a4
children a1226b3b7925
comparison
equal deleted inserted replaced
882:c0549bf12973 894:d4446f267e12
718 dark = true; 718 dark = true;
719 } 719 }
720 return dark; 720 return dark;
721 } 721 }
722 722
723 int
724 ViewManager::scalePixelSize(int pixels)
725 {
726 static float ratio = 0.f;
727 if (ratio == 0.f) {
728 float baseEm;
729 #ifdef Q_OS_MAC
730 baseEm = 17.f;
731 #else
732 baseEm = 15.f;
733 #endif
734 float em = QFontMetrics(QFont()).height();
735 ratio = em / baseEm;
736 }
737
738 int scaled = int(pixels * ratio + 0.5);
739 cerr << "scaledSize: " << pixels << " -> " << scaled << " at ratio " << ratio << endl;
740 if (pixels != 0 && scaled == 0) scaled = 1;
741 return scaled;
742 }