DolphinQt: Use QFontMetrics::boundingRect instead of QFontMetrics::width

See https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/
This commit is contained in:
JosJuice
2020-06-08 12:19:10 +02:00
parent d89162c8ad
commit 87330ae524
5 changed files with 5 additions and 29 deletions

View File

@ -1,20 +0,0 @@
// Copyright 2020 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <utility>
#include <QFontMetrics>
// This exists purely to get rid of deprecation warnings while still supporting older Qt versions
template <typename... Args>
int FontMetricsWidth(const QFontMetrics& fm, Args&&... args)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
return fm.horizontalAdvance(std::forward<Args>(args)...);
#else
return fm.width(std::forward<Args>(args)...);
#endif
}