Skip to content

Commit

Permalink
Hi-DPI Support - LTM Data Table
Browse files Browse the repository at this point in the history
.. font sizes ala changes prior for RideSummary
  • Loading branch information
liversedge committed Mar 14, 2017
1 parent 62ec397 commit af91076
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/Charts/LTMWindow.cpp
Expand Up @@ -34,6 +34,7 @@

#ifdef NOWEBKIT
#include <QWebEngineSettings>
#include <QDesktopWidget>
#endif

#include <QtGui>
Expand Down Expand Up @@ -142,7 +143,13 @@ LTMWindow::LTMWindow(Context *context) :
#ifdef NOWEBKIT
dataSummary = new QWebEngineView(this);
//XXXdataSummary->setEnabled(false); // stop grabbing focus
dataSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1);
if (dpiXFactor > 1) {
// 80 lines per page on hidpi screens (?)
int pixelsize = pixelSizeForFont(defaultFont, QApplication::desktop()->geometry().height()/80);
dataSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, pixelsize);
} else {
dataSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1);
}
dataSummary->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family());
#else
dataSummary = new QWebView(this);
Expand Down
5 changes: 2 additions & 3 deletions src/Charts/RideSummaryWindow.cpp
Expand Up @@ -168,9 +168,8 @@ RideSummaryWindow::configChanged(qint32)
// font size is in pixels, if not hidpi leave as before
if (dpiXFactor > 1) {

// 60 lines per page on hidpi screens (?)
QFont p;
int pixelsize = pixelSizeForFont(p, QApplication::desktop()->geometry().height()/80);
// 80 lines per page on hidpi screens (?)
QFont p; int pixelsize = pixelSizeForFont(p, QApplication::desktop()->geometry().height()/80);
rideSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, pixelsize);

} else {
Expand Down

0 comments on commit af91076

Please sign in to comment.