chore!: drop Qt version lower than 5.15.2

This commit is contained in:
Gary Wang 2023-05-21 00:36:24 +08:00
parent 235e50439f
commit 5aeb0f821f
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
4 changed files with 6 additions and 48 deletions

View File

@ -3,32 +3,6 @@ name: Ubuntu CI
on: [push, pull_request]
jobs:
ubuntu-20-04-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Get build dept.
run: |
sudo apt update
sudo apt install cmake qtbase5-dev libqt5svg5-dev qttools5-dev libexiv2-dev
- name: Build it
run: |
mkdir build
cd build
cmake ../
make
cpack -G DEB
- name: Try install it
run: |
cd build
sudo apt install ./*.deb
- uses: actions/upload-artifact@v3
with:
name: ubuntu-20.04-deb-package
path: build/*.deb
ubuntu-22-04-build:
runs-on: ubuntu-22.04

View File

@ -24,7 +24,7 @@ else ()
endif ()
if (${QT_VERSION_MAJOR} EQUAL "5")
set (QT_MINIMUM_VERSION "5.10")
set (QT_MINIMUM_VERSION "5.15.2")
else ()
set (QT_MINIMUM_VERSION "6.4")
endif ()
@ -102,12 +102,7 @@ set (EXE_NAME ppic)
file (GLOB PPIC_TS_FILES app/translations/*.ts)
set (PPIC_CPP_FILES_FOR_I18N ${PPIC_CPP_FILES})
if (${QT_VERSION_MAJOR} EQUAL "5")
# TODO: remove this when we lift our Qt5 minimum version to Qt 5.15
qt5_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
else ()
qt_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
endif ()
qt_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
if (WIN32)
list(APPEND PPIC_RC_FILES assets/pineapple-pictures.rc)
@ -140,9 +135,9 @@ if (LibExiv2_FOUND)
)
endif ()
if (Qt5DBus_FOUND)
if (Qt5DBus_FOUND OR Qt6DBus_FOUND)
target_link_libraries (${EXE_NAME}
Qt5::DBus
Qt${QT_VERSION_MAJOR}::DBus
)
target_compile_definitions(${EXE_NAME} PRIVATE
HAVE_QTDBUS

View File

@ -13,13 +13,6 @@
#include <QImageReader>
#include <QStyleOptionGraphicsItem>
// TODO: remove this once we drop older Qt support.
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
#define COMPAT_CONSTCOLOR constexpr
#else
#define COMPAT_CONSTCOLOR const
#endif
GraphicsView::GraphicsView(QWidget *parent)
: QGraphicsView (parent)
{
@ -387,8 +380,8 @@ void GraphicsView::setCheckerboardEnabled(bool enabled, bool invertColor)
QPixmap tilePixmap(0x20, 0x20);
tilePixmap.fill(invertColor ? QColor(220, 220, 220, 170) : QColor(35, 35, 35, 170));
QPainter tilePainter(&tilePixmap);
COMPAT_CONSTCOLOR QColor color(45, 45, 45, 170);
COMPAT_CONSTCOLOR QColor invertedColor(210, 210, 210, 170);
constexpr QColor color(45, 45, 45, 170);
constexpr QColor invertedColor(210, 210, 210, 170);
tilePainter.fillRect(0, 0, 0x10, 0x10, invertColor ? invertedColor : color);
tilePainter.fillRect(0x10, 0x10, 0x10, 0x10, invertColor ? invertedColor : color);
tilePainter.end();

View File

@ -309,13 +309,9 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
void MainWindow::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton && m_clickedOnWindow && !isMaximized()) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (!window()->windowHandle()->startSystemMove()) {
move(event->globalPos() - m_oldMousePos);
}
#else
move(event->globalPos() - m_oldMousePos);
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
event->accept();
}