[LyX/master] Fix compilation warning with Qt 5
Scott Kostyshak
skostysh at lyx.org
Tue Jun 30 22:22:08 UTC 2026
commit cabb768cdd817b1b84942680f70a6330def7bb71
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Wed Jul 1 00:10:46 2026 +0200
Fix compilation warning with Qt 5
With Qt 5, a certain return is "qreal" (which is typically "double").
Qt 6 changed the return to "float".
Fixes the following warning:
src/frontends/qt/ColorCache.cpp:245:46: error: implicit conversion increases floating-point precision: 'float' to 'qreal' (aka 'double') [-Werror,-Wdouble-promotion]
245 | red = std::round((fg_weight*fg.redF() + bg_weight*bg.redF() ) * 255);
| ^~~~~~~~~~
---
src/frontends/qt/ColorCache.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index 785c4d5c64..5cd1207e48 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -239,8 +239,8 @@ const QColor qcolorOverlay(const QColor &fg, const QColor &bg)
{
int red, green, blue, alpha;
- float fg_weight = fg.alphaF();
- float bg_weight = 1 - fg.alphaF();
+ auto fg_weight = fg.alphaF();
+ auto bg_weight = 1 - fg.alphaF();
red = std::round((fg_weight*fg.redF() + bg_weight*bg.redF() ) * 255);
green = std::round((fg_weight*fg.greenF() + bg_weight*bg.greenF()) * 255);
More information about the lyx-cvs
mailing list