Skip to content
Permalink
Browse files

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

  • Loading branch information
nirvn committed Jan 4, 2019
1 parent 5a67fb2 commit e823ab2fa1f5d0b23cdaa90580217ffab0118096
Showing with 17 additions and 0 deletions.
  1. +17 −0 src/core/qgsapplication.cpp
@@ -759,6 +759,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 e823ab2

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