knarfS/smuview

error: 'int QFontMetrics::width(const QString&, int) const’ is deprecated

avalitan opened this issue · 1 comments

I'm getting this error when I try to build this!

[  1%] Building CXX object CMakeFiles/smuview.dir/src/ui/widgets/lcddisplay.cpp.o
./smuview/src/ui/widgets/lcddisplay.cpp: In member function ‘virtual void sv::ui::widgets::LcdDisplay::update_unit_widget_dimensions()’:
./smuview/src/ui/widgets/lcddisplay.cpp:139:46: error: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Werror=deprecated-declarations]
  139 |  unit_label_->setFixedWidth(metrics.width(str));
      |                                              ^
In file included from /usr/include/qt/QtWidgets/qwidget.h:50,
                 from /usr/include/qt/QtWidgets/qframe.h:44,
                 from /usr/include/qt/QtWidgets/qlcdnumber.h:44,
                 from /usr/include/qt/QtWidgets/QLCDNumber:1,
                 from ./smuview/src/ui/widgets/lcddisplay.cpp:22:
/usr/include/qt/QtGui/qfontmetrics.h:108:9: note: declared here
  108 |     int width(const QString &, int len = -1) const;
      |         ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/smuview.dir/build.make:1366: CMakeFiles/smuview.dir/src/ui/widgets/lcddisplay.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/smuview.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Qt version is: 5.13.0

Fixed in commit 5c80dc1