mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: replace IS_FP_SAME macro by inline function
No reason to keep this as a macro - a function is easier to read, type safe and easier to debug. Moreover, give it the more appropriate name "nearly_equal()". After all, it precisely does NOT check floating points for equality. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5db4a95a26
commit
61701509b0
9 changed files with 28 additions and 25 deletions
|
@ -96,7 +96,7 @@ void qPrefDisplay::disk_divelist_font(bool doSync)
|
|||
|
||||
void qPrefDisplay::set_font_size(double value)
|
||||
{
|
||||
if (!IS_FP_SAME(value, prefs.font_size)) {
|
||||
if (!nearly_equal(value, prefs.font_size)) {
|
||||
prefs.font_size = value;
|
||||
disk_font_size(true);
|
||||
|
||||
|
@ -121,7 +121,7 @@ void qPrefDisplay::disk_font_size(bool doSync)
|
|||
|
||||
void qPrefDisplay::set_mobile_scale(double value)
|
||||
{
|
||||
if (!IS_FP_SAME(value, prefs.mobile_scale)) {
|
||||
if (!nearly_equal(value, prefs.mobile_scale)) {
|
||||
prefs.mobile_scale = value;
|
||||
disk_mobile_scale(true);
|
||||
|
||||
|
@ -159,7 +159,7 @@ void qPrefDisplay::setCorrectFont()
|
|||
// get the font from the settings or our defaults
|
||||
// respect the system default font size if none is explicitly set
|
||||
QFont defaultFont = qPrefPrivate::propValue(keyFromGroupAndName(group, "divelist_font"), prefs.divelist_font).value<QFont>();
|
||||
if (IS_FP_SAME(system_divelist_default_font_size, -1.0)) {
|
||||
if (nearly_equal(system_divelist_default_font_size, -1.0)) {
|
||||
prefs.font_size = qApp->font().pointSizeF();
|
||||
system_divelist_default_font_size = prefs.font_size; // this way we don't save it on exit
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue