From 5c8e3a5f0d637974a0ac321d1f729c5ead2c1717 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 18 Aug 2023 09:04:12 +0200 Subject: [PATCH] Remove Qt < 5.2 conditionals and special code We require Qt 5.2 at least for LyX 2.4 --- src/frontends/qt/FancyLineEdit.cpp | 4 - src/frontends/qt/GuiApplication.cpp | 17 +--- src/frontends/qt/GuiApplication.h | 2 - src/frontends/qt/GuiFontMetrics.cpp | 4 - src/frontends/qt/GuiProgress.cpp | 32 -------- src/frontends/qt/GuiView.cpp | 2 - src/frontends/qt/GuiWorkArea.cpp | 2 - src/frontends/qt/Makefile.am | 1 - src/frontends/qt/ui/ToggleWarningUi.ui | 103 ------------------------- 9 files changed, 2 insertions(+), 165 deletions(-) delete mode 100644 src/frontends/qt/ui/ToggleWarningUi.ui diff --git a/src/frontends/qt/FancyLineEdit.cpp b/src/frontends/qt/FancyLineEdit.cpp index 570d6cce19..269a717ed4 100644 --- a/src/frontends/qt/FancyLineEdit.cpp +++ b/src/frontends/qt/FancyLineEdit.cpp @@ -15,10 +15,6 @@ #include "FancyLineEdit.h" -#if QT_VERSION < 0x050200 -#include "GuiApplication.h" -#endif - #include #include #include diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp index 165d14081d..a2372429f3 100644 --- a/src/frontends/qt/GuiApplication.cpp +++ b/src/frontends/qt/GuiApplication.cpp @@ -1028,10 +1028,7 @@ public: struct GuiApplication::Private { Private(): language_model_(nullptr), meta_fake_bit(NoModifier), - global_menubar_(nullptr) - #if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) - , last_state_(Qt::ApplicationInactive) - #endif + global_menubar_(nullptr), last_state_(Qt::ApplicationInactive) { #if (QT_VERSION >= 0x050400) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) @@ -1112,10 +1109,8 @@ struct GuiApplication::Private /// Only used on mac. QMenuBar * global_menubar_; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) /// Holds previous application state on Mac Qt::ApplicationState last_state_; -#endif #if defined(Q_OS_MAC) && (QT_VERSION < 0x060000) /// Linkback mime handler for MacOSX. @@ -1156,7 +1151,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv) QCoreApplication::setOrganizationName(app_name); QCoreApplication::setOrganizationDomain("lyx.org"); QCoreApplication::setApplicationName(lyx_package); -#if QT_VERSION >= 0x050100 && QT_VERSION < 0x060000 +#if QT_VERSION < 0x060000 QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif @@ -1195,11 +1190,9 @@ GuiApplication::GuiApplication(int & argc, char ** argv) setupApplescript(); appleCleanupEditMenu(); appleCleanupViewMenu(); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onApplicationStateChanged(Qt::ApplicationState))); #endif -#endif #if defined(QPA_XCB) // doubleClickInterval() is 400 ms on X11 which is just too long. @@ -2954,11 +2947,7 @@ namespace { QFont const GuiApplication::typewriterSystemFont() { -#if QT_VERSION >= 0x050200 QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont); -#else - QFont font("monospace"); -#endif if (!isFixedPitch(font)) { // try to enforce a real monospaced font font.setStyleHint(QFont::Monospace); @@ -3452,7 +3441,6 @@ void GuiApplication::onLastWindowClosed() } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) void GuiApplication::onApplicationStateChanged(Qt::ApplicationState state) { std::string name = "unknown"; @@ -3479,7 +3467,6 @@ void GuiApplication::onApplicationStateChanged(Qt::ApplicationState state) LYXERR(Debug::GUI, "onApplicationStateChanged..." << name); d->last_state_ = state; } -#endif void GuiApplication::startLongOperation() { diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h index 3eab5ecd77..a77b0c7b7e 100644 --- a/src/frontends/qt/GuiApplication.h +++ b/src/frontends/qt/GuiApplication.h @@ -226,9 +226,7 @@ private Q_SLOTS: /// void slotProcessFuncRequestQueue() { processFuncRequestQueue(); } /// -#if (QT_VERSION >= 0x050100) void onApplicationStateChanged(Qt::ApplicationState state); -#endif private: /// diff --git a/src/frontends/qt/GuiFontMetrics.cpp b/src/frontends/qt/GuiFontMetrics.cpp index 0e69ffd998..631aecc062 100644 --- a/src/frontends/qt/GuiFontMetrics.cpp +++ b/src/frontends/qt/GuiFontMetrics.cpp @@ -30,11 +30,7 @@ #include #include -#if QT_VERSION >= 0x050100 #include -#else -#define qDegreesToRadians(degree) (degree) * (M_PI / 180) -#endif using namespace std; using namespace lyx::support; diff --git a/src/frontends/qt/GuiProgress.cpp b/src/frontends/qt/GuiProgress.cpp index a21baf338c..80ba8aecf8 100644 --- a/src/frontends/qt/GuiProgress.cpp +++ b/src/frontends/qt/GuiProgress.cpp @@ -32,22 +32,6 @@ namespace lyx { namespace frontend { -// This dialog is only a fallback for Qt < 5.2, which does not feature -// QMessageBox::setCheckBox() yet. Note that it has issues with line -// breaking and size, in particular with html. -#if QT_VERSION < 0x050200 -class GuiToggleWarningDialog : public QDialog, public Ui::ToggleWarningUi -{ -public: - GuiToggleWarningDialog(QWidget * parent) : QDialog(parent) - { - Ui::ToggleWarningUi::setupUi(this); - QDialog::setModal(true); - } -}; -#endif - - GuiProgress::GuiProgress() { connect(this, SIGNAL(processStarted(QString const &)), SLOT(doProcessStarted(QString const &))); @@ -174,21 +158,6 @@ void GuiProgress::doToggleWarning(QString const & title, QString const & msg, QS if (settings.value("hidden_warnings/" + msg, false).toBool()) return; -// Qt < 5.2 does not feature QMessageBox::setCheckBox() yet, -// so we roll our own dialog. -#if QT_VERSION < 0x050200 - GuiToggleWarningDialog * dlg = - new GuiToggleWarningDialog(qApp->focusWidget()); - - dlg->setWindowTitle(title); - dlg->messageLA->setText(formatted); - dlg->dontShowAgainCB->setChecked(false); - - if (dlg->exec() == QDialog::Accepted) - if (dlg->dontShowAgainCB->isChecked()) - settings.setValue("hidden_warnings/" - + msg, true); -#else QCheckBox * dontShowAgainCB = new QCheckBox(); dontShowAgainCB->setText(qt_("&Do not show this warning again!")); dontShowAgainCB->setToolTip(qt_("If you check this, LyX will not warn you again in the given case.")); @@ -199,7 +168,6 @@ void GuiProgress::doToggleWarning(QString const & title, QString const & msg, QS if (dontShowAgainCB->isChecked()) settings.setValue("hidden_warnings/" + msg, true); -#endif } diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index ddf7e8df85..2d8847e8d5 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -1122,11 +1122,9 @@ void GuiView::updateLockToolbars() if (tb && tb->isMovable()) toolbarsMovable_ = true; } -#if QT_VERSION >= 0x050200 // set unified mac toolbars only when not movable as recommended: // https://doc.qt.io/qt-5/qmainwindow.html#unifiedTitleAndToolBarOnMac-prop setUnifiedTitleAndToolBarOnMac(!toolbarsMovable_); -#endif } diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp index ef91e0b7fd..099b129bb7 100644 --- a/src/frontends/qt/GuiWorkArea.cpp +++ b/src/frontends/qt/GuiWorkArea.cpp @@ -1503,11 +1503,9 @@ TabWorkArea::TabWorkArea(QWidget * parent) QObject::connect(this, SIGNAL(currentChanged(int)), this, SLOT(on_currentTabChanged(int))); -#if QT_VERSION >= 0x050200 // Fix for #11835 QObject::connect(this, SIGNAL(tabBarClicked(int)), this, SLOT(on_currentTabChanged(int))); -#endif closeBufferButton = new QToolButton(this); closeBufferButton->setPalette(pal); diff --git a/src/frontends/qt/Makefile.am b/src/frontends/qt/Makefile.am index 9ca258d9d3..c038e3f882 100644 --- a/src/frontends/qt/Makefile.am +++ b/src/frontends/qt/Makefile.am @@ -351,7 +351,6 @@ UIFILES = \ TextLayoutUi.ui \ ThesaurusUi.ui \ TocUi.ui \ - ToggleWarningUi.ui \ ViewSourceUi.ui \ VSpaceUi.ui \ WorkAreaUi.ui \ diff --git a/src/frontends/qt/ui/ToggleWarningUi.ui b/src/frontends/qt/ui/ToggleWarningUi.ui deleted file mode 100644 index 1b8b746591..0000000000 --- a/src/frontends/qt/ui/ToggleWarningUi.ui +++ /dev/null @@ -1,103 +0,0 @@ - - - ToggleWarningUi - - - - 0 - 0 - 269 - 140 - - - - Enter text - - - true - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 247 - 16 - - - - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 247 - 16 - - - - - - - - If you check this, LyX will not warn you again in the given case. - - - &Do not show this warning again! - - - - - - - QDialogButtonBox::Ok - - - true - - - - - - - qt_i18n.h - - - - - buttonBox - accepted() - ToggleWarningUi - accept() - - - 98 - 114 - - - 80 - 805 - - - - - -- 2.39.5