mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
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:
@ -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
|
||||
}
|
Reference in New Issue
Block a user