Drop Qt 5 support

This commit is contained in:
luisangelsm
2026-02-20 21:48:15 +01:00
parent 9e0974be12
commit 7218d0dc87
27 changed files with 56 additions and 285 deletions

View File

@ -45,16 +45,13 @@ macx {
CONFIG += objective_c
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
lessThan(QT_MAJOR_VERSION, 6): QT += macextras
}
QT += network widgets core multimedia svg
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
QT += core5compat
greaterThan(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 6) {
QT += gui-private
}
greaterThan(QT_MINOR_VERSION, 6): QT += gui-private
#CONFIG += release
CONFIG -= flat

View File

@ -99,9 +99,7 @@ int main(int argc, char *argv[])
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QImageReader::setAllocationLimit(0);
#endif
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
@ -131,16 +129,10 @@ int main(int argc, char *argv[])
QCommandLineOption comicId("comicId", "", "comicId");
QCommandLineOption libraryId("libraryId", "", "libraryId");
QCommandLineOption readingListId("readingListId", "", "readingListId");
// hide comicId and libraryId from help
#if QT_VERSION >= 0x050800
// hide comicId and libraryId from help
comicId.setFlags(QCommandLineOption::HiddenFromHelp);
libraryId.setFlags(QCommandLineOption::HiddenFromHelp);
readingListId.setFlags(QCommandLineOption::HiddenFromHelp);
#else
comicId.setHidden(true);
libraryId.setHidden(true);
readingListId.setHidden(true);
#endif
// process
parser.addOption(comicId);

View File

@ -480,9 +480,7 @@ void MainWindowViewer::createToolBars()
{
#ifdef Y_MAC_UI
comicToolBar = new YACReaderMacOSXToolbar(this);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
comicToolBar->setIconSize(QSize(18, 18));
#endif
#else
comicToolBar = addToolBar(tr("&File"));
#endif
@ -1354,7 +1352,7 @@ void MainWindowViewer::toggleFitToWidthSlider()
if (zoomSliderAction->isVisible()) {
zoomSliderAction->hide();
} else {
#if defined(Y_MAC_UI) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#ifdef Y_MAC_UI
zoomSliderAction->move((this->width() - zoomSliderAction->width()) / 2, y);
#else
zoomSliderAction->move(250, y);

View File

@ -19,11 +19,7 @@ void YACReader::MouseHandler::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
viewer->drag = true;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto position = event->position();
#else
auto position = QPointF(event->x(), event->y());
#endif
dragOrigin = dragLatestPosition = position;
viewer->setCursor(Qt::ClosedHandCursor);
event->accept();
@ -53,11 +49,7 @@ void YACReader::MouseHandler::mouseReleaseEvent(QMouseEvent *event)
event->accept();
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto position = event->position();
#else
auto position = QPointF(event->x(), event->y());
#endif
auto dragDistance = QLineF(position, dragOrigin).length();
auto mouseMode = Configuration::getConfiguration().getMouseMode();
@ -104,11 +96,7 @@ void YACReader::MouseHandler::mouseMoveEvent(QMouseEvent *event)
viewer->showCursor();
viewer->hideCursorTimer->start(2500);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto position = event->position();
#else
auto position = QPointF(event->x(), event->y());
#endif
if (viewer->magnifyingGlassShown)
viewer->mglass->move(static_cast<int>(position.x() - float(viewer->mglass->width()) / 2), static_cast<int>(position.y() - float(viewer->mglass->height()) / 2));

View File

@ -1,11 +1,6 @@
#include <QUrl>
#if QT_VERSION >= 0x050000
#include <QMediaPlayer>
#else
#include <Phonon/MediaObject>
#include <Phonon/MediaSource>
#endif
#include <QPushButton>
#include <QPalette>
@ -160,12 +155,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
connect(speakButton, &QAbstractButton::pressed, this, &YACReaderTranslator::play);
connect(clearButton, &QAbstractButton::pressed, this, &YACReaderTranslator::clear);
// multimedia/phonon
#if QT_VERSION >= 0x050000
player = new QMediaPlayer;
#else
music = createPlayer(MusicCategory);
#endif
}
void YACReaderTranslator::hideResults()
@ -288,11 +278,7 @@ void YACReaderTranslator::populateCombos()
void YACReaderTranslator::play()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
player->setSource(ttsSource);
#else
player->setMedia(ttsSource);
#endif
player->play();
}

View File

@ -759,11 +759,7 @@ void Viewer::resizeEvent(QResizeEvent *event)
QPixmap Viewer::pixmap() const
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return content->pixmap();
#else
return content->pixmap(Qt::ReturnByValue);
#endif
}
void Viewer::magnifyingGlassSwitch()