Compare commits

...

6 commits

Author SHA1 Message Date
Roman Telezhynskyi 48da4ff899 qprintengine.h declares Q_DECLARE_METATYPE(QMarginsF). We can use its macro to check. 2023-02-21 10:20:39 +02:00
Roman Telezhynskyi 647653a40a QString::front() was introduced in Qt 5.10. 2023-02-21 09:57:49 +02:00
Roman Telezhynskyi 647cee5e36 Optimize includes. 2023-02-21 09:52:19 +02:00
Roman Telezhynskyi 178d260dff Fix conflict with declaration from qmuparser lib. 2023-02-21 09:52:08 +02:00
Roman Telezhynskyi fb08b0a317 Try to avoid redeclaration. 2023-02-21 09:40:22 +02:00
Roman Telezhynskyi 2691f0b9e4 Fix environments. 2023-02-20 22:03:39 +02:00
12 changed files with 142 additions and 19 deletions

View file

@ -204,7 +204,7 @@ macos_task:
matrix: matrix:
- name: 'macOS Monterey 12 [signle bundle, no tests]' - name: 'macOS Monterey 12 [signle bundle, no tests]'
env: env:
MULTI_BUNDLE: true MULTI_BUNDLE: false
- name: 'macOS Monterey 12 [multi bundle, no tests]' - name: 'macOS Monterey 12 [multi bundle, no tests]'
env: env:
MULTI_BUNDLE: false MULTI_BUNDLE: true

View file

@ -58,7 +58,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, (QLatin1String(
int cachedLineWidth = -1; int cachedLineWidth = -1;
} // namespace } // namespace
#ifndef QBS_BUILD #ifndef QPRINTENGINE_H
Q_DECLARE_METATYPE(QMarginsF) // NOLINT Q_DECLARE_METATYPE(QMarginsF) // NOLINT
#endif #endif

View file

@ -40,6 +40,10 @@
#include "../vmisc/vsysexits.h" #include "../vmisc/vsysexits.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "../vmisc/backport/text.h"
#endif
#include <QtDebug> #include <QtDebug>
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>

View file

@ -415,7 +415,11 @@ QChar LocaleSign0(const QLocale &locale)
const QString sign = locale.toString(0); const QString sign = locale.toString(0);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -431,7 +435,11 @@ QChar LocaleSign1(const QLocale &locale)
const QString sign = locale.toString(1); const QString sign = locale.toString(1);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -447,7 +455,11 @@ QChar LocaleSign2(const QLocale &locale)
const QString sign = locale.toString(2); const QString sign = locale.toString(2);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -463,7 +475,11 @@ QChar LocaleSign3(const QLocale &locale)
const QString sign = locale.toString(3); const QString sign = locale.toString(3);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -479,7 +495,11 @@ QChar LocaleSign4(const QLocale &locale)
const QString sign = locale.toString(4); const QString sign = locale.toString(4);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -495,7 +515,11 @@ QChar LocaleSign5(const QLocale &locale)
const QString sign = locale.toString(5); const QString sign = locale.toString(5);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -511,7 +535,11 @@ QChar LocaleSign6(const QLocale &locale)
const QString sign = locale.toString(6); const QString sign = locale.toString(6);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -527,7 +555,11 @@ QChar LocaleSign7(const QLocale &locale)
const QString sign = locale.toString(7); const QString sign = locale.toString(7);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -543,7 +575,11 @@ QChar LocaleSign8(const QLocale &locale)
const QString sign = locale.toString(8); const QString sign = locale.toString(8);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -559,7 +595,11 @@ QChar LocaleSign9(const QLocale &locale)
const QString sign = locale.toString(9); const QString sign = locale.toString(9);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View file

@ -34,4 +34,5 @@ HEADERS += \
$$PWD/qmuformulabase.h \ $$PWD/qmuformulabase.h \
$$PWD/qmutokenparser.h \ $$PWD/qmutokenparser.h \
$$PWD/qmuparsercallback_p.h \ $$PWD/qmuparsercallback_p.h \
$$PWD/make_unique.h $$PWD/make_unique.h \
$$PWD/text.h

View file

@ -32,6 +32,7 @@ VDynamicLib {
"qmutokenparser.h", "qmutokenparser.h",
"qmuparsercallback_p.h", "qmuparsercallback_p.h",
"make_unique.h", "make_unique.h",
"text.h"
] ]
cpp.defines: ["QMUPARSER_LIBRARY", 'QMUP_VERSION="' + product.version + '"'] cpp.defines: ["QMUPARSER_LIBRARY", 'QMUP_VERSION="' + product.version + '"']

