Compare commits

...

10 Commits

Author SHA1 Message Date
Kornel Benko
c5d6f2eae9 Amend d86dbf66 and 159e8f2d for cmake build. 2024-11-04 20:18:14 +01:00
Richard Kimberly Heck
e1bbb57f62 Fix copy and paste error 2024-11-04 13:37:02 -05:00
Jean-Marc Lasgouttes
8c43a134fd With Qt 5.9, we need to include <functional>
Also remove 'using' statements (to be avoided in header files) and
refer to std::xxx instead of lyx:xxx.
2024-11-04 18:25:31 +01:00
Jean-Marc Lasgouttes
d86dbf6675 LYX_BEGIN_MUTE_GCC_WARNING: disable for gcc <= 7
I do not know until which version gcc has complained when trying to
mute a warning that it does not support. Recent versions do not do
that.

For now let's just do gcc 7, the limit should be higher.
2024-11-04 17:40:15 +01:00
Jean-Marc Lasgouttes
159e8f2dde Re-instate support for Qt 5.9.4
It was a bit overkill to require support for Qt 5.12 at 6ba2b5c5 and
c39d5b76. Revert partly these commits.
2024-11-04 17:22:21 +01:00
Scott Kostyshak
0bd1951184 ctests: update log 2024-11-04 13:43:35 +01:00
Juergen Spitzmueller
3a040ecdf1 Merge branch 'master' of git.lyx.org:lyx 2024-11-04 12:07:12 +01:00
Juergen Spitzmueller
7e161a9d5d Fix endless loop in lyx2lyx reversion routine 2024-11-04 12:06:18 +01:00
Jean-Marc Lasgouttes
2c694ccc2b Fix search for a good c++ compiler
Bash evaluates "c++{17,14}" as "c++17 c++14", but "c++-{17}" as "c++{17}".
2024-11-04 12:01:18 +01:00
Scott Kostyshak
1ef2f135d2 ctests: update log 2024-11-04 10:40:53 +01:00
20 changed files with 113 additions and 31 deletions

View File

