Navigation Menu

Skip to content

Commit

Permalink
[themes] Apply OS-specific UI scale factor to em values
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 2, 2019
1 parent 883ae1a commit ac6e674
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -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" );
Expand Down

0 comments on commit ac6e674

Please sign in to comment.