Skip to content
Permalink
Browse files

[themes] Apply OS-specific UI scale factor to em values

  • Loading branch information
nirvn committed Jan 2, 2019
1 parent 883ae1a commit ac6e6740647c5d035dd424066dacec50fca74f83
Showing with 17 additions and 0 deletions.
  1. +17 −0 src/core/qgsapplication.cpp
@@ -763,6 +763,23 @@ void QgsApplication::setUITheme( const QString &themeName )
}
file.close();

if ( Qgis::UI_SCALE_FACTOR != 1.0 )
{
// apply OS-specific UI scale factor to stylesheet's em values
int index = 0;
QRegularExpression regex( QStringLiteral( "(?<=[\\s:])([0-9\\.]+)(?=em)" ) );
QRegularExpressionMatch match = regex.match( styledata, index );
while ( match.hasMatch() )
{
index = match.capturedStart();
styledata.remove( index, match.captured( 0 ).length() );
QString number = QString::number( match.captured( 0 ).toDouble() * Qgis::UI_SCALE_FACTOR );
styledata.insert( index, number );
index += number.length();
match = regex.match( styledata, index );
}
}

qApp->setStyleSheet( styledata );

QFile palettefile( path + "/palette.txt" );

0 comments on commit ac6e674

Please sign in to comment.
You can’t perform that action at this time.