diff --git a/src/platform/qt/CheatsView.cpp b/src/platform/qt/CheatsView.cpp index 5c5594067..d26e63bcd 100644 --- a/src/platform/qt/CheatsView.cpp +++ b/src/platform/qt/CheatsView.cpp @@ -149,7 +149,11 @@ void CheatsView::enterCheat() { index = m_model.index(m_model.rowCount() - 1, 0, QModelIndex()); m_ui.cheatList->selectionModel()->select(index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QStringList cheats = m_ui.codeEntry->toPlainText().split('\n', Qt::SkipEmptyParts); +#else QStringList cheats = m_ui.codeEntry->toPlainText().split('\n', QString::SkipEmptyParts); +#endif for (const QString& string : cheats) { m_model.beginAppendRow(index); mCheatAddLine(set, string.toUtf8().constData(), m_codeType); diff --git a/src/platform/qt/FrameView.h b/src/platform/qt/FrameView.h index 02844d7ed..5e32a3de6 100644 --- a/src/platform/qt/FrameView.h +++ b/src/platform/qt/FrameView.h @@ -97,7 +97,11 @@ private: int m_glowFrame; QTimer m_glowTimer; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QRecursiveMutex m_mutex; +#else QMutex m_mutex{QMutex::Recursive}; +#endif VFile* m_currentFrame = nullptr; VFile* m_nextFrame = nullptr; mCore* m_vl = nullptr; diff --git a/src/platform/qt/LogController.cpp b/src/platform/qt/LogController.cpp index 994f484f7..8b11e76e4 100644 --- a/src/platform/qt/LogController.cpp +++ b/src/platform/qt/LogController.cpp @@ -11,6 +11,12 @@ using namespace QGBA; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) +#define endl Qt::endl +#else +#define endl std::endl +#endif + LogController LogController::s_global(mLOG_ALL); int LogController::s_qtCat{-1}; diff --git a/src/platform/qt/MemoryModel.cpp b/src/platform/qt/MemoryModel.cpp index d0f3df1f6..4c991982d 100644 --- a/src/platform/qt/MemoryModel.cpp +++ b/src/platform/qt/MemoryModel.cpp @@ -80,7 +80,12 @@ MemoryModel::MemoryModel(QWidget* parent) setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - m_margins = QMargins(metrics.width("0FFFFFF0 ") + 3, m_cellHeight + 1, metrics.width(" AAAAAAAAAAAAAAAA") + 3, 0); + m_margins = QMargins(3, m_cellHeight + 1, 3, 0); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) + m_margins += QMargins(metrics.horizontalAdvance("0FFFFFF0 "), 0, metrics.horizontalAdvance(" AAAAAAAAAAAAAAAA"), 0); +#else + m_margins += QMargins(metrics.width("0FFFFFF0 "), 0, metrics.width(" AAAAAAAAAAAAAAAA"), 0); +#endif m_cellSize = QSizeF((viewport()->size().width() - (m_margins.left() + m_margins.right())) / 16.0, m_cellHeight); connect(verticalScrollBar(), &QSlider::sliderMoved, [this](int position) { diff --git a/src/platform/qt/MessagePainter.cpp b/src/platform/qt/MessagePainter.cpp index 401d7cf4b..d036b4ca7 100644 --- a/src/platform/qt/MessagePainter.cpp +++ b/src/platform/qt/MessagePainter.cpp @@ -84,7 +84,11 @@ void MessagePainter::paint(QPainter* painter) { painter->setRenderHint(QPainter::Antialiasing); painter->setFont(m_frameFont); painter->setPen(Qt::black); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) + painter->translate(-metrics.horizontalAdvance(frame), 0); +#else painter->translate(-metrics.width(frame), 0); +#endif const static int ITERATIONS = 11; for (int i = 0; i < ITERATIONS; ++i) { painter->save(); diff --git a/src/platform/qt/ShortcutView.cpp b/src/platform/qt/ShortcutView.cpp index badd7d5af..e82c2dd9b 100644 --- a/src/platform/qt/ShortcutView.cpp +++ b/src/platform/qt/ShortcutView.cpp @@ -137,7 +137,11 @@ void ShortcutView::closeEvent(QCloseEvent*) { void ShortcutView::showEvent(QShowEvent*) { QString longString("Ctrl+Alt+Shift+Tab"); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) + int width = QFontMetrics(QFont()).horizontalAdvance(longString); +#else int width = QFontMetrics(QFont()).width(longString); +#endif QHeaderView* header = m_ui.shortcutTable->header(); header->resizeSection(0, header->length() - width * 2); header->resizeSection(1, width);