File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -759,6 +759,23 @@ void QgsApplication::setUITheme( const QString &themeName )
759
759
}
760
760
file.close ();
761
761
762
+ if ( Qgis::UI_SCALE_FACTOR != 1.0 )
763
+ {
764
+ // apply OS-specific UI scale factor to stylesheet's em values
765
+ int index = 0 ;
766
+ QRegularExpression regex ( QStringLiteral ( " (?<=[\\ s:])([0-9\\ .]+)(?=em)" ) );
767
+ QRegularExpressionMatch match = regex.match ( styledata, index );
768
+ while ( match.hasMatch () )
769
+ {
770
+ index = match.capturedStart ();
771
+ styledata.remove ( index , match.captured ( 0 ).length () );
772
+ QString number = QString::number ( match.captured ( 0 ).toDouble () * Qgis::UI_SCALE_FACTOR );
773
+ styledata.insert ( index , number );
774
+ index += number.length ();
775
+ match = regex.match ( styledata, index );
776
+ }
777
+ }
778
+
762
779
qApp->setStyleSheet ( styledata );
763
780
764
781
QFile palettefile ( path + " /palette.txt" );
You can’t perform that action at this time.
0 commit comments