mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-28 17:42:28 +08:00
frontend: Round all output theme values
This commit is contained in:
@@ -705,12 +705,6 @@ static QString PrepareQSS(const QHash<QString, OBSThemeVariable> &vars, const QS
|
||||
} else if (var.type == OBSThemeVariable::Size || var.type == OBSThemeVariable::Number) {
|
||||
double val = value.toDouble();
|
||||
|
||||
// Round any values with a px suffix. Qt does this anyway for some properties,
|
||||
// but then will flat out break with decimals for others.
|
||||
if (var.suffix == "px") {
|
||||
val = std::roundf(val);
|
||||
}
|
||||
|
||||
bool isInteger = ceill(val) == val;
|
||||
replace = QString::number(val, 'f', isInteger ? 0 : -1);
|
||||
|
||||
@@ -720,6 +714,15 @@ static QString PrepareQSS(const QHash<QString, OBSThemeVariable> &vars, const QS
|
||||
replace = value.toString();
|
||||
}
|
||||
|
||||
// Round any values with a px suffix. Qt does this anyway for some properties,
|
||||
// but then will flat out break with decimals for others.
|
||||
if (replace.right(2) == "px") {
|
||||
QString replaceValue = replace.sliced(0, replace.length() - 2);
|
||||
int val = (int)std::roundf(replaceValue.toDouble());
|
||||
|
||||
replace = QString::number(val) + "px";
|
||||
}
|
||||
|
||||
stylesheet = stylesheet.replace(needle, replace);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user