@ -77,7 +77,7 @@ if(NOT help AND NOT HELP)
# 'project' triggers the searching for a compiler
project(${LYX_PROJECT})
if (CMAKE_COMPILER_IS_GNUCXX)
set(MIN_GCC_VERSION "5.1")
set(MIN_GCC_VERSION "7.1")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MIN_GCC_VERSION})
message(STATUS "Gnu CXX compiler version = ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "is too old, should be >= ${MIN_GCC_VERSION}")
@ -659,7 +659,7 @@ else()
set(LYX_DEBUG ON)
endif()
set(min_qt5_version "5.12")
set(min_qt5_version "5.9.4")
if(LYX_USE_QT MATCHES "AUTO")
# try qt6 first
foreach(_mod Core Gui Widgets Concurrent Svg)

View File

@ -59,7 +59,7 @@ LyX makes great use of the C++ Standard Library. This means that gcc
users will have to install the relevant libstdc++ library to be able
to compile this version of LyX.
LyX requires Qt 5.12 and higher. It is also possible to compile
LyX requires Qt 5.9.4 or higher. It is also possible to compile
against Qt 6. The only special point to make is that you must ensure
that both LyX and the Qt libraries are compiled with the same C++
compiler.

2
README
View File

@ -90,7 +90,7 @@ What do I need to compile LyX from the source distribution?
but clang and MSVC are known to work too. As of LyX 2.5.0, you
need at least gcc 8.0.
* The Qt library, at least version 5.12. It is also possible to
* The Qt library, at least version 5.9.4. It is also possible to
compile with Qt 6.x.
Read the file "INSTALL" for more information on compiling.

View File

@ -232,7 +232,8 @@ AC_REQUIRE([AC_PROG_CXXCPP])
### We might want to force the C++ standard.
AC_ARG_ENABLE(cxx-mode,
AS_HELP_STRING([--enable-cxx-mode],[choose C++ standard (default: 17)]),,
[enable_cxx_mode={17}]
dnl put modes in curly braces if there are several of them (ex. {20,17}
[enable_cxx_mode=17]
)
AC_LANG_PUSH(C++)

View File

@ -147,7 +147,7 @@ AC_CHECK_HEADERS(magic.h,
### setup the qt frontend.
dnl The code below is not in a macro, because this would cause big
dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
QT_DO_IT_ALL([5.12.0])
QT_DO_IT_ALL([5.9.4])
AC_SUBST([FRONTENDS_SUBDIRS], [qt])
FRONTEND_INFO="${FRONTEND_INFO}\
Qt Frontend:\n\

View File

@ -129,3 +129,9 @@ Report : https://github.com/schlcht/microtype/issues/21
upstream: https://github.com/latex3/latex2e/issues/880
Fix : none yet
ctests : export/templates/Articles/Hebrew_Article_.*(dvi|pdf|pdf2|pdf3)
Report : Message-ID:<vjwr5fehwvule6jvommt4apgtpvw2eu4ovynjocwa33vab2x7i@2lu5ialnxxzy>
Report : Message-ID:<iio6hf66ujaelhvnneqivhfp22xtty4fcgzswtrugu5gzwq2og@hcvqozvwou2l>
ctests : (export/export/WrongDfnTagHandling_lyx23|export/examples/Welcome_lyx23)

View File

@ -14,6 +14,6 @@ AddToPreamble
EndPreamble
Float
Type figure
Type table
NumberWithin section
End

View File

@ -1044,9 +1044,10 @@ def revert_mathml_version(document):
# nothing to do
break
# remove XHTML header if using the new value, leave alone otherwise.
# reset XHTML header if using the new value, leave alone otherwise.
if "4" in document.header[i]:
document.header[i] = "\\html_math_output 0"
break
while True:
i = find_token(document.header, "\\docbook_mathml_version", 0)

View File

@ -287,7 +287,11 @@ void CategorizedCombo::Private::setFilter(QString const & s)
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
filter_ = s;
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
filterModel_->setFilterRegExp(charFilterRegExp(filter_));
#else
filterModel_->setFilterRegularExpression(charFilterRegExp(filter_));
#endif
countCategories();
// restore old selection

View File

@ -106,7 +106,9 @@
#include <QObject>
#include <QPainter>
#include <QPixmap>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator>
#endif
#include <QScreen>
#include <QSessionManager>
#include <QSettings>
@ -1136,7 +1138,12 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
#endif
setDesktopFileName(lyx_package);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
#else
qsrand(QDateTime::currentDateTime().toTime_t());
#endif
// Install LyX translator for missing Qt translations
installTranslator(&d->gui_trans_);

View File

@ -494,7 +494,13 @@ PreambleModule::PreambleModule(QWidget * parent)
checkFindButton();
int const tabStop = 4;
QFontMetrics metrics(preambleTE->currentFont());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
// horizontalAdvance() is available starting in 5.11.0
// setTabStopDistance() is available starting in 5.10.0
preambleTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
#else
preambleTE->setTabStopWidth(tabStop * metrics.width(' '));
#endif
}
@ -640,7 +646,13 @@ LocalLayout::LocalLayout(QWidget * parent)
connect(editPB, SIGNAL(clicked()), this, SLOT(editExternal()));
int const tabStop = 4;
QFontMetrics metrics(locallayoutTE->currentFont());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
// horizontalAdvance() is available starting in 5.11.0
// setTabStopDistance() is available starting in 5.10.0
locallayoutTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
#else
locallayoutTE->setTabStopWidth(tabStop * metrics.width(' '));
#endif
}
@ -2512,7 +2524,11 @@ void GuiDocument::updateQuoteStyles(bool const set)
for (int i = 0; i < langModule->quoteStyleCO->count(); ++i) {
langModule->quoteStyleCO->setItemData(i, QVariant(comboFont), Qt::FontRole);
QString str = langModule->quoteStyleCO->itemText(i);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
qswidth = max(qswidth, fm.horizontalAdvance(str));
#else
qswidth = max(qswidth, fm.width(str));
#endif
}
// add scrollbar width and margin to width
qswidth += langModule->quoteStyleCO->style()->pixelMetric(QStyle::PM_ScrollBarExtent);

View File

@ -283,7 +283,11 @@ int GuiFontMetrics::width(docstring const & s) const
if (math_char) {
QString const qs = toqstr(s);
int br_width = rbearing(s[0]);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
int s_width = metrics_.horizontalAdvance(qs);
#else
int s_width = metrics_.width(qs);
#endif
// keep value 0 for math chars with width 0
if (s_width != 0)
w = max(br_width, s_width);
@ -663,10 +667,17 @@ int GuiFontMetrics::width(char_type c) const
if (value != outOfLimitMetric)
return value;
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
if (is_utf16(c))
value = metrics_.horizontalAdvance(ucs4_to_qchar(c));
else
value = metrics_.horizontalAdvance(toqstr(docstring(1, c)));
#else
if (is_utf16(c))
value = metrics_.width(ucs4_to_qchar(c));
else
value = metrics_.width(toqstr(docstring(1, c)));
#endif
width_cache_.insert(c, value);

View File

@ -845,15 +845,25 @@ bool KeySymbol::operator==(KeySymbol const & ks) const
KeyModifier q_key_state(Qt::KeyboardModifiers state)
{
KeyModifier k = NoModifier;
#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))
/// Additional check for Control and Meta modifier swap state.
/// Starting with Qt 5 the modifiers aren't reported correctly.
/// Until this is fixed a correction is required.
/// AFAIK it is fixed at least with Qt 5.12.0
const bool dontSwapCtrlAndMeta =
frontend::theGuiApp()->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
#else
const bool dontSwapCtrlAndMeta = false;
#endif
if (state & Qt::ControlModifier)
if (state & (dontSwapCtrlAndMeta ? Qt::MetaModifier : Qt::ControlModifier))
k |= ControlModifier;
if (state & Qt::ShiftModifier)
k |= ShiftModifier;
if (state & Qt::AltModifier)
k |= AltModifier;
#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
if (state & Qt::MetaModifier)
if (state & (dontSwapCtrlAndMeta ? Qt::ControlModifier : Qt::MetaModifier))
k |= MetaModifier;
#else
if (state & Qt::MetaModifier)

View File

@ -665,7 +665,11 @@ GuiView::GuiView(int id)
connect(stat_counts_, SIGNAL(clicked()), this, SLOT(statsPressed()));
zoom_slider_ = new QSlider(Qt::Horizontal, statusBar());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
zoom_slider_->setFixedWidth(fm.horizontalAdvance('x') * 15);
#else
zoom_slider_->setFixedWidth(fm.width('x') * 15);
#endif
// Make the defaultZoom center
zoom_slider_->setRange(10, (lyxrc.defaultZoom * 2) - 10);
// Initialize proper zoom value
@ -678,7 +682,11 @@ GuiView::GuiView(int id)
zoom_slider_->setToolTip(qt_("Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust."));
// Buttons to change zoom stepwise
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
QSize s(fm.horizontalAdvance('+'), fm.height());
#else
QSize s(fm.width('+'), fm.height());
#endif
zoom_in_ = new GuiClickableLabel(statusBar());
zoom_in_->setText("+");
zoom_in_->setFixedSize(s);
@ -718,7 +726,11 @@ GuiView::GuiView(int id)
// zoom_value_->setPalette(palette);
zoom_value_->setForegroundRole(statusBar()->foregroundRole());
zoom_value_->setFixedHeight(fm.height());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
zoom_value_->setMinimumWidth(fm.horizontalAdvance("444\%"));
#else
zoom_value_->setMinimumWidth(fm.width("444\%"));
#endif
zoom_value_->setAlignment(Qt::AlignCenter);
zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), zoom)));
statusBar()->addPermanentWidget(zoom_value_);