View file

@ -28,14 +28,18 @@
#include <QTextStream> #include <QTextStream>
#include <QtDebug> #include <QtDebug>
#include <Qt> #include <Qt>
#include <QtMath>
#include <map> #include <map>
#ifdef QMUP_USE_OPENMP #ifdef QMUP_USE_OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
#include <assert.h> #include <cassert>
#include "qmudef.h" #include "qmudef.h"
#include "../vmisc/vmath.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "text.h"
#endif
/** /**
* @file * @file

View file

@ -108,17 +108,6 @@ using qmusizetype = qsizetype;
using qmusizetype = int; using qmusizetype = int;
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QTextStream>
namespace Qt
{
static auto endl = ::endl;
static auto flush = ::flush;
static auto dec = ::dec;
static auto SkipEmptyParts = QString::SkipEmptyParts;
}
#endif
namespace qmu namespace qmu
{ {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

44
src/libs/qmuparser/text.h Normal file
View file

@ -0,0 +1,44 @@
/************************************************************************
**
** @file text.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 21 2, 2023
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2023 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef TEXT_H
#define TEXT_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QTextStream>
namespace Qt
{
//static auto endl = ::endl;
//static auto flush = ::flush;
static auto dec = ::dec;
//static auto SkipEmptyParts = QString::SkipEmptyParts;
}
#endif
#endif // TEXT_H

View file

@ -71,7 +71,7 @@ const qreal VCommonSettings::defaultScrollingAcceleration = 1.3;
const qreal VCommonSettings::scrollingAccelerationMin = 1.0; const qreal VCommonSettings::scrollingAccelerationMin = 1.0;
const qreal VCommonSettings::scrollingAccelerationMax = 10.0; const qreal VCommonSettings::scrollingAccelerationMax = 10.0;
#ifndef QBS_BUILD #ifndef QPRINTENGINE_H
Q_DECLARE_METATYPE(QMarginsF) // NOLINT Q_DECLARE_METATYPE(QMarginsF) // NOLINT
#endif #endif

View file

@ -44,7 +44,7 @@
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#include "qglobal.h" #include "qglobal.h"
#ifndef QBS_BUILD #ifndef QPRINTENGINE_H
Q_DECLARE_METATYPE(QMarginsF) // NOLINT Q_DECLARE_METATYPE(QMarginsF) // NOLINT
#endif #endif

View file

@ -69,7 +69,11 @@ auto VPELocaleSign0(const QLocale &locale) -> QChar
const QString sign = locale.toString(0); const QString sign = locale.toString(0);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -85,7 +89,11 @@ auto VPELocaleSign1(const QLocale &locale) -> QChar
const QString sign = locale.toString(1); const QString sign = locale.toString(1);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -101,7 +109,11 @@ auto VPELocaleSign2(const QLocale &locale) -> QChar
const QString sign = locale.toString(2); const QString sign = locale.toString(2);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -117,7 +129,11 @@ auto VPELocaleSign3(const QLocale &locale) -> QChar
const QString sign = locale.toString(3); const QString sign = locale.toString(3);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -133,7 +149,11 @@ auto VPELocaleSign4(const QLocale &locale) -> QChar
const QString sign = locale.toString(4); const QString sign = locale.toString(4);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -149,7 +169,11 @@ auto VPELocaleSign5(const QLocale &locale) -> QChar
const QString sign = locale.toString(5); const QString sign = locale.toString(5);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -165,7 +189,11 @@ auto VPELocaleSign6(const QLocale &locale) -> QChar
const QString sign = locale.toString(6); const QString sign = locale.toString(6);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -181,7 +209,11 @@ auto VPELocaleSign7(const QLocale &locale) -> QChar
const QString sign = locale.toString(7); const QString sign = locale.toString(7);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -197,7 +229,11 @@ auto VPELocaleSign8(const QLocale &locale) -> QChar
const QString sign = locale.toString(8); const QString sign = locale.toString(8);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -213,7 +249,11 @@ auto VPELocaleSign9(const QLocale &locale) -> QChar
const QString sign = locale.toString(9); const QString sign = locale.toString(9);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)