mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 15:45:37 +00:00
Merge branch 'qt6_fixes' into 'master'
Do not use reprecated Qt API where we can avoid it See merge request OpenMW/openmw!2621
This commit is contained in:
commit
ee862fe825
@ -7,6 +7,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QStringList>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#include <boost/program_options/options_description.hpp>
|
#include <boost/program_options/options_description.hpp>
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QStackedWidget;
|
class QStackedWidget;
|
||||||
class QStringList;
|
|
||||||
class QStringListModel;
|
class QStringListModel;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent* event)
|
|||||||
if (button != nullptr)
|
if (button != nullptr)
|
||||||
{
|
{
|
||||||
QStyleOptionButton option;
|
QStyleOptionButton option;
|
||||||
option.init(button);
|
option.initFrom(button);
|
||||||
QRect buttonRect = option.rect;
|
QRect buttonRect = option.rect;
|
||||||
buttonRect.moveTo(button->mapToGlobal(buttonRect.topLeft()));
|
buttonRect.moveTo(button->mapToGlobal(buttonRect.topLeft()));
|
||||||
|
|
||||||
|
@ -22,7 +22,12 @@ int CSVWidget::CompleterPopup::sizeHintForRow(int row) const
|
|||||||
|
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
QModelIndex index = model()->index(row, modelColumn());
|
QModelIndex index = model()->index(row, modelColumn());
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
QStyleOptionViewItem option;
|
||||||
|
initViewItemOption(&option);
|
||||||
|
#else
|
||||||
QStyleOptionViewItem option = viewOptions();
|
QStyleOptionViewItem option = viewOptions();
|
||||||
|
#endif
|
||||||
QAbstractItemDelegate* delegate = itemDelegate(index);
|
QAbstractItemDelegate* delegate = itemDelegate(index);
|
||||||
return delegate->sizeHint(option, index).height();
|
return delegate->sizeHint(option, index).height();
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QScreen>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -76,7 +76,7 @@ CSVWorld::TableSubView::TableSubView(
|
|||||||
|
|
||||||
setWidget(widget);
|
setWidget(widget);
|
||||||
// prefer height of the screen and full width of the table
|
// 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
|
int frameHeight = 40; // set a reasonable default
|
||||||
QWidget* topLevel = QApplication::topLevelAt(pos());
|
QWidget* topLevel = QApplication::topLevelAt(pos());
|
||||||
if (topLevel)
|
if (topLevel)
|
||||||
|
@ -364,7 +364,11 @@ void CSVWorld::CommandDelegate::setEditorData(QWidget* editor, const QModelIndex
|
|||||||
if (!n.isEmpty())
|
if (!n.isEmpty())
|
||||||
{
|
{
|
||||||
if (!variant.isValid())
|
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);
|
variant = QVariant(editor->property(n).userType(), (const void*)nullptr);
|
||||||
|
#endif
|
||||||
editor->setProperty(n, variant);
|
editor->setProperty(n, variant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,12 +165,10 @@ bool Config::GameSettings::readFile(QTextStream& stream, QMultiMap<QString, QStr
|
|||||||
bool Config::GameSettings::writeFile(QTextStream& stream)
|
bool Config::GameSettings::writeFile(QTextStream& stream)
|
||||||
{
|
{
|
||||||
// Iterate in reverse order to preserve insertion order
|
// Iterate in reverse order to preserve insertion order
|
||||||
QMapIterator<QString, QString> i(mUserSettings);
|
auto i = mUserSettings.end();
|
||||||
i.toBack();
|
while (i != mUserSettings.begin())
|
||||||
|
|
||||||
while (i.hasPrevious())
|
|
||||||
{
|
{
|
||||||
i.previous();
|
i--;
|
||||||
|
|
||||||
// path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses
|
// path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses
|
||||||
// boost::io::quoted
|
// boost::io::quoted
|
||||||
@ -388,12 +386,10 @@ bool Config::GameSettings::writeFileWithComments(QFile& file)
|
|||||||
|
|
||||||
// Iterate in reverse order to preserve insertion order
|
// Iterate in reverse order to preserve insertion order
|
||||||
QString settingLine;
|
QString settingLine;
|
||||||
QMapIterator<QString, QString> it(mUserSettings);
|
auto it = mUserSettings.end();
|
||||||
it.toBack();
|
while (it != mUserSettings.begin())
|
||||||
|
|
||||||
while (it.hasPrevious())
|
|
||||||
{
|
{
|
||||||
it.previous();
|
it--;
|
||||||
|
|
||||||
if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local")
|
if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local")
|
||||||
|| it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame"))
|
|| it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame"))
|
||||||
|
@ -50,12 +50,10 @@ bool Config::LauncherSettings::writeFile(QTextStream& stream)
|
|||||||
QRegularExpression sectionRe("^([^/]+)/(.+)$");
|
QRegularExpression sectionRe("^([^/]+)/(.+)$");
|
||||||
QMultiMap<QString, QString> settings = SettingsBase::getSettings();
|
QMultiMap<QString, QString> settings = SettingsBase::getSettings();
|
||||||
|
|
||||||
QMapIterator<QString, QString> i(settings);
|
auto i = settings.end();
|
||||||
i.toBack();
|
while (i != settings.begin())
|
||||||
|
|
||||||
while (i.hasPrevious())
|
|
||||||
{
|
{
|
||||||
i.previous();
|
i--;
|
||||||
|
|
||||||
QString prefix;
|
QString prefix;
|
||||||
QString key;
|
QString key;
|
||||||
|
@ -192,12 +192,12 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex& index, int
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
return Qt::AlignLeft + Qt::AlignVCenter;
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
return Qt::AlignRight + Qt::AlignVCenter;
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
default:
|
default:
|
||||||
return Qt::AlignLeft + Qt::AlignVCenter;
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "esmfile.hpp"
|
#include "esmfile.hpp"
|
||||||
|
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
#include <QIODevice>
|
||||||
|
|
||||||
int ContentSelectorModel::EsmFile::sPropertyCount = 7;
|
int ContentSelectorModel::EsmFile::sPropertyCount = 7;
|
||||||
QString ContentSelectorModel::EsmFile::sToolTip = QString(
|
QString ContentSelectorModel::EsmFile::sToolTip = QString(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user