mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix more deprecation warnings
This commit is contained in:
parent
cbe5c305b6
commit
aad85a7950
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue