diff include/gui/widgets/graph.h @ 273:f31305b9f60a

*: various code safety changes this also makes the code build on Qt 5.7. I can't test it though because I don't have it working... FAIL!
author Paper <paper@paper.us.eu.org>
date Thu, 18 Apr 2024 16:53:17 -0400
parents 3ec7804abf17
children f81bed4e04ac
line wrap: on
line diff
--- a/include/gui/widgets/graph.h	Thu Apr 18 16:51:35 2024 -0400
+++ b/include/gui/widgets/graph.h	Thu Apr 18 16:53:17 2024 -0400
@@ -56,7 +56,7 @@
 		QFontMetrics metric(font());
 
 		for (const auto& item : map) {
-			unsigned long width = metric.horizontalAdvance(QString::number(item.first), -1);
+			unsigned long width = metric.boundingRect(QString::number(item.first)).width();
 			if (width > ret)
 				ret = width;
 		}
@@ -69,7 +69,7 @@
 		QFontMetrics metric(font());
 
 		for (const auto& item : map) {
-			unsigned long width = metric.horizontalAdvance(QString::number(item.second), -1);
+			unsigned long width = metric.boundingRect(QString::number(item.second)).width();
 			if (width > ret)
 				ret = width;
 		}