Merge branch 'qt6_fixes' into 'master'

Do not use reprecated Qt API where we can avoid it

See merge request OpenMW/openmw!2621
7220-lua-add-a-general-purpose-lexical-parser
psi29a 2 years ago
commit ee862fe825

@ -7,6 +7,7 @@
#include <QDebug>
#include <QDir>
#include <QMessageBox>
#include <QStringList>
#include <QTime>
#include <boost/program_options/options_description.hpp>

@ -14,7 +14,6 @@
class QListWidgetItem;
class QStackedWidget;
class QStringList;
class QStringListModel;
class QString;

@ -46,7 +46,7 @@ void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent* event)
if (button != nullptr)
{
QStyleOptionButton option;
option.init(button);
option.initFrom(button);
QRect buttonRect = option.rect;
buttonRect.moveTo(button->mapToGlobal(buttonRect.topLeft()));

@ -22,7 +22,12 @@ int CSVWidget::CompleterPopup::sizeHintForRow(int row) const
ensurePolished();
QModelIndex index = model()->index(row, modelColumn());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStyleOptionViewItem option;
initViewItemOption(&option);
#else
QStyleOptionViewItem option = viewOptions();
#endif
QAbstractItemDelegate* delegate = itemDelegate(index);
return delegate->sizeHint(option, index).height();
}

@ -2,12 +2,12 @@
#include <QApplication>
#include <QCheckBox>
#include <QDesktopWidget>
#include <QDropEvent>
#include <QEvent>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QPushButton>
#include <QScreen>
#include <QVBoxLayout>
#include <algorithm>
@ -76,7 +76,7 @@ CSVWorld::TableSubView::TableSubView(
setWidget(widget);
// prefer height of the screen and full width of the table
const QRect rect = QApplication::desktop()->screenGeometry(this);
const QRect rect = QApplication::screenAt(pos())->geometry();
int frameHeight = 40; // set a reasonable default
QWidget* topLevel = QApplication::topLevelAt(pos());
if (topLevel)

@ -364,7 +364,11 @@ void CSVWorld::CommandDelegate::setEditorData(QWidget* editor, const QModelIndex
if (!n.isEmpty())
{
if (!variant.isValid())
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
variant = QVariant(editor->property(n).metaType(), (const void*)nullptr);
#else
variant = QVariant(editor->property(n).userType(), (const void*)nullptr);
#endif
editor->setProperty(n, variant);
}
}

@ -165,12 +165,10 @@ bool Config::GameSettings::readFile(QTextStream& stream, QMultiMap<QString, QStr
bool Config::GameSettings::writeFile(QTextStream& stream)
{
// Iterate in reverse order to preserve insertion order
QMapIterator<QString, QString> i(mUserSettings);
i.toBack();
while (i.hasPrevious())
auto i = mUserSettings.end();
while (i != mUserSettings.begin())
{
i.previous();
i--;
// path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses
// boost::io::quoted
@ -388,12 +386,10 @@ bool Config::GameSettings::writeFileWithComments(QFile& file)
// Iterate in reverse order to preserve insertion order
QString settingLine;
QMapIterator<QString, QString> it(mUserSettings);
it.toBack();
while (it.hasPrevious())
auto it = mUserSettings.end();
while (it != mUserSettings.begin())
{
it.previous();
it--;
if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local")
|| it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame"))

@ -50,12 +50,10 @@ bool Config::LauncherSettings::writeFile(QTextStream& stream)
QRegularExpression sectionRe("^([^/]+)/(.+)$");
QMultiMap<QString, QString> settings = SettingsBase::getSettings();
QMapIterator<QString, QString> i(settings);
i.toBack();
while (i.hasPrevious())
auto i = settings.end();
while (i != settings.begin())
{
i.previous();
i--;
QString prefix;
QString key;

@ -192,12 +192,12 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex& index, int
{
case 0:
case 1:
return Qt::AlignLeft + Qt::AlignVCenter;
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
case 2:
case 3:
return Qt::AlignRight + Qt::AlignVCenter;
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
default:
return Qt::AlignLeft + Qt::AlignVCenter;
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
}
}

@ -1,6 +1,7 @@
#include "esmfile.hpp"
#include <QDataStream>
#include <QIODevice>
int ContentSelectorModel::EsmFile::sPropertyCount = 7;
QString ContentSelectorModel::EsmFile::sToolTip = QString(

Loading…
Cancel
Save