Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #8816 from JosJuice/qfontmetrics-width
DolphinQt: Remove another usage of QFontMetrics::width
- Loading branch information
Showing
5 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // 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 | ||
| } |