Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[themes] Apply OS-specific UI scale factor to em values
- Loading branch information
Showing
with
17 additions
and
0 deletions.
-
+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" ); |
|
|