Gui: HiDPI fixes for Sketcher (#21098)
* Gui: HiDPI fixes for Sketcher (cherry picked from commit f043fd7c5c8a6ea003811453165eee7d643f3779) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci (cherry picked from commit 42567ca9fcf2d6bab612715391a7b1911367f75d) * Apply suggestions from code review Co-authored-by: Kacper Donat <kadet1090@gmail.com> (cherry picked from commit 28b52086e9cceae0e095421985479c546df49e44) * qreal to double (cherry picked from commit 4434ef18affa082a88390c1e68274de42f7c181e) * more qreal to double (cherry picked from commit df15eb6200d4ceab730ca8cf25ab0a90efe1cf41) * Restore previous code which converted label size to points. View scaling would result in text that is too big. * Ensure scaled marker size is one of the supported sizes for CIRCLE_LINE otherwise it would default to 7 (or what was set to "MarkerSize" in hGrp) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Tim Ringenbach <tim.ringenbach@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Kacper Donat <kadet1090@gmail.com>
This commit is contained in:
@@ -3969,6 +3969,16 @@ int ViewProviderSketch::defaultFontSizePixels() const
|
||||
return static_cast<int>(metrics.height());
|
||||
}
|
||||
|
||||
qreal ViewProviderSketch::getDevicePixelRatio() const
|
||||
{
|
||||
if (auto activeView = qobject_cast<Gui::View3DInventor*>(this->getActiveView())) {
|
||||
auto glWidget = activeView->getViewer()->getGLWidget();
|
||||
return glWidget->devicePixelRatio();
|
||||
}
|
||||
|
||||
return QApplication::primaryScreen()->devicePixelRatio();
|
||||
}
|
||||
|
||||
int ViewProviderSketch::getApplicationLogicalDPIX() const
|
||||
{
|
||||
return int(QApplication::primaryScreen()->logicalDotsPerInchX());
|
||||
|
||||
Reference in New Issue
Block a user