Commit 514a4d95 authored by Don Gagne's avatar Don Gagne

Adjust point sizes in styles

parent 9ed04b1d
...@@ -566,9 +566,33 @@ void QGCApplication::_loadCurrentStyle(void) ...@@ -566,9 +566,33 @@ void QGCApplication::_loadCurrentStyle(void)
success = false; success = false;
} }
} }
// Now that we have the styles loaded we need to dpi adjust the font point sizes
QString dpiAdjustedStyles;
if (success) {
QTextStream styleStream(&styles, QIODevice::ReadOnly);
QRegularExpression regex("font-size:.+(\\d\\d)pt;");
while (!styleStream.atEnd()) {
QString adjustedLine;
QString line = styleStream.readLine();
QRegularExpressionMatch match = regex.match(line);
if (match.hasMatch()) {
//qDebug() << "found:" << line << match.captured(1);
adjustedLine = QString("font-size: %1pt;").arg(ScreenTools::dpiAdjustedPointSize_s(match.captured(1).toDouble()));
//qDebug() << "adjusted:" << adjustedLine;
} else {
adjustedLine = line;
}
dpiAdjustedStyles += adjustedLine;
}
}
if (!styles.isEmpty()) { if (!dpiAdjustedStyles.isEmpty()) {
setStyleSheet(styles); setStyleSheet(dpiAdjustedStyles);
} }
if (!success) { if (!success) {
...@@ -603,4 +627,4 @@ void QGCApplication::_reconnect(void) ...@@ -603,4 +627,4 @@ void QGCApplication::_reconnect(void)
{ {
qgcApp()->restoreOverrideCursor(); qgcApp()->restoreOverrideCursor();
LinkManager::instance()->createConnectedLink(_reconnectLinkConfig); LinkManager::instance()->createConnectedLink(_reconnectLinkConfig);
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment