Drop support for Qt5

This commit is contained in:
Evil Eye 2025-07-05 14:06:56 +02:00
parent 8deb050ea2
commit 2bce45260c
36 changed files with 112 additions and 187 deletions

View File

@ -27,14 +27,14 @@ variables:
.Ubuntu_Image:
tags:
- saas-linux-medium-amd64
image: ubuntu:22.04
image: ubuntu:24.04
rules:
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
Ubuntu_GCC_preprocess:
extends: .Ubuntu_Image
cache:
key: Ubuntu_GCC_preprocess.ubuntu_22.04.v1
key: Ubuntu_GCC_preprocess.ubuntu_24.04.v1
paths:
- apt-cache/
- .cache/pip/
@ -43,7 +43,7 @@ Ubuntu_GCC_preprocess:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
before_script:
- CI/install_debian_deps.sh openmw-deps openmw-deps-dynamic gcc_preprocess
- pip3 install --user click termtables
- pip3 install --user --break-system-packages click termtables
script:
- CI/ubuntu_gcc_preprocess.sh
rules:
@ -97,12 +97,12 @@ Ubuntu_GCC_preprocess:
Coverity:
tags:
- saas-linux-medium-amd64
image: ubuntu:22.04
image: ubuntu:24.04
stage: build
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
cache:
key: Coverity.ubuntu_22.04.v1
key: Coverity.ubuntu_24.04.v1
paths:
- apt-cache/
- ccache/
@ -141,7 +141,7 @@ Coverity:
Ubuntu_GCC:
extends: .Ubuntu
cache:
key: Ubuntu_GCC.ubuntu_22.04.v1
key: Ubuntu_GCC.ubuntu_24.04.v1
before_script:
- CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic
variables:
@ -154,7 +154,7 @@ Ubuntu_GCC:
Ubuntu_GCC_asan:
extends: Ubuntu_GCC
cache:
key: Ubuntu_GCC_asan.ubuntu_22.04.v1
key: Ubuntu_GCC_asan.ubuntu_24.04.v1
variables:
CMAKE_BUILD_TYPE: Debug
CMAKE_CXX_FLAGS_DEBUG: -g -O1 -fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak
@ -167,7 +167,7 @@ Clang_Format:
extends: .Ubuntu_Image
stage: checks
cache:
key: Ubuntu_Clang_Format.ubuntu_22.04.v1
key: Ubuntu_Clang_Format.ubuntu_24.04.v1
paths:
- apt-cache/
variables:
@ -183,11 +183,11 @@ Lupdate:
extends: .Ubuntu_Image
stage: checks
cache:
key: Ubuntu_lupdate.ubuntu_22.04.v1
key: Ubuntu_lupdate.ubuntu_24.04.v1
paths:
- apt-cache/
variables:
LUPDATE: lupdate
LUPDATE: /usr/lib/qt6/bin/lupdate
before_script:
- CI/install_debian_deps.sh openmw-qt-translations
script:
@ -209,7 +209,7 @@ Teal:
Ubuntu_GCC_Debug:
extends: .Ubuntu
cache:
key: Ubuntu_GCC_Debug.ubuntu_22.04.v2
key: Ubuntu_GCC_Debug.ubuntu_24.04.v2
before_script:
- CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic
variables:
@ -225,7 +225,7 @@ Ubuntu_GCC_Debug:
Ubuntu_GCC_tests:
extends: Ubuntu_GCC
cache:
key: Ubuntu_GCC_tests.ubuntu_22.04.v1
key: Ubuntu_GCC_tests.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -239,7 +239,7 @@ Ubuntu_GCC_tests:
.Ubuntu_GCC_tests_Debug:
extends: Ubuntu_GCC
cache:
key: Ubuntu_GCC_tests_Debug.ubuntu_22.04.v1
key: Ubuntu_GCC_tests_Debug.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -255,7 +255,7 @@ Ubuntu_GCC_tests:
Ubuntu_GCC_tests_asan:
extends: Ubuntu_GCC
cache:
key: Ubuntu_GCC_tests_asan.ubuntu_22.04.v1
key: Ubuntu_GCC_tests_asan.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -278,7 +278,7 @@ Ubuntu_GCC_tests_asan:
Ubuntu_GCC_tests_ubsan:
extends: Ubuntu_GCC
cache:
key: Ubuntu_GCC_tests_ubsan.ubuntu_22.04.v1
key: Ubuntu_GCC_tests_ubsan.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -298,7 +298,7 @@ Ubuntu_GCC_tests_ubsan:
.Ubuntu_GCC_tests_tsan:
extends: Ubuntu_GCC
cache:
key: Ubuntu_GCC_tests_tsan.ubuntu_22.04.v1
key: Ubuntu_GCC_tests_tsan.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -316,7 +316,7 @@ Ubuntu_GCC_tests_ubsan:
Ubuntu_GCC_tests_coverage:
extends: .Ubuntu_GCC_tests_Debug
cache:
key: Ubuntu_GCC_tests_coverage.ubuntu_22.04.v1
key: Ubuntu_GCC_tests_coverage.ubuntu_24.04.v1
variables:
BUILD_WITH_CODE_COVERAGE: 1
before_script:
@ -345,7 +345,7 @@ Ubuntu_GCC_tests_coverage:
- "CI/**/*"
- ".gitlab-ci.yml"
cache:
key: Ubuntu_Static_Deps.ubuntu_22.04.v1
key: Ubuntu_Static_Deps.ubuntu_24.04.v1
paths:
- apt-cache/
- ccache/
@ -362,7 +362,7 @@ Ubuntu_GCC_tests_coverage:
.Ubuntu_Static_Deps_tests:
extends: .Ubuntu_Static_Deps
cache:
key: Ubuntu_Static_Deps_tests.ubuntu_22.04.v1
key: Ubuntu_Static_Deps_tests.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -381,7 +381,7 @@ Ubuntu_Clang:
before_script:
- CI/install_debian_deps.sh clang openmw-deps openmw-deps-dynamic
cache:
key: Ubuntu_Clang.ubuntu_22.04.v2
key: Ubuntu_Clang.ubuntu_24.04.v2
variables:
CC: clang
CXX: clang++
@ -394,7 +394,7 @@ Ubuntu_Clang:
before_script:
- CI/install_debian_deps.sh clang clang-tidy openmw-deps openmw-deps-dynamic
cache:
key: Ubuntu_Clang_Tidy.ubuntu_22.04.v1
key: Ubuntu_Clang_Tidy.ubuntu_24.04.v1
variables:
CMAKE_BUILD_TYPE: Debug
CMAKE_CXX_FLAGS_DEBUG: -O0
@ -451,7 +451,7 @@ Ubuntu_Clang_Tidy_other:
.Ubuntu_Clang_tests:
extends: Ubuntu_Clang
cache:
key: Ubuntu_Clang_tests.ubuntu_22.04.v1
key: Ubuntu_Clang_tests.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -465,7 +465,7 @@ Ubuntu_Clang_Tidy_other:
Ubuntu_Clang_tests_Debug:
extends: Ubuntu_Clang
cache:
key: Ubuntu_Clang_tests_Debug.ubuntu_22.04.v1
key: Ubuntu_Clang_tests_Debug.ubuntu_24.04.v1
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -489,7 +489,7 @@ Ubuntu_Clang_tests_Debug:
- apt-cache/
before_script:
- CI/install_debian_deps.sh $OPENMW_DEPS
- pip3 install --user numpy matplotlib termtables click
- pip3 install --user --break-system-packages numpy matplotlib termtables click
script:
- CI/run_integration_tests.sh
after_script:
@ -500,7 +500,7 @@ Ubuntu_Clang_integration_tests:
needs:
- Ubuntu_Clang
cache:
key: Ubuntu_Clang_integration_tests.ubuntu_22.04.v2
key: Ubuntu_Clang_integration_tests.ubuntu_24.04.v2
variables:
OPENMW_DEPS: openmw-integration-tests
@ -509,9 +509,9 @@ Ubuntu_GCC_integration_tests_asan:
needs:
- Ubuntu_GCC_asan
cache:
key: Ubuntu_GCC_integration_tests_asan.ubuntu_22.04.v1
key: Ubuntu_GCC_integration_tests_asan.ubuntu_24.04.v1
variables:
OPENMW_DEPS: openmw-integration-tests libasan6
OPENMW_DEPS: openmw-integration-tests libasan
ASAN_OPTIONS: halt_on_error=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=0
.MacOS:
@ -990,7 +990,7 @@ Windows_MSBuild_CacheInit:
paths:
- .cache/pip
before_script:
- pip3 install --user requests click discord_webhook
- pip3 install --user --break-system-packages requests click discord_webhook
script:
- scripts/find_missing_merge_requests.py --project_id=$CI_PROJECT_ID --ignored_mrs_path=$CI_PROJECT_DIR/.resubmitted_merge_requests.txt

