[Qt4???] Re: [PATCH] Show branches from master document in branch inset dialog
Yuriy Skalko
yuriy.skalko at gmail.com
Fri Oct 7 16:20:34 UTC 2022
> Still, I am wondering why we insist on supporting Qt4 for 2.4.0 (especially considering that we will have to continue this game for 2+ years after that).
I join to your wondering. And here is the patch to at least clean
conditional code portions for Qt < 4.8.
Yuriy
-------------- next part --------------
From ba021353090922642e0e262db9afffd6d47e254c Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Fri, 7 Oct 2022 18:37:53 +0300
Subject: [PATCH] Remove conditional compilation portions for old Qt versions <
4.8
---
src/frontends/qt/FancyLineEdit.cpp | 4 ----
src/frontends/qt/GuiApplication.cpp | 2 --
src/frontends/qt/GuiDocument.cpp | 2 --
src/frontends/qt/GuiFontLoader.cpp | 13 -------------
src/frontends/qt/GuiFontMetrics.cpp | 4 ----
src/frontends/qt/GuiImage.cpp | 7 -------
src/frontends/qt/GuiPrefs.cpp | 4 ----
src/frontends/qt/GuiView.cpp | 6 ------
src/frontends/qt/Menus.cpp | 6 ++----
9 files changed, 2 insertions(+), 46 deletions(-)
diff --git a/src/frontends/qt/FancyLineEdit.cpp b/src/frontends/qt/FancyLineEdit.cpp
index b9874d2e89..443094c705 100644
--- a/src/frontends/qt/FancyLineEdit.cpp
+++ b/src/frontends/qt/FancyLineEdit.cpp
@@ -19,8 +19,6 @@
#include "GuiApplication.h"
#endif
-#if QT_VERSION >= 0x040600
-
#include <QEvent>
#include <QDebug>
#include <QString>
@@ -381,6 +379,4 @@ void IconButton::animateShow(bool visible)
} // namespace lyx
-#endif // QT_VERSION >= 0x040600
-
#include "moc_FancyLineEdit.cpp"
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index ff33065fe3..57293d4b84 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -719,7 +719,6 @@ QPixmap getPixmap(QString const & path, QString const & name, QString const & ex
QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl)
{
-#if (QT_VERSION >= 0x040600)
if (lyxrc.use_system_theme_icons) {
// use the icons from system theme that are available
QString action = toqstr(lyxaction.getActionName(f.action()));
@@ -732,7 +731,6 @@ QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl)
return thmicn;
}
}
-#endif
IconInfo icondata = iconInfo(f, unknown, rtl);
if (icondata.filepath.isEmpty())
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index b3f31302dd..27cc39a775 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -1795,9 +1795,7 @@ GuiDocument::GuiDocument(GuiView & lv)
docPS->setCurrentPanel("Document Class");
// FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm)
-#if QT_VERSION >= 0x040200
docPS->updateGeometry();
-#endif
}
diff --git a/src/frontends/qt/GuiFontLoader.cpp b/src/frontends/qt/GuiFontLoader.cpp
index a47e555092..5ff54108bb 100644
--- a/src/frontends/qt/GuiFontLoader.cpp
+++ b/src/frontends/qt/GuiFontLoader.cpp
@@ -190,9 +190,7 @@ static bool isChosenFont(QFont & font, QString const & family,
LYXERR_NOPOS(Debug::FONT, "got: " << fi.family());
if (fi.family().contains(family)
-#if QT_VERSION >= 0x040800
&& (style.isEmpty() || fi.styleName().contains(style))
-#endif
) {
LYXERR_NOENDL(Debug::FONT, " got it ");
return true;
@@ -220,7 +218,6 @@ QFont symbolFont(QString const & family, bool * ok)
font.setFamily(family);
}
font.setStyleStrategy(QFont::NoFontMerging);
-#if QT_VERSION >= 0x040800
font.setStyleName("LyX");
if (isChosenFont(font, family, "LyX")) {
@@ -231,7 +228,6 @@ QFont symbolFont(QString const & family, bool * ok)
LYXERR_NOENDL(Debug::FONT, "Trying normal " << family << " ... ");
font.setStyleName(QString());
-#endif
if (isChosenFont(font, family, QString())) {
LYXERR_NOPOS(Debug::FONT, "normal!");
@@ -336,15 +332,6 @@ QFont makeQFont(FontInfo const & f)
QString family = makeFontName(toqstr(lyxrc.roman_font_name),
toqstr(lyxrc.roman_font_foundry));
font.setFamily(family);
-#ifdef Q_OS_MAC
-#if QT_VERSION >= 0x040300 //&& QT_VERSION < 0x040800
- // Workaround for a Qt bug, see http://www.lyx.org/trac/ticket/3684
- // and http://bugreports.qt.nokia.com/browse/QTBUG-11145.
- // FIXME: Check whether this is really fixed in Qt 4.8
- if (family == "Times" && !font.exactMatch())
- font.setFamily("Times New Roman");
-#endif
-#endif
break;
}
case SANS_FAMILY:
diff --git a/src/frontends/qt/GuiFontMetrics.cpp b/src/frontends/qt/GuiFontMetrics.cpp
index 54d5fbd2ea..71886433ae 100644
--- a/src/frontends/qt/GuiFontMetrics.cpp
+++ b/src/frontends/qt/GuiFontMetrics.cpp
@@ -292,11 +292,7 @@ int GuiFontMetrics::width(docstring const & s) const
*/
int w = 0;
// is the string a single character from a math font ?
-#if QT_VERSION >= 0x040800
bool const math_char = s.length() == 1 && font_.styleName() == "LyX";
-#else
- bool const math_char = s.length() == 1;
-#endif
if (math_char) {
QString const qs = toqstr(s);
int br_width = metrics_.boundingRect(qs).width();
diff --git a/src/frontends/qt/GuiImage.cpp b/src/frontends/qt/GuiImage.cpp
index 6e4c0723a3..9c0b96eb0e 100644
--- a/src/frontends/qt/GuiImage.cpp
+++ b/src/frontends/qt/GuiImage.cpp
@@ -198,13 +198,6 @@ bool GuiImage::scale(Params const & params)
qreal scale = qreal(params.scale) / 100.0;
#endif
-#if (QT_VERSION >= 0x040500) && (QT_VERSION <= 0x040502)
- // Due to a bug in Qt, LyX will crash for certain
- // scaling factors and sizes of the image.
- // see bug #5957: http://www.lyx.org/trac/ticket/5957
- scale += 0.0001;
-#endif
-
QTransform m;
m.scale(scale, scale);
// Bilinear filtering is used to scale graphics preview
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 5fa3b940d4..9611b7bfcb 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -2634,11 +2634,9 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
iconSetCO->addItem(qt_("Classic"), "classic");
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
-#if QT_VERSION >= 0x040600
if (guiApp->platformName() != "qt4x11"
&& guiApp->platformName() != "xcb"
&& !guiApp->platformName().contains("wayland"))
-#endif
useSystemThemeIconsCB->hide();
}
@@ -3572,9 +3570,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
prefsPS->setCurrentPanel("User Interface");
// FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm)
-#if QT_VERSION >= 0x040200
prefsPS->updateGeometry();
-#endif
bc().setPolicy(ButtonPolicy::PreferencesPolicy);
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 24d6703e30..d4d719199e 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -606,16 +606,10 @@ GuiView::GuiView(int id)
setAttribute(Qt::WA_DeleteOnClose, true);
#if !(defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && !defined(Q_OS_MAC)
- // QIcon::fromTheme was introduced in Qt 4.6
-#if (QT_VERSION >= 0x040600)
// assign an icon to main form. We do not do it under Qt/Win or Qt/Mac,
// since the icon is provided in the application bundle. We use a themed
// version when available and use the bundled one as fallback.
setWindowIcon(QIcon::fromTheme("lyx", getPixmap("images/", "lyx", "svg,png")));
-#else
- setWindowIcon(getPixmap("images/", "lyx", "svg,png"));
-#endif
-
#endif
resetWindowTitle();
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 6b0c12b821..d6b63d7d94 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -77,9 +77,7 @@
#include <QList>
#include <QMenuBar>
#include <QString>
-#if QT_VERSION >= 0x040600
#include <QProxyStyle>
-#endif
#include <algorithm>
#include <memory>
@@ -2146,7 +2144,7 @@ void Menu::Impl::populate(QMenu * qMenu, MenuDefinition const & menu)
}
}
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && (QT_VERSION >= 0x040600)
+#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN))
class AlwaysMnemonicStyle : public QProxyStyle {
public:
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
@@ -2166,7 +2164,7 @@ public:
Menu::Menu(GuiView * gv, QString const & name, bool top_level, bool keyboard)
: QMenu(gv), d(new Menu::Impl)
{
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && (QT_VERSION >= 0x040600)
+#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN))
if (keyboard)
setStyle(new AlwaysMnemonicStyle);
#else
--
2.28.0.windows.1
More information about the lyx-devel
mailing list