mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
fix: use GUIUtil::TextWidth() instead deprecated width()
It fixes this warning: ``` qt/trafficgraphwidget.cpp:177:42: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] 177 | const int nWidthBytes = fmInOut.width("1000 GB") + 2 * nPadding; ```
This commit is contained in:
parent
66432fd04e
commit
f2e8431f4a
@ -1305,7 +1305,7 @@ bool loadFonts()
|
||||
auto supportedWeights = [](FontFamily family) -> std::vector<QFont::Weight> {
|
||||
auto getTestWidth = [&](QFont::Weight weight) -> int {
|
||||
QFont font = getFont(family, weight, false, defaultFontSize);
|
||||
return QFontMetrics(font).width("Check the width of this text to see if the weight change has an impact!");
|
||||
return TextWidth(QFontMetrics(font), ("Check the width of this text to see if the weight change has an impact!"));
|
||||
};
|
||||
std::vector<QFont::Weight> vecWeights{QFont::Thin, QFont::ExtraLight, QFont::Light,
|
||||
QFont::Normal, QFont::Medium, QFont::DemiBold,
|
||||
|
@ -173,8 +173,8 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
|
||||
QFontMetrics fmTotal(fontTotal);
|
||||
QFontMetrics fmInOut(fontInOut);
|
||||
const int nSizeMark = fmInOut.height() + 2 * nPadding;
|
||||
const int nWidthText = fmInOut.width(strReceived) + 2 * nPadding;
|
||||
const int nWidthBytes = fmInOut.width("1000 GB") + 2 * nPadding;
|
||||
const int nWidthText = GUIUtil::TextWidth(fmInOut, strReceived) + 2 * nPadding;
|
||||
const int nWidthBytes = GUIUtil::TextWidth(fmInOut, "1000 GB") + 2 * nPadding;
|
||||
const int nHeightTotals = fmTotal.height() + 2 * nPadding;
|
||||
const int nHeightInOut = fmInOut.height() + 2 * nPadding;
|
||||
const int nWidthStats = nSizeMark + nWidthText + nWidthBytes + 2 * nPadding;
|
||||
|
Loading…
Reference in New Issue
Block a user