mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 09:23:52 +00:00
Merge pull request #2612 from akortunov/warnfix2
Fix most of deprecated API usage
This commit is contained in:
commit
545922f613
8 changed files with 77 additions and 2 deletions
|
@ -5,6 +5,10 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
// We need to do this because of Qt: https://bugreports.qt-project.org/browse/QTBUG-22154
|
// We need to do this because of Qt: https://bugreports.qt-project.org/browse/QTBUG-22154
|
||||||
|
@ -311,6 +315,17 @@ QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
||||||
QRect Launcher::GraphicsPage::getMaximumResolution()
|
QRect Launcher::GraphicsPage::getMaximumResolution()
|
||||||
{
|
{
|
||||||
QRect max;
|
QRect max;
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
for (QScreen* screen : QGuiApplication::screens())
|
||||||
|
{
|
||||||
|
QRect res = screen->geometry();
|
||||||
|
if (res.width() > max.width())
|
||||||
|
max.setWidth(res.width());
|
||||||
|
if (res.height() > max.height())
|
||||||
|
max.setHeight(res.height());
|
||||||
|
}
|
||||||
|
#else
|
||||||
int screens = QApplication::desktop()->screenCount();
|
int screens = QApplication::desktop()->screenCount();
|
||||||
for (int i = 0; i < screens; ++i)
|
for (int i = 0; i < screens; ++i)
|
||||||
{
|
{
|
||||||
|
@ -320,6 +335,7 @@ QRect Launcher::GraphicsPage::getMaximumResolution()
|
||||||
if (res.height() > max.height())
|
if (res.height() > max.height())
|
||||||
max.setHeight(res.height());
|
max.setHeight(res.height());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "filewidget.hpp"
|
#include "filewidget.hpp"
|
||||||
#include "adjusterwidget.hpp"
|
#include "adjusterwidget.hpp"
|
||||||
|
|
||||||
|
@ -46,7 +50,11 @@ CSVDoc::NewGameDialogue::NewGameDialogue()
|
||||||
connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)),
|
connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)),
|
||||||
mAdjusterWidget, SLOT (setName (const QString&, bool)));
|
mAdjusterWidget, SLOT (setName (const QString&, bool)));
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
||||||
|
#else
|
||||||
QRect scr = QApplication::desktop()->screenGeometry();
|
QRect scr = QApplication::desktop()->screenGeometry();
|
||||||
|
#endif
|
||||||
QRect rect = geometry();
|
QRect rect = geometry();
|
||||||
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
QPushButton *CSVDoc::StartupDialogue::addButton (const QString& label, const QIcon& icon)
|
QPushButton *CSVDoc::StartupDialogue::addButton (const QString& label, const QIcon& icon)
|
||||||
{
|
{
|
||||||
int column = mColumn--;
|
int column = mColumn--;
|
||||||
|
@ -119,7 +123,12 @@ CSVDoc::StartupDialogue::StartupDialogue() : mWidth (0), mColumn (2)
|
||||||
|
|
||||||
setLayout (layout);
|
setLayout (layout);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
||||||
|
#else
|
||||||
QRect scr = QApplication::desktop()->screenGeometry();
|
QRect scr = QApplication::desktop()->screenGeometry();
|
||||||
|
#endif
|
||||||
|
|
||||||
QRect rect = geometry();
|
QRect rect = geometry();
|
||||||
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
#include "../../model/prefs/state.hpp"
|
#include "../../model/prefs/state.hpp"
|
||||||
#include "../../model/prefs/shortcut.hpp"
|
#include "../../model/prefs/shortcut.hpp"
|
||||||
|
@ -1050,7 +1054,7 @@ void CSVDoc::View::updateWidth(bool isGrowLimit, int minSubViewWidth)
|
||||||
if (isGrowLimit)
|
if (isGrowLimit)
|
||||||
rect = dw->screenGeometry(this);
|
rect = dw->screenGeometry(this);
|
||||||
else
|
else
|
||||||
rect = dw->screenGeometry(dw->screen(dw->screenNumber(this)));
|
rect = QGuiApplication::screens().at(dw->screenNumber(this))->geometry();
|
||||||
|
|
||||||
if (!mScrollbarOnly && mScroll && mSubViews.size() > 1)
|
if (!mScrollbarOnly && mScroll && mSubViews.size() > 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
|
|
||||||
#include "../../model/prefs/state.hpp"
|
#include "../../model/prefs/state.hpp"
|
||||||
|
@ -34,7 +38,12 @@ void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main)
|
||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
QString label = QString::fromUtf8 (iter->second.getKey().c_str());
|
QString label = QString::fromUtf8 (iter->second.getKey().c_str());
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
||||||
|
maxWidth = std::max (maxWidth, metrics.horizontalAdvance (label));
|
||||||
|
#else
|
||||||
maxWidth = std::max (maxWidth, metrics.width (label));
|
maxWidth = std::max (maxWidth, metrics.width (label));
|
||||||
|
#endif
|
||||||
|
|
||||||
list->addItem (label);
|
list->addItem (label);
|
||||||
}
|
}
|
||||||
|
@ -107,8 +116,15 @@ void CSVPrefs::Dialogue::show()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
||||||
|
#else
|
||||||
|
QRect scr = QApplication::desktop()->screenGeometry();
|
||||||
|
#endif
|
||||||
|
|
||||||
// otherwise place at the centre of the screen
|
// otherwise place at the centre of the screen
|
||||||
QPoint screenCenter = QApplication::desktop()->screenGeometry().center();
|
QPoint screenCenter = scr.center();
|
||||||
|
|
||||||
move (screenCenter - QPoint(frameGeometry().width()/2, frameGeometry().height()/2));
|
move (screenCenter - QPoint(frameGeometry().width()/2, frameGeometry().height()/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "colorpickerpopup.hpp"
|
#include "colorpickerpopup.hpp"
|
||||||
|
|
||||||
CSVWidget::ColorEditor::ColorEditor(const QColor &color, QWidget *parent, const bool popupOnStart)
|
CSVWidget::ColorEditor::ColorEditor(const QColor &color, QWidget *parent, const bool popupOnStart)
|
||||||
|
@ -95,7 +99,11 @@ QPoint CSVWidget::ColorEditor::calculatePopupPosition()
|
||||||
{
|
{
|
||||||
QRect editorGeometry = geometry();
|
QRect editorGeometry = geometry();
|
||||||
QRect popupGeometry = mColorPicker->geometry();
|
QRect popupGeometry = mColorPicker->geometry();
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
|
||||||
|
#else
|
||||||
QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Center the popup horizontally relative to the editor
|
// Center the popup horizontally relative to the editor
|
||||||
int localPopupX = (editorGeometry.width() - popupGeometry.width()) / 2;
|
int localPopupX = (editorGeometry.width() - popupGeometry.width()) / 2;
|
||||||
|
|
|
@ -134,7 +134,12 @@ QSize CSVWorld::EnumDelegate::sizeHint(const QStyleOptionViewItem &option, const
|
||||||
itemOption.state = option.state;
|
itemOption.state = option.state;
|
||||||
|
|
||||||
const QString &valueText = mValues.at(valueIndex).second;
|
const QString &valueText = mValues.at(valueIndex).second;
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
||||||
|
QSize valueSize = QSize(itemOption.fontMetrics.horizontalAdvance(valueText), itemOption.fontMetrics.height());
|
||||||
|
#else
|
||||||
QSize valueSize = QSize(itemOption.fontMetrics.width(valueText), itemOption.fontMetrics.height());
|
QSize valueSize = QSize(itemOption.fontMetrics.width(valueText), itemOption.fontMetrics.height());
|
||||||
|
#endif
|
||||||
|
|
||||||
itemOption.currentText = valueText;
|
itemOption.currentText = valueText;
|
||||||
return QApplication::style()->sizeFromContents(QStyle::CT_ComboBox, &itemOption, valueSize);
|
return QApplication::style()->sizeFromContents(QStyle::CT_ComboBox, &itemOption, valueSize);
|
||||||
|
|
|
@ -205,7 +205,12 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id) const
|
||||||
void CSVWorld::ScriptEdit::setTabWidth()
|
void CSVWorld::ScriptEdit::setTabWidth()
|
||||||
{
|
{
|
||||||
// Set tab width to specified number of characters using current font.
|
// Set tab width to specified number of characters using current font.
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
||||||
|
setTabStopDistance(mTabCharCount * fontMetrics().horizontalAdvance(' '));
|
||||||
|
#else
|
||||||
setTabStopWidth(mTabCharCount * fontMetrics().width(' '));
|
setTabStopWidth(mTabCharCount * fontMetrics().width(' '));
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::ScriptEdit::wrapLines(bool wrap)
|
void CSVWorld::ScriptEdit::wrapLines(bool wrap)
|
||||||
|
@ -285,7 +290,11 @@ int CSVWorld::ScriptEdit::lineNumberAreaWidth()
|
||||||
++digits;
|
++digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
||||||
|
int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits;
|
||||||
|
#else
|
||||||
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
|
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
|
||||||
|
#endif
|
||||||
|
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue