From cdfda816bdfff7cf181513ae6e091dac9e9e179e Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 19 Feb 2023 19:08:09 +0200 Subject: [PATCH 8/8] Qt5: Make Qt-5.15 the minimum requirement Drop compatibility code with older versions. See osdn #47290 Signed-off-by: Marko Lindqvist --- INSTALL | 4 +-- client/gui-qt/citydlg.cpp | 64 ++++++++++++------------------------- client/gui-qt/fc_client.cpp | 3 +- client/gui-qt/hudwidget.cpp | 4 +-- client/gui-qt/pages.cpp | 5 --- doc/README.packaging | 1 + m4/qt5.m4 | 6 ++-- meson.build | 8 ++--- 8 files changed, 34 insertions(+), 61 deletions(-) diff --git a/INSTALL b/INSTALL index ef196f8be1..498729e97e 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Installing Freeciv: This file describes how to compile and install Freeciv. Last time we made sure this file is up to date was 16-Jul-06. -Last minor update was 24-Dec-22. +Last minor update was 19-Feb-23. There may be a localized version of this file in the ./doc directory, named INSTALL. (e.g., INSTALL.de). @@ -346,7 +346,7 @@ following order: pkg-config, Glib, Atk, Pango, Gdk-Pixbuf, Gtk. At least version 6.0 is required. If one configures with Qt5 compatibility switch --with-qtver=qt5, required libraries and headers are Qt5Core, Qt5Gui, and Qt5Widgets - and at least version 5.11 of Qt is required. + and at least version 5.15 of Qt is required. 2. Generating Makefiles diff --git a/client/gui-qt/citydlg.cpp b/client/gui-qt/citydlg.cpp index 1cc68cc0c1..080830d59e 100644 --- a/client/gui-qt/citydlg.cpp +++ b/client/gui-qt/citydlg.cpp @@ -538,19 +538,13 @@ void impr_info::wheelEvent(QWheelEvent *event) p = parentWidget()->parentWidget()->pos(); p = mapToGlobal(p); -#ifndef FC_QT5_MODE - QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), - event->angleDelta(), - event->buttons(), - event->modifiers(), - event->phase(), false, event->source()); -#else // FC_QT5_MODE + QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), event->angleDelta(), - event->angleDelta().y(), - Qt::Horizontal, event->buttons(), - event->modifiers(), event->phase(), event->source()); -#endif // FC_QT5_MODE + event->buttons(), + event->modifiers(), + event->phase(), false, event->source()); + QApplication::sendEvent(parentWidget(), &new_event); } @@ -595,19 +589,13 @@ void impr_item::wheelEvent(QWheelEvent *event) p = parentWidget()->parentWidget()->pos(); p = mapToGlobal(p); -#ifndef FC_QT5_MODE - QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), - event->angleDelta(), - event->buttons(), - event->modifiers(), - event->phase(), false, event->source()); -#else // FC_QT5_MODE + QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), event->angleDelta(), - event->angleDelta().y(), - Qt::Horizontal, event->buttons(), - event->modifiers(), event->phase(), event->source()); -#endif // FC_QT5_MODE + event->buttons(), + event->modifiers(), + event->phase(), false, event->source()); + QApplication::sendEvent(parentWidget()->parentWidget(), &new_event); } @@ -1009,19 +997,13 @@ void unit_item::wheelEvent(QWheelEvent *event) p = parentWidget()->parentWidget()->pos(); p = mapToGlobal(p); -#ifndef FC_QT5_MODE - QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), - event->angleDelta(), - event->buttons(), - event->modifiers(), - event->phase(), false, event->source()); -#else // FC_QT5_MODE + QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), event->angleDelta(), - event->angleDelta().y(), - Qt::Horizontal, event->buttons(), - event->modifiers(), event->phase(), event->source()); -#endif // FC_QT5_MODE + event->buttons(), + event->modifiers(), + event->phase(), false, event->source()); + QApplication::sendEvent(parentWidget()->parentWidget(), &new_event); } @@ -1097,19 +1079,13 @@ void unit_info::wheelEvent(QWheelEvent *event) p = parentWidget()->parentWidget()->pos(); p = mapToGlobal(p); -#ifndef FC_QT5_MODE - QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), - event->angleDelta(), - event->buttons(), - event->modifiers(), - event->phase(), false, event->source()); -#else // FC_QT5_MODE + QWheelEvent new_event(QPoint(5, 5), p + QPoint(5,5), event->pixelDelta(), event->angleDelta(), - event->angleDelta().y(), - Qt::Horizontal, event->buttons(), - event->modifiers(), event->phase(), event->source()); -#endif // FC_QT5_MODE + event->buttons(), + event->modifiers(), + event->phase(), false, event->source()); + QApplication::sendEvent(parentWidget(), &new_event); } diff --git a/client/gui-qt/fc_client.cpp b/client/gui-qt/fc_client.cpp index a4dd46e756..afb7681e4e 100644 --- a/client/gui-qt/fc_client.cpp +++ b/client/gui-qt/fc_client.cpp @@ -72,8 +72,9 @@ fc_client::fc_client() : QMainWindow() #ifdef FC_QT5_MODE QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); #endif // FC_QT5_MODE + /** - * Somehow freeciv-client-common asks to switch to page when all widgets + * Somehow client-common asks to switch to page when all widgets * haven't been created yet by Qt, even constructor finished job, * so we null all Qt objects, so while switching we will know if they * were created. diff --git a/client/gui-qt/hudwidget.cpp b/client/gui-qt/hudwidget.cpp index 60433dc79d..6a6ba3217e 100644 --- a/client/gui-qt/hudwidget.cpp +++ b/client/gui-qt/hudwidget.cpp @@ -1968,9 +1968,9 @@ void scale_widget::mousePressEvent(QMouseEvent *event) if (event->button() == Qt::LeftButton) { #ifndef FC_QT5_MODE if (event->position().x() <= size) { -#else /* FC_QT5_MODE */ +#else // FC_QT5_MODE if (event->localPos().x() <= size) { -#endif /* FC_QT5_MODE */ +#endif // FC_QT5_MODE scale = scale / 1.2; } else { scale = scale * 1.2; diff --git a/client/gui-qt/pages.cpp b/client/gui-qt/pages.cpp index 3e269d36e9..83fc667634 100644 --- a/client/gui-qt/pages.cpp +++ b/client/gui-qt/pages.cpp @@ -1362,15 +1362,10 @@ void fc_client::slot_selection_changed(const QItemSelection &selected, load_pix->setPixmap(*(new QPixmap)); } -#ifndef FC_QT5_MODE QPixmap pm = load_pix->pixmap(Qt::ReturnByValue); load_pix->setFixedSize(pm.width(), pm.height()); -#else // FC_QT5_MODE - load_pix->setFixedSize(load_pix->pixmap()->width(), - load_pix->pixmap()->height()); -#endif // FC_QT5_MODE if ((sf = secfile_load_section(fn_bytes.data(), "research", TRUE))) { diff --git a/doc/README.packaging b/doc/README.packaging index 67b07a1ade..44a462e258 100644 --- a/doc/README.packaging +++ b/doc/README.packaging @@ -17,6 +17,7 @@ Updating from 3.2 to 3.3 (e.g. ~/.freeciv/freeciv-client-rc-3.2 generated by Freeciv 3.2, ~/.freeciv-client-rc-3.1 generated by Freeciv 3.1, or ~/.civclientrc generated by Freeciv version <= 2.1). +* Minimum version of Qt is Qt-5.15, when building in Qt5-mode ---------------------------------------------------------------------- Compatibility of modified versions diff --git a/m4/qt5.m4 b/m4/qt5.m4 index 0ad30b96ff..8e7cf15eee 100644 --- a/m4/qt5.m4 +++ b/m4/qt5.m4 @@ -3,7 +3,7 @@ AC_DEFUN([FC_QT5], [ if test "x$fc_qt5_usable" = "x" ; then - FC_QT5_CPPFLAGS="-DQT_DISABLE_DEPRECATED_BEFORE=0x050b00" + FC_QT5_CPPFLAGS="-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00" case $host_os in darwin*) FC_QT5_DARWIN;; *) FC_QT5_GENERIC;; @@ -111,7 +111,7 @@ AC_DEFUN([FC_QT5_COMPILETEST], CPPFLAGS="$CPPFLAGS_SAVE" ]) -dnl Check if the included version of Qt is at least Qt5.11 +dnl Check if the included version of Qt is at least Qt5.15 dnl Output: fc_qt5_min_ver=yes|no AC_DEFUN([FC_QT5_VERSION_CHECK], [ @@ -123,7 +123,7 @@ AC_DEFUN([FC_QT5_VERSION_CHECK], LIBS="${LIBS}${LIBSADD}" AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]],[[ - #if QT_VERSION < 0x050b00 + #if QT_VERSION < 0x050f00 fail #endif ]])], diff --git a/meson.build b/meson.build index 3c25e0d0d5..811d8278af 100644 --- a/meson.build +++ b/meson.build @@ -594,7 +594,7 @@ if get_option('audio') or get_option('clients').contains('sdl2') endif if get_option('qtver') == 'qt5' - add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x050b00', language : 'cpp') + add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00', language : 'cpp') priv_conf_data.set('FC_QT5_MODE', 1) qt_opts = [] else @@ -2937,7 +2937,7 @@ if not qt_dep.found() if get_option('qtver') == 'qt6' error('Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found') else - error('Qt5 >= 5.11 required for qt-client in Qt5 mode, but not found') + error('Qt5 >= 5.15 required for qt-client in Qt5 mode, but not found') endif endif @@ -3450,7 +3450,7 @@ if not qt_dep.found() if get_option('qtver') == 'qt6' error('Qt6 >= 6.0 required for qt-modpack-installer in Qt6 mode, but not found') else - error('Qt5 >= 5.11 required for qt-modpack-installer in Qt5 mode, but not found') + error('Qt5 >= 5.15 required for qt-modpack-installer in Qt5 mode, but not found') endif endif @@ -3522,7 +3522,7 @@ if not qt_dep.found() if get_option('qtver') == 'qt6' error('Qt6 >= 6.0 required for ruledit in Qt6 mode, but not found') else - error('Qt5 >= 5.11 required for ruledit in Qt5 mode, but not found') + error('Qt5 >= 5.15 required for ruledit in Qt5 mode, but not found') endif endif -- 2.39.1