View File

@ -774,7 +774,8 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
#endif
q_button_state(e->button()), q_key_state(e->modifiers()));
#if QT_VERSION < QT_VERSION_CHECK(5,15,1)
#if (QT_VERSION > QT_VERSION_CHECK(5,10,1) && \
QT_VERSION < QT_VERSION_CHECK(5,15,1))
d->synthetic_mouse_event_.cmd = cmd; // QtBug QAbstractScrollArea::mouseMoveEvent
#endif
d->dispatch(cmd);
@ -784,7 +785,8 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
void GuiWorkArea::mouseMoveEvent(QMouseEvent * e)
{
#if QT_VERSION < QT_VERSION_CHECK(5,15,1)
#if (QT_VERSION > QT_VERSION_CHECK(5,10,1) && \
QT_VERSION < QT_VERSION_CHECK(5,15,1))
// cancel the event if the coordinates didn't change, this is due to QtBug
// QAbstractScrollArea::mouseMoveEvent, the event is triggered falsely when quickly
// double tapping a touchpad. To test: try to select a word by quickly double tapping

View File

@ -16,11 +16,9 @@
#include <QObject>
#include <QWaitCondition>
namespace lyx {
#include <functional>
using std::function;
using std::ref;
using std::bind;
namespace lyx {
namespace frontend {
@ -68,25 +66,25 @@ public:
template<class F, class P1>
R call(F f, P1& p1)
{
return call(lyx::bind(f, lyx::ref(p1)));
return call(std::bind(f, std::ref(p1)));
}
template<class F, class P1, class P2>
R call(F f, P1& p1, P2& p2)
{
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2)));
return call(std::bind(f, std::ref(p1), std::ref(p2)));
}
template<class F, class P1, class P2, class P3>
R call(F f, P1& p1, P2& p2, P3& p3)
{
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3)));
return call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3)));
}
template<class F, class P1, class P2, class P3, class P4>
R call(F f, P1& p1, P2& p2, P3& p3, P4& p4)
{
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4)));
return call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4)));
}
/*
@ -96,8 +94,8 @@ public:
template<class F, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
R call(F f, P1& p1, P2& p2, P3& p3, P4& p4, P5& p5, P6& p6, P7& p7, P8& p8)
{
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4),
lyx::ref(p5), lyx::ref(p6), lyx::ref(p7), lyx::ref(p8)));
return call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4),
std::ref(p5), std::ref(p6), std::ref(p7), std::ref(p8)));
}
private:
@ -109,7 +107,7 @@ private:
private:
R return_value_;
function<R()> func_;
std::function<R()> func_;
};
@ -131,25 +129,25 @@ public:
template<class F, class P1>
void call(F f, P1& p1)
{
call(lyx::bind(f, lyx::ref(p1)));
call(std::bind(f, std::ref(p1)));
}
template<class F, class P1, class P2>
void call(F f, P1& p1, P2& p2)
{
call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2)));
call(std::bind(f, std::ref(p1), std::ref(p2)));
}
template<class F, class P1, class P2, class P3>
void call(F f, P1& p1, P2& p2, P3& p3)
{
call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3)));
call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3)));
}
template<class F, class P1, class P2, class P3, class P4>
void call(F f, P1& p1, P2& p2, P3& p3, P4& p4)
{
call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4)));
call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4)));
}
/*
@ -159,8 +157,8 @@ public:
template<class F, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
void call(F f, P1& p1, P2& p2, P3& p3, P4& p4, P5& p5, P6& p6, P7& p7, P8& p8)
{
call(bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4), lyx::ref(p5),
lyx::ref(p6), lyx::ref(p7), lyx::ref(p8)));
call(bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4), std::ref(p5),
std::ref(p6), std::ref(p7), std::ref(p8)));
}
private:
@ -171,7 +169,7 @@ private:
}
private:
function<void()> func_;
std::function<void()> func_;
};

View File

@ -320,7 +320,11 @@ void LayoutBox::Private::setFilter(QString const & s)
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
filter_ = s;
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
filterModel_->setFilterRegExp(charFilterRegExp(filter_));
#else
filterModel_->setFilterRegularExpression(charFilterRegExp(filter_));
#endif
countCategories();
// restore old selection

View File

@ -769,7 +769,11 @@ QString formatToolTip(QString text, int width)
text = Qt::convertFromPlainText(text, Qt::WhiteSpaceNormal);
// Compute desired width in pixels
QFont const font = QToolTip::font();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
int const px_width = width * QFontMetrics(font).horizontalAdvance("M");
#else
int const px_width = width * QFontMetrics(font).width("M");
#endif
// Determine the ideal width of the tooltip
QTextDocument td("");
td.setHtml(text);

View File

@ -16,7 +16,9 @@
#include <QCoreApplication>
#include <QDateTime>
#include <QTimer>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator>
#endif
#include <string>
@ -39,7 +41,11 @@ public:
setOrganizationDomain("lyx.org");
setApplicationName(toqstr(app));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
#else
qsrand(QDateTime::currentDateTime().toTime_t());
#endif
}
int execute()
{

View File

@ -13,7 +13,7 @@
#ifndef LYX_MUTE_WARNING_H
#define LYX_MUTE_WARNING_H
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__GNUC__) && __GNUC__ > 7 && !defined(__clang__)
/* This macro can be used to stipulate that a given GCC warning is not
* relevant in a given block.
*