diff options
| author | Léo Lam <leo@leolam.fr> | 2020-05-03 15:33:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-03 15:33:58 +0200 |
| commit | 1b2692911971a70d237984a2397c83521b7946e0 (patch) | |
| tree | 93c4f03b6d87cf5cadd699c7e8f489b25ff80559 /Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp | |
| parent | 0ab9475f8eb70d1f378d76b6b4bd2445602d5084 (diff) | |
| parent | bf57abc0d5950fdb8d7c03d0b6c2c7eb1730b4ad (diff) | |
Merge pull request #8789 from JosJuice/windows-cmake-errors
Fix Windows CMake build errors
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp index d2cbbfb0d9..6f55cea96d 100644 --- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp @@ -194,11 +194,20 @@ void CodeViewWidget::FontBasedSizing() constexpr int extra_text_width = 8; const QFontMetrics fm(Settings::Instance().GetDebugFont()); + + const auto width = [&fm](QString text) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) + return fm.horizontalAdvance(text); +#else + return fm.width(text); +#endif + }; + const int rowh = fm.height() + 1; verticalHeader()->setMaximumSectionSize(rowh); horizontalHeader()->setMinimumSectionSize(rowh + 5); setColumnWidth(CODE_VIEW_COLUMN_BREAKPOINT, rowh + 5); - setColumnWidth(CODE_VIEW_COLUMN_ADDRESS, fm.width(QStringLiteral("80000000")) + extra_text_width); + setColumnWidth(CODE_VIEW_COLUMN_ADDRESS, width(QStringLiteral("80000000")) + extra_text_width); // The longest instruction is technically 'ps_merge00' (0x10000420u), but those instructions are // very rare and would needlessly increase the column size, so let's go with 'rlwinm.' instead. @@ -210,11 +219,10 @@ void CodeViewWidget::FontBasedSizing() const std::string ins = (split == std::string::npos ? disas : disas.substr(0, split)); const std::string param = (split == std::string::npos ? "" : disas.substr(split + 1)); setColumnWidth(CODE_VIEW_COLUMN_INSTRUCTION, - fm.width(QString::fromStdString(ins)) + extra_text_width); + width(QString::fromStdString(ins)) + extra_text_width); setColumnWidth(CODE_VIEW_COLUMN_PARAMETERS, - fm.width(QString::fromStdString(param)) + extra_text_width); - setColumnWidth(CODE_VIEW_COLUMN_DESCRIPTION, - fm.width(QStringLiteral("0")) * 25 + extra_text_width); + width(QString::fromStdString(param)) + extra_text_width); + setColumnWidth(CODE_VIEW_COLUMN_DESCRIPTION, width(QStringLiteral("0")) * 25 + extra_text_width); Update(); } |
