[LyX/master] Fix compilation warning with Qt 5

Scott Kostyshak <[email protected]> Tue, 30 Jun 2026 22:22:08 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit cabb768cdd817b1b84942680f70a6330def7bb71
Author: Scott Kostyshak <[email protected]>
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);
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs