[vlc-devel] [PATCH] qt: info_panels: replace deprecated QString::sprintf
Alexandre Janniaux
ajanni at videolabs.io
Sun Jan 19 16:39:05 CET 2020
QString::sprintf is deprecated in Qt 5.14, so use QString::setNum
instead. As we always use the same precision, width and format, enforce
it in the macro itself too.
---
modules/gui/qt/dialogs/mediainfo/info_panels.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt/dialogs/mediainfo/info_panels.cpp b/modules/gui/qt/dialogs/mediainfo/info_panels.cpp
index f5250362dd..662c8dd45d 100644
--- a/modules/gui/qt/dialogs/mediainfo/info_panels.cpp
+++ b/modules/gui/qt/dialogs/mediainfo/info_panels.cpp
@@ -642,13 +642,13 @@ void InputStatsPanel::update( const input_stats_t& stats )
#define UPDATE_INT( widget, calc... ) \
{ widget->setText( 1, QString::number( (qulonglong)calc ) ); }
-#define UPDATE_FLOAT( widget, format, calc... ) \
- { QString str; widget->setText( 1 , str.sprintf( format, ## calc ) ); }
+#define UPDATE_FLOAT( widget, calc ) \
+ widget->setText( 1 , QString().setNum(calc, 'f', 0).leftJustified(6) )
UPDATE_INT( read_media_stat, (stats.i_read_bytes / 1024 ) );
- UPDATE_FLOAT( input_bitrate_stat, "%6.0f", (float)(stats.f_input_bitrate * 8000 ));
+ UPDATE_FLOAT( input_bitrate_stat, (float)(stats.f_input_bitrate * 8000 ));
UPDATE_INT( demuxed_stat, (stats.i_demux_read_bytes / 1024 ) );
- UPDATE_FLOAT( stream_bitrate_stat, "%6.0f", (float)(stats.f_demux_bitrate * 8000 ));
+ UPDATE_FLOAT( stream_bitrate_stat, (float)(stats.f_demux_bitrate * 8000 ));
UPDATE_INT( corrupted_stat, stats.i_demux_corrupted );
UPDATE_INT( discontinuity_stat, stats.i_demux_discontinuity );
--
2.25.0
More information about the vlc-devel
mailing list