mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Compare commits
No commits in common. "29c4e4706e18a2346bd4135b1828ed8040b77c90" and "3f6eb9523d9bcdcd344d94589a5cfd457985733c" have entirely different histories.
29c4e4706e
...
3f6eb9523d
8
INSTALL
8
INSTALL
@ -59,10 +59,10 @@ 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
|
||||
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.
|
||||
For full LyX usability we suggest to use Qt 5.6 and higher, or at the
|
||||
very least Qt 5.4. 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.
|
||||
|
||||
To build LyX with spell checking capabilities included you have to
|
||||
install at least one of the development packages of the spell checker
|
||||
|
4
README
4
README
@ -90,8 +90,8 @@ 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
|
||||
compile with Qt 6.x.
|
||||
* The Qt library, at least version 5.2 (5.6 recommended). It is
|
||||
also possible to compile with Qt 6.x.
|
||||
|
||||
Read the file "INSTALL" for more information on compiling.
|
||||
|
||||
|
@ -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.0.0])
|
||||
AC_SUBST([FRONTENDS_SUBDIRS], [qt])
|
||||
FRONTEND_INFO="${FRONTEND_INFO}\
|
||||
Qt Frontend:\n\
|
||||
|
@ -28,7 +28,9 @@
|
||||
#include <QImage>
|
||||
#include <QFile>
|
||||
#include <QPainter>
|
||||
#if (QT_VERSION >= 0x050300)
|
||||
#include <QPdfWriter>
|
||||
#endif
|
||||
|
||||
|
||||
const char * basename(const char * name)
|
||||
@ -141,6 +143,7 @@ int main(int argc, char **argv)
|
||||
std::cerr << myname << ": Conversion of images to format '" << oformat << "' is not supported" << std::endl;
|
||||
return 4;
|
||||
} else if (NULL != oformat && !strcmp(oformat, "pdf")) {
|
||||
#if (QT_VERSION >= 0x050300)
|
||||
QSize size = img.size();
|
||||
QPdfWriter pdfwriter(QString::fromLocal8Bit(outfile));
|
||||
int dpi = pdfwriter.logicalDpiX();
|
||||
@ -151,6 +154,10 @@ int main(int argc, char **argv)
|
||||
QPainter painter(&pdfwriter);
|
||||
painter.drawImage(0, 0, img);
|
||||
painter.end();
|
||||
#else
|
||||
std::cerr << myname << ": Conversion of images to format '" << oformat << "' is not supported" << std::endl;
|
||||
return 4;
|
||||
#endif
|
||||
} else if (!img.save(QString::fromLocal8Bit(outfile), oformat)) {
|
||||
std::cerr << myname << ": Cannot save converted image to '" << outfile << "'" << std::endl;
|
||||
return 5;
|
||||
|
@ -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
|
||||
|
@ -59,7 +59,7 @@ static QString credits()
|
||||
out << qt_("Please install correctly to estimate the great\namount of work other people have done for the LyX project.");
|
||||
} else {
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
ts.setCodec("UTF-8");
|
||||
#endif
|
||||
QString line;
|
||||
@ -103,7 +103,7 @@ static QString release_notes()
|
||||
out << qt_("Please install correctly to see what has changed\nfor this version of LyX.");
|
||||
} else {
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
ts.setCodec("UTF-8");
|
||||
#endif
|
||||
QString line;
|
||||
@ -295,12 +295,14 @@ static QString version(bool const plain = false)
|
||||
out << '\n';
|
||||
else
|
||||
out << "</p><p>";
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
|
||||
out << toqstr(bformat(_("OS Version (run-time): %1$s"),
|
||||
qstring_to_ucs4(QSysInfo::prettyProductName())));
|
||||
if (plain)
|
||||
out << '\n';
|
||||
else
|
||||
out << "</p><p>";
|
||||
#endif
|
||||
out << toqstr(bformat(_("Python detected: %1$s"), from_utf8(os::python_info())));
|
||||
if (plain)
|
||||
out << '\n';
|
||||
|
@ -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>
|
||||
@ -126,33 +128,35 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION >= 0x050400)
|
||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
# include <QtGui/QWindowsMimeConverter>
|
||||
# define QWINDOWSMIME QWindowsMimeConverter
|
||||
# define QVARIANTTYPE QMetaType
|
||||
# else
|
||||
# include <QtGui/private/qguiapplication_p.h>
|
||||
# include <QtGui/private/qwindowsmime_p.h>
|
||||
# include <QtGui/qpa/qplatformintegration.h>
|
||||
# define QWINDOWSMIME QWindowsMime
|
||||
# define QVARIANTTYPE QMetaType
|
||||
#if (QT_VERSION >= 0x060000)
|
||||
#if (QT_VERSION >= 0x060500)
|
||||
#include <QtGui/QWindowsMimeConverter>
|
||||
#define QWINDOWSMIME QWindowsMimeConverter
|
||||
#define QVARIANTTYPE QMetaType
|
||||
#else
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/private/qwindowsmime_p.h>
|
||||
#include <QtGui/qpa/qplatformintegration.h>
|
||||
#define QWINDOWSMIME QWindowsMime
|
||||
#define QVARIANTTYPE QMetaType
|
||||
using QWindowsMime = QNativeInterface::Private::QWindowsMime;
|
||||
using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
|
||||
# endif
|
||||
# else
|
||||
# include <QWinMime>
|
||||
# define QWINDOWSMIME QWinMime
|
||||
# define QVARIANTTYPE QVariant::Type
|
||||
# endif
|
||||
# ifdef Q_CC_GNU
|
||||
# include <wtypes.h>
|
||||
# endif
|
||||
# include <objidl.h>
|
||||
#endif
|
||||
#else
|
||||
#include <QWinMime>
|
||||
#define QWINDOWSMIME QWinMime
|
||||
#define QVARIANTTYPE QVariant::Type
|
||||
#endif
|
||||
#ifdef Q_CC_GNU
|
||||
#include <wtypes.h>
|
||||
#endif
|
||||
#include <objidl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
||||
#include <QMacPasteboardMime>
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
@ -191,10 +195,12 @@ frontend::Application * createApplication(int & argc, char * argv[])
|
||||
// Setup high DPI handling. This is a bit complicated, but will be default in Qt6.
|
||||
// macOS does it by itself.
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_OS_MAC)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
|
||||
if (getEnv("QT_ENABLE_HIGHDPI_SCALING").empty()
|
||||
&& getEnv("QT_AUTO_SCREEN_SCALE_FACTOR").empty())
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
// HighDPI scale factor policy must be set before QGuiApplication is created
|
||||
@ -785,7 +791,7 @@ public:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
||||
// QMacPasteboardMimeGraphics can only be compiled on Mac.
|
||||
|
||||
class QMacPasteboardMimeGraphics : public QMacPasteboardMime
|
||||
@ -845,6 +851,7 @@ public:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Windows specific stuff goes here...
|
||||
|
||||
#if (QT_VERSION >= 0x050400)
|
||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||
// QWindowsMimeMetafile can only be compiled on Windows.
|
||||
|
||||
@ -943,6 +950,7 @@ public:
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/// Allows to check whether ESC was pressed during a long operation
|
||||
@ -1006,19 +1014,21 @@ struct GuiApplication::Private
|
||||
Private(): language_model_(nullptr), meta_fake_bit(NoModifier),
|
||||
global_menubar_(nullptr), last_state_(Qt::ApplicationInactive)
|
||||
{
|
||||
#if (QT_VERSION >= 0x050400)
|
||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||
/// WMF Mime handler for Windows clipboard.
|
||||
wmf_mime_ = new QWindowsMimeMetafile;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
|
||||
#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
|
||||
win_app_ = dynamic_cast<QWindowsApplication *>
|
||||
(QGuiApplicationPrivate::platformIntegration());
|
||||
win_app_->registerMime(wmf_mime_);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
initKeySequences(&theTopLevelKeymap());
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
|
||||
#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
|
||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||
~Private()
|
||||
{
|
||||
@ -1093,17 +1103,19 @@ struct GuiApplication::Private
|
||||
/// Holds previous application state on Mac
|
||||
Qt::ApplicationState last_state_;
|
||||
|
||||
#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
||||
/// Linkback mime handler for MacOSX.
|
||||
QMacPasteboardMimeGraphics mac_pasteboard_mime_;
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION >= 0x050400)
|
||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||
/// WMF Mime handler for Windows clipboard.
|
||||
QWindowsMimeMetafile * wmf_mime_;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
|
||||
#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
|
||||
QWindowsApplication * win_app_;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// Allows to check whether ESC was pressed during a long operation
|
||||
@ -1130,12 +1142,19 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
||||
QCoreApplication::setOrganizationName(app_name);
|
||||
QCoreApplication::setOrganizationDomain("lyx.org");
|
||||
QCoreApplication::setApplicationName(lyx_package);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x050700
|
||||
setDesktopFileName(lyx_package);
|
||||
#endif
|
||||
|
||||
#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_);
|
||||
@ -2817,7 +2836,7 @@ void GuiApplication::execBatchCommands()
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta);
|
||||
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
# if QT_VERSION < 0x060000
|
||||
setAttribute(Qt::AA_UseHighDpiPixmaps,true);
|
||||
# endif
|
||||
// Create the global default menubar which is shown for the dialogs
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
bool notify(QObject * receiver, QEvent * event) override;
|
||||
void commitData(QSessionManager & sm);
|
||||
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#if (QT_VERSION < 0x060000)
|
||||
#define QINTPTR long
|
||||
#else
|
||||
#define QINTPTR qintptr
|
||||
|
@ -70,9 +70,15 @@ void GuiChanges::updateContents()
|
||||
text += inserted ? qt_("Inserted by %1").arg(author)
|
||||
: qt_("Deleted by %1").arg(author);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
QString const date =
|
||||
QLocale().toString(QDateTime::fromSecsSinceEpoch(c.changetime),
|
||||
QLocale::LongFormat);
|
||||
#else
|
||||
QString const date =
|
||||
QLocale().toString(QDateTime::fromTime_t(c.changetime),
|
||||
QLocale::LongFormat);
|
||||
#endif
|
||||
if (!date.isEmpty()) {
|
||||
if (!author.isEmpty())
|
||||
text += qt_(" on[[date]] %1").arg(date);
|
||||
|
@ -361,7 +361,7 @@ QString tidyHtml(QString const & input)
|
||||
// clutter.
|
||||
QTextDocument converter;
|
||||
converter.setHtml(input);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
return converter.toHtml("utf-8");
|
||||
#else
|
||||
return converter.toHtml();
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -2510,7 +2522,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);
|
||||
@ -2896,7 +2912,7 @@ void GuiDocument::updateFontlist()
|
||||
fontModule->fontsMathCO->addItem(qt_("Class Default (TeX Fonts)"), QString("auto"));
|
||||
fontModule->fontsMathCO->addItem(unimath, QString("default"));
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION >= 0x060000
|
||||
const QStringList families(QFontDatabase::families());
|
||||
#else
|
||||
QFontDatabase fontdb;
|
||||
|
@ -284,7 +284,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 >= 0x050b00
|
||||
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);
|
||||
@ -664,10 +668,17 @@ int GuiFontMetrics::width(char_type c) const
|
||||
if (value != outOfLimitMetric)
|
||||
return value;
|
||||
|
||||
#if QT_VERSION >= 0x050b00
|
||||
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);
|
||||
|
||||
|
@ -56,7 +56,7 @@ GuiHSpace::GuiHSpace(bool math_mode, QWidget * parent)
|
||||
spacingCO->addItem(qt_("Visible Space"), "visible");
|
||||
spacingCO->addItem(qt_("Custom"), "custom");
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#if QT_VERSION < 0x050e00
|
||||
connect(spacingCO, SIGNAL(highlighted(QString)),
|
||||
this, SLOT(changedSlot()));
|
||||
#else
|
||||
|
@ -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)
|
||||
|
@ -802,7 +802,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#if QT_VERSION < 0x050e00
|
||||
connect(screenRomanCO, SIGNAL(activated(QString)),
|
||||
this, SLOT(selectRoman(QString)));
|
||||
connect(screenSansCO, SIGNAL(activated(QString)),
|
||||
@ -818,7 +818,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
|
||||
this, SLOT(selectTypewriter(QString)));
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION >= 0x060000
|
||||
const QStringList families(QFontDatabase::families());
|
||||
#else
|
||||
QFontDatabase fontdb;
|
||||
@ -829,7 +829,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
|
||||
screenSansCO->addItem(family);
|
||||
screenTypewriterCO->addItem(family);
|
||||
}
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#if QT_VERSION < 0x050e00
|
||||
connect(screenRomanCO, SIGNAL(activated(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(screenSansCO, SIGNAL(activated(QString)),
|
||||
@ -1563,7 +1563,7 @@ PrefConverters::PrefConverters(GuiPreferences * form)
|
||||
this, SLOT(updateConverter()));
|
||||
connect(convertersLW, SIGNAL(currentRowChanged(int)),
|
||||
this, SLOT(switchConverter()));
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#if QT_VERSION < 0x050e00
|
||||
connect(converterFromCO, SIGNAL(activated(QString)),
|
||||
this, SLOT(changeConverter()));
|
||||
connect(converterToCO, SIGNAL(activated(QString)),
|
||||
@ -1934,7 +1934,7 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
|
||||
this, SLOT(updatePrettyname()));
|
||||
connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#if QT_VERSION < 0x050e00
|
||||
connect(defaultFormatCB, SIGNAL(activated(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(defaultOTFFormatCB, SIGNAL(activated(QString)),
|
||||
|
@ -603,7 +603,7 @@ GuiSearch::GuiSearch(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags
|
||||
void GuiSearch::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
if (isFloating() && event->button() == Qt::LeftButton) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION >= 0x060000
|
||||
dragPosition = event->globalPosition().toPoint() - frameGeometry().topLeft();
|
||||
#else
|
||||
dragPosition = event->globalPos() - frameGeometry().topLeft();
|
||||
@ -617,7 +617,7 @@ void GuiSearch::mousePressEvent(QMouseEvent * event)
|
||||
void GuiSearch::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
if (isFloating() && event->buttons() & Qt::LeftButton) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION >= 0x060000
|
||||
move(event->globalPosition().toPoint() - dragPosition);
|
||||
#else
|
||||
move(event->globalPos() - dragPosition);
|
||||
|
@ -261,7 +261,7 @@ private:
|
||||
|
||||
/// Current ratio between physical pixels and device-independent pixels
|
||||
double pixelRatio() const {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
return devicePixelRatioF();
|
||||
#else
|
||||
return devicePixelRatio();
|
||||
@ -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_);
|
||||
@ -1694,8 +1706,10 @@ bool GuiView::event(QEvent * e)
|
||||
}
|
||||
for (int i = 0; i != d.splitter_->count(); ++i)
|
||||
d.tabWorkArea(i)->setFullScreen(true);
|
||||
// Safe area measures won't allow us to go negative in margins
|
||||
#if QT_VERSION > 0x050903
|
||||
//Qt's 5.9.4 ba44cdae38406c safe area measures won't allow us to go negative in margins
|
||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
|
||||
#endif
|
||||
setContentsMargins(-2, -2, -2, -2);
|
||||
// bug 5274
|
||||
hideDialogs("prefs", nullptr);
|
||||
@ -1714,7 +1728,9 @@ bool GuiView::event(QEvent * e)
|
||||
}
|
||||
for (int i = 0; i != d.splitter_->count(); ++i)
|
||||
d.tabWorkArea(i)->setFullScreen(false);
|
||||
#if QT_VERSION > 0x050903
|
||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, true);
|
||||
#endif
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
return result;
|
||||
@ -1856,7 +1872,7 @@ void GuiView::resetCommandExecute()
|
||||
|
||||
double GuiView::pixelRatio() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
return devicePixelRatioF();
|
||||
#else
|
||||
return devicePixelRatio();
|
||||
@ -5173,10 +5189,14 @@ bool GuiView::lfunUiToggle(string const & ui_component)
|
||||
//are the frames in default state?
|
||||
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
|
||||
if (l == 0) {
|
||||
#if QT_VERSION > 0x050903
|
||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
|
||||
#endif
|
||||
setContentsMargins(-2, -2, -2, -2);
|
||||
} else {
|
||||
#if QT_VERSION > 0x050903
|
||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, true);
|
||||
#endif
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
} else
|
||||
|
@ -178,7 +178,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & gv)
|
||||
|
||||
double GuiWorkArea::pixelRatio() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
return devicePixelRatioF();
|
||||
#else
|
||||
return devicePixelRatio();
|
||||
@ -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
|
||||
@ -1595,10 +1597,12 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
|
||||
return QVariant(d->im_cursor_rect_);
|
||||
break;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
case Qt::ImAnchorRectangle: {
|
||||
return QVariant(d->im_anchor_rect_);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
return QWidget::inputMethodQuery(query);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void TearOff::mouseReleaseEvent(QMouseEvent * /*event*/)
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
void TearOff::enterEvent(QEvent * event)
|
||||
#else
|
||||
void TearOff::enterEvent(QEnterEvent * event)
|
||||
@ -81,7 +81,7 @@ void TearOff::paintEvent(QPaintEvent * /*event*/)
|
||||
menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
|
||||
menuOpt.menuRect = rect();
|
||||
menuOpt.maxIconWidth = 0;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
menuOpt.tabWidth = 0;
|
||||
#endif
|
||||
menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;
|
||||
@ -103,7 +103,7 @@ IconPalette::IconPalette(QWidget * parent)
|
||||
v->setSpacing(0);
|
||||
layout_ = new QGridLayout;
|
||||
layout_->setSpacing(0);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
|
||||
layout_->setMargin(fw);
|
||||
#else
|
||||
|
@ -27,7 +27,7 @@ class TearOff : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TearOff(QWidget * parent);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < 0x060000
|
||||
void enterEvent(QEvent *) override;
|
||||
#else
|
||||
void enterEvent(QEnterEvent *) override;
|
||||
|
@ -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
|
||||
|
@ -766,7 +766,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);
|
||||
|
@ -179,6 +179,24 @@ QString changeExtension(QString const & oldname, QString const & ext);
|
||||
QString formatToolTip(QString text, int width = 30);
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050300
|
||||
// Very partial implementation of QSignalBlocker for archaic qt versions.
|
||||
class QSignalBlocker {
|
||||
public:
|
||||
explicit QSignalBlocker(QObject * o)
|
||||
: obj(o), init_state(obj && obj->blockSignals(true)) {}
|
||||
|
||||
~QSignalBlocker() {
|
||||
if (obj)
|
||||
obj->blockSignals(init_state);
|
||||
}
|
||||
private:
|
||||
QObject * obj;
|
||||
bool init_state;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// Check if text is understood as rich text (Qt HTML) and if so, produce a
|
||||
// rendering in plain text.
|
||||
QString qtHtmlToPlainText(QString const & text);
|
||||
|
@ -303,7 +303,11 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
||||
string const dt = split(name, '@');
|
||||
QDate date;
|
||||
if (itype == "moddate")
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
date = QDateTime::fromSecsSinceEpoch(buf->fileName().lastModified()).date();
|
||||
#else
|
||||
date = QDateTime::fromTime_t(buf->fileName().lastModified()).date();
|
||||
#endif
|
||||
else if (itype == "fixdate" && !dt.empty()) {
|
||||
QDate const gdate = QDate::fromString(toqstr(dt), Qt::ISODate);
|
||||
date = (gdate.isValid()) ? gdate : QDate::currentDate();
|
||||
@ -330,7 +334,11 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
||||
string const tt = split(name, '@');
|
||||
QTime time;
|
||||
if (itype == "modtime")
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
time = QDateTime::fromSecsSinceEpoch(buf->fileName().lastModified()).time();
|
||||
#else
|
||||
time = QDateTime::fromTime_t(buf->fileName().lastModified()).time();
|
||||
#endif
|
||||
else if (itype == "fixtime" && !tt.empty()) {
|
||||
QTime const gtime = QTime::fromString(toqstr(tt), Qt::ISODate);
|
||||
time = (gtime.isValid()) ? gtime : QTime::currentTime();
|
||||
@ -1222,7 +1230,11 @@ void InsetInfo::build()
|
||||
? split(params_.name, date_format, '@') : string();
|
||||
QDate date;
|
||||
if (params_.type == InsetInfoParams::MODDATE_INFO)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
date = QDateTime::fromSecsSinceEpoch(buffer().fileName().lastModified()).date();
|
||||
#else
|
||||
date = QDateTime::fromTime_t(buffer().fileName().lastModified()).date();
|
||||
#endif
|
||||
else if (params_.type == InsetInfoParams::FIXDATE_INFO && !date_specifier.empty())
|
||||
date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
|
||||
else
|
||||
@ -1240,7 +1252,11 @@ void InsetInfo::build()
|
||||
? split(params_.name, time_format, '@') : string();
|
||||
QTime time;
|
||||
if (params_.type == InsetInfoParams::MODTIME_INFO)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
time = QDateTime::fromSecsSinceEpoch(buffer().fileName().lastModified()).time();
|
||||
#else
|
||||
time = QDateTime::fromTime_t(buffer().fileName().lastModified()).time();
|
||||
#endif
|
||||
else if (params_.type == InsetInfoParams::FIXTIME_INFO && !time_specifier.empty())
|
||||
time = QTime::fromString(toqstr(time_specifier), Qt::ISODate);
|
||||
else
|
||||
@ -1287,7 +1303,11 @@ std::pair<QDate, std::string> parseDate(Buffer const & buffer, const InsetInfoPa
|
||||
|
||||
QDate date;
|
||||
if (params.type == InsetInfoParams::MODDATE_INFO)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
date = QDateTime::fromSecsSinceEpoch(buffer.fileName().lastModified()).date();
|
||||
#else
|
||||
date = QDateTime::fromTime_t(buffer.fileName().lastModified()).date();
|
||||
#endif
|
||||
else if (params.type == InsetInfoParams::FIXDATE_INFO && !date_specifier.empty()) {
|
||||
QDate date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
|
||||
date = (date.isValid()) ? date : QDate::currentDate();
|
||||
@ -1308,7 +1328,11 @@ std::pair<QTime, std::string> parseTime(Buffer const & buffer, const InsetInfoPa
|
||||
|
||||
QTime time;
|
||||
if (params.type == InsetInfoParams::MODTIME_INFO)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
time = QDateTime::fromSecsSinceEpoch(buffer.fileName().lastModified()).time();
|
||||
#else
|
||||
time = QDateTime::fromTime_t(buffer.fileName().lastModified()).time();
|
||||
#endif
|
||||
else if (params.type == InsetInfoParams::FIXTIME_INFO && !date_specifier.empty()) {
|
||||
time = QTime::fromString(toqstr(date_specifier), Qt::ISODate);
|
||||
time = (time.isValid()) ? time : QTime::currentTime();
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -518,7 +518,12 @@ time_t FileName::lastModified() const
|
||||
// been touched between the object creation and now, we refresh the file
|
||||
// information.
|
||||
d->refresh();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
return d->fi.lastModified().toSecsSinceEpoch();
|
||||
#else
|
||||
return d->fi.lastModified().toTime_t();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -369,7 +369,11 @@ SystemcallPrivate::SystemcallPrivate(std::string const & sf, std::string const &
|
||||
|
||||
connect(process_, SIGNAL(readyReadStandardOutput()), SLOT(stdOut()));
|
||||
connect(process_, SIGNAL(readyReadStandardError()), SLOT(stdErr()));
|
||||
#if QT_VERSION >= 0x050600
|
||||
connect(process_, SIGNAL(errorOccurred(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
|
||||
#else
|
||||
connect(process_, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
|
||||
#endif
|
||||
connect(process_, SIGNAL(started()), this, SLOT(processStarted()));
|
||||
connect(process_, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
|
||||
}
|
||||
|
@ -37,12 +37,20 @@ time_t current_time()
|
||||
docstring formatted_datetime(time_t t, string const & fmt)
|
||||
{
|
||||
QString qres;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
if (fmt.empty())
|
||||
qres = QLocale().toString(QDateTime::fromSecsSinceEpoch(t),
|
||||
QLocale::ShortFormat);
|
||||
else
|
||||
qres = QLocale().toString(QDateTime::fromSecsSinceEpoch(t),
|
||||
toqstr(fmt));
|
||||
#else
|
||||
if (fmt.empty())
|
||||
qres = QLocale().toString(QDateTime::fromTime_t(t),
|
||||
QLocale::ShortFormat);
|
||||
else
|
||||
qres = QLocale().toString(QDateTime::fromTime_t(t), toqstr(fmt));
|
||||
#endif
|
||||
return qstring_to_ucs4(qres);
|
||||
}
|
||||
|
||||
@ -69,7 +77,11 @@ time_t from_asctime_utc(string t)
|
||||
#else
|
||||
loc_dt.setTimeSpec(Qt::UTC);
|
||||
#endif
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
return loc_dt.toSecsSinceEpoch();
|
||||
#else
|
||||
return loc_dt.toTime_t();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace support
|
||||
|
Loading…
Reference in New Issue
Block a user