View File

@ -708,17 +708,12 @@ printf "Qt ${QT_VER}... "
DLLSUFFIX=""
fi
if [ "${QT_MAJOR_VER}" -eq 6 ]; then
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_MAJOR_VER}"{Core,Gui,Network,OpenGL,OpenGLWidgets,Widgets,Svg}${DLLSUFFIX}.dll
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_MAJOR_VER}"{Core,Gui,Network,OpenGL,OpenGLWidgets,Widgets,Svg}${DLLSUFFIX}.dll
# Since Qt 6.7.0 plugin is called "qmodernwindowsstyle"
if [ "${QT_MINOR_VER}" -ge 7 ]; then
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qmodernwindowsstyle${DLLSUFFIX}.dll"
else
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll"
fi
# Since Qt 6.7.0 plugin is called "qmodernwindowsstyle"
if [ "${QT_MINOR_VER}" -ge 7 ]; then
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qmodernwindowsstyle${DLLSUFFIX}.dll"
else
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_MAJOR_VER}"{Core,Gui,Network,OpenGL,Widgets,Svg}${DLLSUFFIX}.dll
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll"
fi

View File

@ -33,10 +33,10 @@ declare -rA GROUPED_DEPS=(
libboost-system-dev libboost-iostreams-dev
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev
libsdl2-dev libqt5opengl5-dev qttools5-dev qttools5-dev-tools libopenal-dev
libsdl2-dev libqt6opengl6-dev qt6-tools-dev qt6-tools-dev-tools libopenal-dev
libunshield-dev libtinyxml-dev libbullet-dev liblz4-dev libpng-dev libjpeg-dev
libluajit-5.1-dev librecast-dev libsqlite3-dev ca-certificates libicu-dev
libyaml-cpp-dev libqt5svg5 libqt5svg5-dev
libyaml-cpp-dev libqt6svg6 libqt6svg6-dev
"
# These dependencies can alternatively be built and linked statically.
@ -64,15 +64,15 @@ declare -rA GROUPED_DEPS=(
gdb
git
git-lfs
libavcodec58
libavformat58
libavutil56
libboost-iostreams1.74.0
libboost-program-options1.74.0
libboost-system1.74.0
libavcodec60
libavformat60
libavutil58
libboost-iostreams1.83.0
libboost-program-options1.83.0
libboost-system1.83.0
libbullet3.24
libcollada-dom2.5-dp0
libicu70
libicu74
libjpeg8
libluajit-5.1-2
liblz4-1
@ -80,19 +80,19 @@ declare -rA GROUPED_DEPS=(
libopenal1
libopenscenegraph161
libpng16-16
libqt5opengl5
libqt6opengl6
librecast1
libsdl2-2.0-0
libsqlite3-0
libswresample3
libswscale5
libswresample4
libswscale7
libtinyxml2.6.2v5
libyaml-cpp0.8
python3-pip
xvfb
"
[libasan6]="libasan6"
[libasan]="libasan8"
[android]="binutils build-essential cmake ccache curl unzip git pkg-config"
@ -102,8 +102,8 @@ declare -rA GROUPED_DEPS=(
"
[openmw-qt-translations]="
qttools5-dev
qttools5-dev-tools
qt6-tools-dev
qt6-tools-dev-tools
git-core
"
)

View File

@ -249,12 +249,8 @@ endif()
find_package(LZ4 REQUIRED)
if (USE_QT)
find_package(QT REQUIRED COMPONENTS Core NAMES Qt6 Qt5)
if (QT_VERSION_MAJOR VERSION_EQUAL 5)
find_package(Qt5 5.15 COMPONENTS Core Widgets Network OpenGL LinguistTools Svg REQUIRED)
else()
find_package(Qt6 COMPONENTS Core Widgets Network OpenGL OpenGLWidgets LinguistTools Svg REQUIRED)
endif()
find_package(QT REQUIRED COMPONENTS Core NAMES Qt6)
find_package(Qt6 COMPONENTS Core Widgets Network OpenGL OpenGLWidgets LinguistTools Svg REQUIRED)
message(STATUS "Using Qt${QT_VERSION}")
endif()

View File

@ -88,11 +88,7 @@ void Launcher::ImportPage::on_importerButton_clicked()
// Create the file if it doesn't already exist, else the importer will fail
auto path = mCfgMgr.getUserConfigPath();
path /= "openmw.cfg";
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFile file(path);
#else
QFile file(Files::pathToQString(path));
#endif
if (!file.exists())
{

View File

@ -497,11 +497,7 @@ bool Launcher::MainDialog::writeSettings()
}
// Game settings
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFile file(userPath / Files::openmwCfgFile);
#else
QFile file(Files::getUserConfigPathQString(mCfgMgr));
#endif
if (!file.open(QIODevice::ReadWrite | QIODevice::Text))
{

View File

@ -240,11 +240,7 @@ target_link_libraries(openmw-cs-lib
components_qt
)
if (QT_VERSION_MAJOR VERSION_EQUAL 6)
target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL Qt::OpenGLWidgets Qt::Svg)
else()
target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL Qt::Svg)
endif()
target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL Qt::OpenGLWidgets Qt::Svg)
if (WIN32)
target_sources(openmw-cs PRIVATE ${CMAKE_SOURCE_DIR}/files/windows/openmw-cs.exe.manifest)

View File

@ -34,11 +34,11 @@ bool CSMFilter::TextNode::test(const CSMWorld::IdTableBase& table, int row, cons
QString string;
if (data.type() == QVariant::String)
if (data.typeId() == QMetaType::QString)
{
string = data.toString();
}
else if ((data.type() == QVariant::Int || data.type() == QVariant::UInt)
else if ((data.typeId() == QMetaType::Int || data.typeId() == QMetaType::UInt)
&& CSMWorld::Columns::hasEnums(static_cast<CSMWorld::Columns::ColumnId>(mColumnId)))
{
int value = data.toInt();
@ -49,7 +49,7 @@ bool CSMFilter::TextNode::test(const CSMWorld::IdTableBase& table, int row, cons
if (value >= 0 && value < static_cast<int>(enums.size()))
string = QString::fromUtf8(enums[value].second.c_str());
}
else if (data.type() == QVariant::Bool)
else if (data.typeId() == QMetaType::Bool)
{
string = data.toBool() ? "true" : "false";
}

View File

@ -29,8 +29,8 @@ bool CSMFilter::ValueNode::test(const CSMWorld::IdTableBase& table, int row, con
QVariant data = table.data(index);
if (data.type() != QVariant::Double && data.type() != QVariant::Bool && data.type() != QVariant::Int
&& data.type() != QVariant::UInt && data.type() != static_cast<QVariant::Type>(QMetaType::Float))
if (data.typeId() != QMetaType::Double && data.typeId() != QMetaType::Bool && data.typeId() != QMetaType::Int
&& data.typeId() != QMetaType::UInt && data.typeId() != QMetaType::Float)
return false;
double value = data.toDouble();

View File

@ -62,39 +62,31 @@ namespace CSMPrefs
{
QWidget* widget = static_cast<QWidget*>(watched);
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
unsigned int mod = (unsigned int)keyEvent->modifiers();
unsigned int key = (unsigned int)keyEvent->key();
if (!keyEvent->isAutoRepeat())
return activate(widget, mod, key);
return activate(widget, keyEvent->keyCombination());
}
else if (event->type() == QEvent::KeyRelease)
{
QWidget* widget = static_cast<QWidget*>(watched);
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
unsigned int mod = (unsigned int)keyEvent->modifiers();
unsigned int key = (unsigned int)keyEvent->key();
if (!keyEvent->isAutoRepeat())
return deactivate(widget, mod, key);
return deactivate(widget, keyEvent->keyCombination());
}
else if (event->type() == QEvent::MouseButtonPress)
{
QWidget* widget = static_cast<QWidget*>(watched);
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
unsigned int mod = (unsigned int)mouseEvent->modifiers();
unsigned int button = (unsigned int)mouseEvent->button();
return activate(widget, mod, button);
return activate(widget, QKeyCombination(mouseEvent->modifiers(), Qt::Key(mouseEvent->button())));
}
else if (event->type() == QEvent::MouseButtonRelease)
{
QWidget* widget = static_cast<QWidget*>(watched);
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
unsigned int mod = (unsigned int)mouseEvent->modifiers();
unsigned int button = (unsigned int)mouseEvent->button();
return deactivate(widget, mod, button);
return deactivate(widget, QKeyCombination(mouseEvent->modifiers(), Qt::Key(mouseEvent->button())));
}
else if (event->type() == QEvent::FocusOut)
{
@ -149,7 +141,7 @@ namespace CSMPrefs
}
}
bool ShortcutEventHandler::activate(QWidget* widget, unsigned int mod, unsigned int button)
bool ShortcutEventHandler::activate(QWidget* widget, QKeyCombination keyCombination)
{
std::vector<std::pair<MatchResult, Shortcut*>> potentials;
bool used = false;
@ -167,7 +159,7 @@ namespace CSMPrefs
if (!shortcut->isEnabled())
continue;
if (checkModifier(mod, button, shortcut, true))
if (checkModifier(keyCombination, shortcut, true))
used = true;
if (shortcut->getActivationStatus() != Shortcut::AS_Inactive)
@ -175,7 +167,8 @@ namespace CSMPrefs
int pos = shortcut->getPosition();
int lastPos = shortcut->getLastPosition();
MatchResult result = match(mod, button, shortcut->getSequence()[pos]);
MatchResult result = match(keyCombination.keyboardModifiers(), keyCombination.key(),
shortcut->getSequence()[pos].toCombined());
if (result == Matches_WithMod || result == Matches_NoMod)
{
@ -220,10 +213,8 @@ namespace CSMPrefs
return used;
}
bool ShortcutEventHandler::deactivate(QWidget* widget, unsigned int mod, unsigned int button)
bool ShortcutEventHandler::deactivate(QWidget* widget, QKeyCombination keyCombination)
{
const int KeyMask = 0x01FFFFFF;
bool used = false;
while (widget)
@ -235,11 +226,11 @@ namespace CSMPrefs
{
Shortcut* shortcut = *it;
if (checkModifier(mod, button, shortcut, false))
if (checkModifier(keyCombination, shortcut, false))
used = true;
int pos = shortcut->getPosition();
MatchResult result = match(0, button, shortcut->getSequence()[pos] & KeyMask);
MatchResult result = match(0, keyCombination.key(), shortcut->getSequence()[pos].key());
if (result != Matches_Not)
{
@ -268,13 +259,13 @@ namespace CSMPrefs
return used;
}
bool ShortcutEventHandler::checkModifier(unsigned int mod, unsigned int button, Shortcut* shortcut, bool activate)
bool ShortcutEventHandler::checkModifier(QKeyCombination keyCombination, Shortcut* shortcut, bool activate)
{
if (!shortcut->isEnabled() || !shortcut->getModifier() || shortcut->getSecondaryMode() == Shortcut::SM_Ignore
|| shortcut->getModifierStatus() == activate)
return false;
MatchResult result = match(mod, button, shortcut->getModifier());
MatchResult result = match(keyCombination.keyboardModifiers(), keyCombination.key(), shortcut->getModifier());
bool used = false;
if (result != Matches_Not)

View File

@ -42,11 +42,11 @@ namespace CSMPrefs
void updateParent(QWidget* widget);
bool activate(QWidget* widget, unsigned int mod, unsigned int button);
bool activate(QWidget* widget, QKeyCombination keyCombination);
bool deactivate(QWidget* widget, unsigned int mod, unsigned int button);
bool deactivate(QWidget* widget, QKeyCombination keyCombination);
bool checkModifier(unsigned int mod, unsigned int button, Shortcut* shortcut, bool activate);
bool checkModifier(QKeyCombination keyCombination, Shortcut* shortcut, bool activate);
MatchResult match(unsigned int mod, unsigned int button, unsigned int value);

View File

@ -115,15 +115,12 @@ namespace CSMPrefs
std::string ShortcutManager::convertToString(const QKeySequence& sequence) const
{
const int MouseKeyMask = 0x01FFFFFF;
const int ModMask = 0x7E000000;
std::string result;
for (int i = 0; i < (int)sequence.count(); ++i)
for (int i = 0; i < sequence.count(); ++i)
{
int mods = sequence[i] & ModMask;
int key = sequence[i] & MouseKeyMask;
int mods = sequence[i].keyboardModifiers();
int key = sequence[i].key();
if (key)
{

View File

@ -59,13 +59,6 @@ void CSMPrefs::State::declare()
.setTooltip("Minimum width of subviews.")
.setRange(50, 10000);
declareEnum(mValues->mWindows.mMainwindowScrollbar, "Main Window Horizontal Scrollbar Mode");
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
declareBool(mValues->mWindows.mGrowLimit, "Grow Limit Screen")
.setTooltip(
"When \"Grow then Scroll\" option is selected, the window size grows to"
" the width of the virtual desktop. \nIf this option is selected the the window growth"
"is limited to the current screen.");
#endif
declareCategory("Records");
declareEnum(mValues->mRecords.mStatusFormat, "Modification Status Display Format");

View File

@ -659,11 +659,7 @@ void CSVDoc::View::addSubView(const CSMWorld::UniversalId& id, const std::string
//
mScrollbarOnly = windows["mainwindow-scrollbar"].toString() == "Scrollbar Only";
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
updateWidth(windows["grow-limit"].isTrue(), minWidth);
#else
updateWidth(true, minWidth);
#endif
mSubViewWindow.addDockWidget(Qt::TopDockWidgetArea, view);

View File

@ -50,7 +50,7 @@ namespace CSVFilter
std::pair<std::string, FilterType> operator()(const QVariant& variantData)
{
FilterType filterType = FilterType::String;
QMetaType::Type dataType = static_cast<QMetaType::Type>(variantData.type());
QMetaType::Type dataType = static_cast<QMetaType::Type>(variantData.typeId());
if (dataType == QMetaType::QString || dataType == QMetaType::Bool || dataType == QMetaType::Int)
filterType = FilterType::String;
if (dataType == QMetaType::Int || dataType == QMetaType::Float)

View File

@ -1132,7 +1132,7 @@ void CSVRender::InstanceMode::dropEvent(QDropEvent* event)
return;
WorldspaceHitResult hit
= getWorldspaceWidget().mousePick(event->pos(), getWorldspaceWidget().getInteractionMask());
= getWorldspaceWidget().mousePick(event->position().toPoint(), getWorldspaceWidget().getInteractionMask());
std::string cellId = getWorldspaceWidget().getCellId(hit.worldPos);

View File

@ -161,8 +161,6 @@ namespace CSVRender
, mLighting(nullptr)
, mHasDefaultAmbient(false)
, mIsExterior(true)
, mPrevMouseX(0)
, mPrevMouseY(0)
, mCamPositionSet(false)
{
mFreeCamControl = new FreeCameraController(this);
@ -423,10 +421,10 @@ namespace CSVRender
void SceneWidget::mouseMoveEvent(QMouseEvent* event)
{
mCurrentCamControl->handleMouseMoveEvent(event->x() - mPrevMouseX, event->y() - mPrevMouseY);
QPointF pos = event->position();
mCurrentCamControl->handleMouseMoveEvent(pos.x() - mPrevMouse.x(), pos.y() - mPrevMouse.y());
mPrevMouseX = event->x();
mPrevMouseY = event->y();
mPrevMouse = pos;
}
void SceneWidget::wheelEvent(QWheelEvent* event)

View File

@ -137,7 +137,7 @@ namespace CSVRender
LightingNight mLightingNight;
LightingBright mLightingBright;
int mPrevMouseX, mPrevMouseY;
QPointF mPrevMouse;
/// Tells update that camera isn't set
bool mCamPositionSet;

View File

@ -1661,7 +1661,7 @@ void CSVRender::TerrainShapeMode::dragMoveEvent(QDragMoveEvent* event) {}
void CSVRender::TerrainShapeMode::mouseMoveEvent(QMouseEvent* event)
{
WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->pos(), getInteractionMask());
WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->position().toPoint(), getInteractionMask());
if (hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing))
mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape);
if (!hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing))

View File

@ -724,7 +724,7 @@ void CSVRender::TerrainTextureMode::dragMoveEvent(QDragMoveEvent* event) {}
void CSVRender::TerrainTextureMode::mouseMoveEvent(QMouseEvent* event)
{
WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->pos(), getInteractionMask());
WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->position().toPoint(), getInteractionMask());
if (hit.hit && mBrushDraw)
mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape);
if (!hit.hit && mBrushDraw)

View File

@ -687,11 +687,12 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent(QMouseEvent* event)
if (mDragging)
{
int diffX = event->x() - mDragX;
int diffY = (height() - event->y()) - mDragY;
QPoint pos = event->position().toPoint();
int diffX = pos.x() - mDragX;
int diffY = (height() - pos.y()) - mDragY;
mDragX = event->x();
mDragY = height() - event->y();
mDragX = pos.x();
mDragY = height() - pos.y();
double factor = mDragFactor;
@ -700,32 +701,32 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent(QMouseEvent* event)
EditMode& editMode = dynamic_cast<CSVRender::EditMode&>(*mEditMode->getCurrent());
editMode.drag(event->pos(), diffX, diffY, factor);
editMode.drag(event->position().toPoint(), diffX, diffY, factor);
}
else if (mDragMode != InteractionType_None)
{
EditMode& editMode = dynamic_cast<CSVRender::EditMode&>(*mEditMode->getCurrent());
if (mDragMode == InteractionType_PrimaryEdit)
mDragging = editMode.primaryEditStartDrag(event->pos());
mDragging = editMode.primaryEditStartDrag(event->position().toPoint());
else if (mDragMode == InteractionType_SecondaryEdit)
mDragging = editMode.secondaryEditStartDrag(event->pos());
mDragging = editMode.secondaryEditStartDrag(event->position().toPoint());
else if (mDragMode == InteractionType_PrimarySelect)
mDragging = editMode.primarySelectStartDrag(event->pos());
mDragging = editMode.primarySelectStartDrag(event->position().toPoint());
else if (mDragMode == InteractionType_SecondarySelect)
mDragging = editMode.secondarySelectStartDrag(event->pos());
mDragging = editMode.secondarySelectStartDrag(event->position().toPoint());
if (mDragging)
{
mDragX = event->localPos().x();
mDragY = height() - event->localPos().y();
mDragX = event->position().x();
mDragY = height() - event->position().y();
}
}
else
{
if (event->globalPos() != mToolTipPos)
if (event->globalPosition().toPoint() != mToolTipPos)
{
mToolTipPos = event->globalPos();
mToolTipPos = event->globalPosition().toPoint();
if (mShowToolTips)
{

View File

@ -260,8 +260,6 @@ namespace CSVRender
void settingChanged(const CSMPrefs::Setting* setting) override;
bool getSpeedMode();
void cycleNavigationMode();
private:

View File

@ -93,7 +93,7 @@ void CSVTools::ReportTable::contextMenuEvent(QContextMenuEvent* event)
void CSVTools::ReportTable::mouseMoveEvent(QMouseEvent* event)
{
if (event->buttons() & Qt::LeftButton)
startDragFromTable(*this, indexAt(event->pos()));
startDragFromTable(*this, indexAt(event->position().toPoint()));
}
void CSVTools::ReportTable::mouseDoubleClickEvent(QMouseEvent* event)

View File

@ -52,7 +52,7 @@ void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent* event)
// If the mouse is pressed above the pop-up parent,
// the pop-up will be hidden and the pressed signal won't be repeated for the parent
if (buttonRect.contains(event->globalPos()) || buttonRect.contains(event->pos()))
if (buttonRect.contains(event->globalPosition().toPoint()) || buttonRect.contains(event->position().toPoint()))
{
setAttribute(Qt::WA_NoMouseReplay);
}

View File

@ -22,12 +22,8 @@ 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);
QAbstractItemDelegate* delegate = itemDelegateForIndex(index);
return delegate->sizeHint(option, index).height();
}

View File

@ -85,7 +85,7 @@ void CSVWorld::NotEditableSubDelegate::setEditorData(QWidget* editor, const QMod
CSMWorld::Columns::ColumnId columnId
= static_cast<CSMWorld::Columns::ColumnId>(mTable->getColumnId(index.column()));
if (QVariant::String == v.type())
if (QMetaType::QString == v.typeId())
{
label->setText(v.toString());
}

View File

@ -55,7 +55,7 @@ void CSVWorld::DragRecordTable::dragEnterEvent(QDragEnterEvent* event)
void CSVWorld::DragRecordTable::dragMoveEvent(QDragMoveEvent* event)
{
QModelIndex index = indexAt(event->pos());
QModelIndex index = indexAt(event->position().toPoint());
if (CSVWorld::DragDropUtils::canAcceptData(*event, getIndexDisplayType(index))
|| CSVWorld::DragDropUtils::isInfo(*event, getIndexDisplayType(index))
|| CSVWorld::DragDropUtils::isTopicOrJournal(*event, getIndexDisplayType(index)))
@ -71,7 +71,7 @@ void CSVWorld::DragRecordTable::dragMoveEvent(QDragMoveEvent* event)
void CSVWorld::DragRecordTable::dropEvent(QDropEvent* event)
{
QModelIndex index = indexAt(event->pos());
QModelIndex index = indexAt(event->position().toPoint());
CSMWorld::ColumnBase::Display display = getIndexDisplayType(index);
if (CSVWorld::DragDropUtils::canAcceptData(*event, display))
{

View File

@ -341,7 +341,7 @@ void CSVWorld::RegionMap::viewInTable()
void CSVWorld::RegionMap::mouseMoveEvent(QMouseEvent* event)
{
startDragFromTable(*this, indexAt(event->pos()));
startDragFromTable(*this, indexAt(event->position().toPoint()));
}
std::vector<CSMWorld::UniversalId> CSVWorld::RegionMap::getDraggedRecords() const
@ -376,7 +376,7 @@ void CSVWorld::RegionMap::dragMoveEvent(QDragMoveEvent* event)
void CSVWorld::RegionMap::dropEvent(QDropEvent* event)
{
QModelIndex index = indexAt(event->pos());
QModelIndex index = indexAt(event->position().toPoint());
bool exists = QTableView::model()->data(index, Qt::BackgroundRole) != QBrush(Qt::DiagCrossPattern);
if (!index.isValid() || !exists)

View File

@ -136,7 +136,7 @@ void CSVWorld::ScriptEdit::dragEnterEvent(QDragEnterEvent* event)
QPlainTextEdit::dragEnterEvent(event);
else
{
setTextCursor(cursorForPosition(event->pos()));
setTextCursor(cursorForPosition(event->position().toPoint()));
event->acceptProposedAction();
}
}
@ -148,7 +148,7 @@ void CSVWorld::ScriptEdit::dragMoveEvent(QDragMoveEvent* event)
QPlainTextEdit::dragMoveEvent(event);
else
{
setTextCursor(cursorForPosition(event->pos()));
setTextCursor(cursorForPosition(event->position().toPoint()));
event->accept();
}
}
@ -162,7 +162,7 @@ void CSVWorld::ScriptEdit::dropEvent(QDropEvent* event)
return;
}
setTextCursor(cursorForPosition(event->pos()));
setTextCursor(cursorForPosition(event->position().toPoint()));
if (mime->fromDocument(mDocument))
{

View File

@ -592,7 +592,7 @@ void CSVWorld::Table::moveRecords(QDropEvent* event)
if (mEditLock || (mModel->getFeatures() & CSMWorld::IdTableBase::Feature_Constant))
return;
QModelIndex targedIndex = indexAt(event->pos());
QModelIndex targedIndex = indexAt(event->position().toPoint());
QModelIndexList selectedRows = selectionModel()->selectedRows();
int targetRowRaw = targedIndex.row();
@ -872,7 +872,7 @@ void CSVWorld::Table::mouseMoveEvent(QMouseEvent* event)
{
if (event->buttons() & Qt::LeftButton)
{
startDragFromTable(*this, indexAt(event->pos()));
startDragFromTable(*this, indexAt(event->position().toPoint()));
}
}

View File

@ -31,7 +31,7 @@ namespace CSVWorld
auto& clickEvent = static_cast<QMouseEvent&>(*event);
if ((clickEvent.button() == Qt::MiddleButton))
{
const auto& index = table.indexAt(clickEvent.pos());
const auto& index = table.indexAt(clickEvent.position().toPoint());
table.setColumnHidden(index.column(), true);
clickEvent.accept();
return true;

View File

@ -171,7 +171,7 @@ QWidget* CSVWorld::CommandDelegate::createEditor(
// TODO: Find a better solution?
if (display == CSMWorld::ColumnBase::Display_Boolean)
{
return QItemEditorFactory::defaultFactory()->createEditor(QVariant::Bool, parent);
return QItemEditorFactory::defaultFactory()->createEditor(QMetaType::Bool, parent);
}
// For tables the pop-up of the color editor should appear immediately after the editor creation
// (the third parameter of ColorEditor's constructor)
@ -362,11 +362,7 @@ 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);
}
}

View File

@ -25,11 +25,6 @@ namespace
Config::GameSettings::GameSettings(const Files::ConfigurationManager& cfg)
: mCfgMgr(cfg)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// this needs calling once so Qt can see its stream operators, which it needs when dragging and dropping
// it's automatic with Qt 6
qRegisterMetaTypeStreamOperators<SettingValue>("Config::SettingValue");
#endif
}
void Config::GameSettings::validatePaths()

View File

@ -14,11 +14,7 @@ namespace L10n
// Try to load OpenMW translations from resources folder first.
// If we loaded them, try to load Qt translations from both
// resources folder and default translations folder as well.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto qtPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
#else
auto qtPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
#endif
auto localPath = resourcesPath + "/translations";
if (AppTranslator.load(QLocale::system(), appName, "_", localPath)

View File

@ -3,20 +3,13 @@
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QTextCodec>
#endif
#include <QTextStream>
namespace Misc
{
inline void ensureUtf8Encoding(QTextStream& stream)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec(QTextCodec::codecForName("UTF-8"));
#else
stream.setEncoding(QStringConverter::Utf8);
#endif
}
}
#endif

View File

@ -17,11 +17,7 @@ set(OSGQT_SOURCE_FILES
add_library(${OSGQT_LIBRARY} STATIC ${OSGQT_SOURCE_FILES})
if (QT_VERSION_MAJOR VERSION_EQUAL 6)
target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL Qt::OpenGLWidgets)
else()
target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL)
endif()
target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL Qt::OpenGLWidgets)
link_directories(${CMAKE_CURRENT_BINARY_DIR})