mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
change to allow compiling against older Qt versions
This commit is contained in:
parent
b2aad7ca20
commit
e25b494eb5
@ -212,6 +212,7 @@ JKQTPExpected<QGradient, JKQTPCSSParser::GeneralError> JKQTPCSSParser::parseGrad
|
|||||||
|
|
||||||
if (get) getToken();
|
if (get) getToken();
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
static QMap<QString,QGradient::Preset> s_GradientPresets = []() {
|
static QMap<QString,QGradient::Preset> s_GradientPresets = []() {
|
||||||
QMap<QString,QGradient::Preset> m;
|
QMap<QString,QGradient::Preset> m;
|
||||||
for (int i=1; i<QMetaEnum::fromType<QGradient::Preset>().keyCount(); i++) {
|
for (int i=1; i<QMetaEnum::fromType<QGradient::Preset>().keyCount(); i++) {
|
||||||
@ -220,7 +221,7 @@ JKQTPExpected<QGradient, JKQTPCSSParser::GeneralError> JKQTPCSSParser::parseGrad
|
|||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}();
|
}();
|
||||||
|
#endif
|
||||||
const QString func=CurrentToken.StringValue.trimmed().simplified().toLower();
|
const QString func=CurrentToken.StringValue.trimmed().simplified().toLower();
|
||||||
if (CurrentToken.is(Token::TokenType::NAME) && func=="linear-gradient") {
|
if (CurrentToken.is(Token::TokenType::NAME) && func=="linear-gradient") {
|
||||||
QGradientStops colorStops;
|
QGradientStops colorStops;
|
||||||
@ -321,10 +322,11 @@ JKQTPExpected<QGradient, JKQTPCSSParser::GeneralError> JKQTPCSSParser::parseGrad
|
|||||||
lgrad.setStops(colorStops);
|
lgrad.setStops(colorStops);
|
||||||
grad=lgrad;
|
grad=lgrad;
|
||||||
}
|
}
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
} else if (CurrentToken.isNormStringAnyOf(s_GradientPresets.keys())) {
|
} else if (CurrentToken.isNormStringAnyOf(s_GradientPresets.keys())) {
|
||||||
grad=QGradient(s_GradientPresets[CurrentToken.getNormString()]);
|
grad=QGradient(s_GradientPresets[CurrentToken.getNormString()]);
|
||||||
grad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
grad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return {JKQTPUnexpected, UnexpectedTermError("supported gradient-function [linear-gradient|] or predefined gradient name", CurrentToken, pos) };
|
return {JKQTPUnexpected, UnexpectedTermError("supported gradient-function [linear-gradient|] or predefined gradient name", CurrentToken, pos) };
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ namespace {
|
|||||||
m["diagcross"]=Qt::DiagCrossPattern;
|
m["diagcross"]=Qt::DiagCrossPattern;
|
||||||
return m;
|
return m;
|
||||||
}();
|
}();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
static QMap<QString,QGradient::Preset> s_GradientPresets = []() {
|
static QMap<QString,QGradient::Preset> s_GradientPresets = []() {
|
||||||
QMap<QString,QGradient::Preset> m;
|
QMap<QString,QGradient::Preset> m;
|
||||||
for (int i=1; i<QMetaEnum::fromType<QGradient::Preset>().keyCount(); i++) {
|
for (int i=1; i<QMetaEnum::fromType<QGradient::Preset>().keyCount(); i++) {
|
||||||
@ -399,6 +399,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}();
|
}();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,6 +423,7 @@ Qt::BrushStyle jkqtp_String2QBrushStyleExt(const QString &style, QGradient *grad
|
|||||||
qWarning()<<"error converting '"<<style<<"' into a QGradient: "<<E.what();
|
qWarning()<<"error converting '"<<style<<"' into a QGradient: "<<E.what();
|
||||||
return Qt::SolidPattern;
|
return Qt::SolidPattern;
|
||||||
}
|
}
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
} else if (s_GradientPresets.contains(s)) {
|
} else if (s_GradientPresets.contains(s)) {
|
||||||
QGradient g(s_GradientPresets[s]);
|
QGradient g(s_GradientPresets[s]);
|
||||||
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
@ -429,6 +431,7 @@ Qt::BrushStyle jkqtp_String2QBrushStyleExt(const QString &style, QGradient *grad
|
|||||||
if (g.type()==QGradient::Type::RadialGradient) return Qt::RadialGradientPattern;
|
if (g.type()==QGradient::Type::RadialGradient) return Qt::RadialGradientPattern;
|
||||||
else if (g.type()==QGradient::Type::ConicalGradient) return Qt::ConicalGradientPattern;
|
else if (g.type()==QGradient::Type::ConicalGradient) return Qt::ConicalGradientPattern;
|
||||||
else return Qt::LinearGradientPattern;
|
else return Qt::LinearGradientPattern;
|
||||||
|
#endif
|
||||||
} else if (jkqtp_rxExactlyMatches(s, "\\s*image\\s*\\(\\s*[\\\"\\\']?(.*)[\\\"\\\']?\\s*\\)\\s*", &caps)) {
|
} else if (jkqtp_rxExactlyMatches(s, "\\s*image\\s*\\(\\s*[\\\"\\\']?(.*)[\\\"\\\']?\\s*\\)\\s*", &caps)) {
|
||||||
if (image) *image=QPixmap(caps[1]);
|
if (image) *image=QPixmap(caps[1]);
|
||||||
return Qt::TexturePattern;
|
return Qt::TexturePattern;
|
||||||
@ -1097,7 +1100,7 @@ namespace JKQTCommon_private {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jkqtp_rxContains(const QString& text, const QString ®ex, qsizetype offset, QStringList* caps)
|
bool jkqtp_rxContains(const QString& text, const QString ®ex, size_t offset, QStringList* caps)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (!JKQTCommon_private::rxCache.contains(regex)) JKQTCommon_private::rxCache.insert(regex, new QRegularExpression(regex));
|
if (!JKQTCommon_private::rxCache.contains(regex)) JKQTCommon_private::rxCache.insert(regex, new QRegularExpression(regex));
|
||||||
@ -1125,7 +1128,7 @@ bool jkqtp_rxContains(const QString& text, const QString ®ex, qsizetype offse
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qsizetype jkqtp_rxIndexIn(const QString& text, const QString ®ex, qsizetype offset, QStringList* caps)
|
size_t jkqtp_rxIndexIn(const QString& text, const QString ®ex, size_t offset, QStringList* caps)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (!JKQTCommon_private::rxCache.contains(regex)) JKQTCommon_private::rxCache.insert(regex, new QRegularExpression(regex));
|
if (!JKQTCommon_private::rxCache.contains(regex)) JKQTCommon_private::rxCache.insert(regex, new QRegularExpression(regex));
|
||||||
@ -1147,14 +1150,14 @@ qsizetype jkqtp_rxIndexIn(const QString& text, const QString ®ex, qsizetype o
|
|||||||
tempRX.reset(new QRegExp(regex));
|
tempRX.reset(new QRegExp(regex));
|
||||||
rx=tempRX.data();
|
rx=tempRX.data();
|
||||||
}
|
}
|
||||||
const qsizetype idx = rx->indexIn(text, offset);
|
const size_t idx = rx->indexIn(text, offset);
|
||||||
if (caps) *caps=rx->capturedTexts();
|
if (caps) *caps=rx->capturedTexts();
|
||||||
return idx;
|
return idx;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool jkqtp_rxPartiallyMatchesAt(const QString& text, const QString ®ex, qsizetype offset, QStringList* caps)
|
bool jkqtp_rxPartiallyMatchesAt(const QString& text, const QString ®ex, size_t offset, QStringList* caps)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (!JKQTCommon_private::rxCache.contains(regex)) JKQTCommon_private::rxCache.insert(regex, new QRegularExpression(regex));
|
if (!JKQTCommon_private::rxCache.contains(regex)) JKQTCommon_private::rxCache.insert(regex, new QRegularExpression(regex));
|
||||||
|
@ -360,7 +360,7 @@ JKQTCOMMON_LIB_EXPORT Qt::MouseButton jkqtp_String2MouseButton(const QString &bu
|
|||||||
*
|
*
|
||||||
* \see jkqtp_rxExactlyMatches(), jkqtp_rxIndexIn(), jkqtp_rxContains(), jkqtp_rxPartiallyMatchesAt()
|
* \see jkqtp_rxExactlyMatches(), jkqtp_rxIndexIn(), jkqtp_rxContains(), jkqtp_rxPartiallyMatchesAt()
|
||||||
*/
|
*/
|
||||||
JKQTCOMMON_LIB_EXPORT bool jkqtp_rxContains(const QString& text, const QString ®ex, qsizetype offset=0, QStringList* caps=nullptr);
|
JKQTCOMMON_LIB_EXPORT bool jkqtp_rxContains(const QString& text, const QString ®ex, size_t offset=0, QStringList* caps=nullptr);
|
||||||
|
|
||||||
/** \brief returns the next match (i.e. its index) of the given regular expression \a regex within \a text,
|
/** \brief returns the next match (i.e. its index) of the given regular expression \a regex within \a text,
|
||||||
* starts from \a offset and optionally returns the match in \a caps \c =[fullmatch, cap1,cap2,...]
|
* starts from \a offset and optionally returns the match in \a caps \c =[fullmatch, cap1,cap2,...]
|
||||||
@ -371,7 +371,7 @@ JKQTCOMMON_LIB_EXPORT bool jkqtp_rxContains(const QString& text, const QString &
|
|||||||
*
|
*
|
||||||
* \see jkqtp_rxExactlyMatches(), jkqtp_rxIndexIn(), jkqtp_rxContains(), jkqtp_rxPartiallyMatchesAt()
|
* \see jkqtp_rxExactlyMatches(), jkqtp_rxIndexIn(), jkqtp_rxContains(), jkqtp_rxPartiallyMatchesAt()
|
||||||
*/
|
*/
|
||||||
JKQTCOMMON_LIB_EXPORT qsizetype jkqtp_rxIndexIn(const QString& text, const QString ®ex, qsizetype offset=0, QStringList* caps=nullptr);
|
JKQTCOMMON_LIB_EXPORT size_t jkqtp_rxIndexIn(const QString& text, const QString ®ex, size_t offset=0, QStringList* caps=nullptr);
|
||||||
|
|
||||||
/** \brief returns \c true, if \a text exactly matches the given regular expression \a regex,
|
/** \brief returns \c true, if \a text exactly matches the given regular expression \a regex,
|
||||||
* starts from \a offset and optionally returns the match in \a caps \c =[fullmatch, cap1,cap2,...]
|
* starts from \a offset and optionally returns the match in \a caps \c =[fullmatch, cap1,cap2,...]
|
||||||
@ -395,7 +395,7 @@ JKQTCOMMON_LIB_EXPORT bool jkqtp_rxExactlyMatches(const QString& text, const QSt
|
|||||||
*
|
*
|
||||||
* \see jkqtp_rxExactlyMatches(), jkqtp_rxIndexIn(), jkqtp_rxContains(), jkqtp_rxPartiallyMatchesAt()
|
* \see jkqtp_rxExactlyMatches(), jkqtp_rxIndexIn(), jkqtp_rxContains(), jkqtp_rxPartiallyMatchesAt()
|
||||||
*/
|
*/
|
||||||
JKQTCOMMON_LIB_EXPORT bool jkqtp_rxPartiallyMatchesAt(const QString& text, const QString ®ex, qsizetype offset=0, QStringList* caps=nullptr);
|
JKQTCOMMON_LIB_EXPORT bool jkqtp_rxPartiallyMatchesAt(const QString& text, const QString ®ex, size_t offset=0, QStringList* caps=nullptr);
|
||||||
|
|
||||||
|
|
||||||
#endif // JKQTPSTRINGTOOLS_H_INCLUDED
|
#endif // JKQTPSTRINGTOOLS_H_INCLUDED
|
||||||
|
@ -997,35 +997,36 @@ namespace {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
namespace std {
|
||||||
struct std::hash<JKQTMathTextCacheKeyBase>
|
template<>
|
||||||
{
|
struct hash<JKQTMathTextCacheKeyBase>
|
||||||
std::size_t operator()(const JKQTMathTextCacheKeyBase& data) const noexcept
|
|
||||||
{
|
{
|
||||||
return qHash(data.f)+std::hash<int>()(data.ldpiX)+std::hash<int>()(data.ldpiY)+std::hash<int>()(data.pdpiX)+std::hash<int>()(data.pdpiY);
|
size_t operator()(const JKQTMathTextCacheKeyBase& data) const noexcept
|
||||||
}
|
{
|
||||||
};
|
return qHash(data.f)+hash<int>()(data.ldpiX)+hash<int>()(data.ldpiY)+hash<int>()(data.pdpiX)+hash<int>()(data.pdpiY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct std::hash<JKQTMathTextTBRDataH<QString>>
|
struct hash<JKQTMathTextTBRDataH<QString>>
|
||||||
{
|
|
||||||
std::size_t operator()(const JKQTMathTextTBRDataH<QString>& data) const noexcept
|
|
||||||
{
|
{
|
||||||
return qHash(data.f)+qHash(data.text)+std::hash<int>()(data.ldpiX)+std::hash<int>()(data.ldpiY)+std::hash<int>()(data.pdpiX)+std::hash<int>()(data.pdpiY);
|
size_t operator()(const JKQTMathTextTBRDataH<QString>& data) const noexcept
|
||||||
}
|
{
|
||||||
};
|
return qHash(data.f)+qHash(data.text)+hash<int>()(data.ldpiX)+hash<int>()(data.ldpiY)+hash<int>()(data.pdpiX)+hash<int>()(data.pdpiY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct std::hash<JKQTMathTextTBRDataH<QChar>>
|
struct hash<JKQTMathTextTBRDataH<QChar>>
|
||||||
{
|
|
||||||
std::size_t operator()(const JKQTMathTextTBRDataH<QChar>& data) const noexcept
|
|
||||||
{
|
{
|
||||||
return qHash(data.f)+qHash(data.text)+std::hash<int>()(data.ldpiX)+std::hash<int>()(data.ldpiY)+std::hash<int>()(data.pdpiX)+std::hash<int>()(data.pdpiY);
|
size_t operator()(const JKQTMathTextTBRDataH<QChar>& data) const noexcept
|
||||||
}
|
{
|
||||||
};
|
return qHash(data.f)+qHash(data.text)+hash<int>()(data.ldpiX)+hash<int>()(data.ldpiY)+hash<int>()(data.pdpiX)+hash<int>()(data.pdpiY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QRectF JKQTMathTextGetTightBoundingRect(const QFont &f, const QString &text, QPaintDevice *pd)
|
QRectF JKQTMathTextGetTightBoundingRect(const QFont &f, const QString &text, QPaintDevice *pd)
|
||||||
|
@ -884,7 +884,7 @@ JKQTMathTextNode* JKQTMathTextLatexParser::parseLatexString(bool get, JKQTMathTe
|
|||||||
bool first=true;
|
bool first=true;
|
||||||
bool firstLine=true;
|
bool firstLine=true;
|
||||||
QVector<JKQTMathTextNode*> line;
|
QVector<JKQTMathTextNode*> line;
|
||||||
qsizetype colCount=0;
|
size_t colCount=0;
|
||||||
//qDebug()<<"start "<<envname;
|
//qDebug()<<"start "<<envname;
|
||||||
while (first || currentToken==MTTampersand || currentToken==MTTinstructionNewline) {
|
while (first || currentToken==MTTampersand || currentToken==MTTinstructionNewline) {
|
||||||
//qDebug()<<" - START: "<<tokenType2String(currentToken)<<" first="<<first;
|
//qDebug()<<" - START: "<<tokenType2String(currentToken)<<" first="<<first;
|
||||||
@ -930,12 +930,12 @@ JKQTMathTextNode* JKQTMathTextLatexParser::parseLatexString(bool get, JKQTMathTe
|
|||||||
line.append(it);
|
line.append(it);
|
||||||
|
|
||||||
if (currentToken==MTTinstructionNewline || (currentToken==MTTinstructionEnd && currentTokenName==envname) || line.size()>0) {
|
if (currentToken==MTTinstructionNewline || (currentToken==MTTinstructionEnd && currentTokenName==envname) || line.size()>0) {
|
||||||
colCount=qMax(colCount, static_cast<qsizetype>(line.size()));
|
colCount=qMax(colCount, static_cast<size_t>(line.size()));
|
||||||
//qDebug()<<" - colCount="<<colCount;
|
//qDebug()<<" - colCount="<<colCount;
|
||||||
if (line.size()==0 || (line.size()>=1 && static_cast<qsizetype>(line.size())==colCount)) {
|
if (line.size()==0 || (line.size()>=1 && static_cast<size_t>(line.size())==colCount)) {
|
||||||
items.append(line);
|
items.append(line);
|
||||||
//qDebug()<<" - appending line with "<<line.size()<<" items. items.size now "<<items.size();
|
//qDebug()<<" - appending line with "<<line.size()<<" items. items.size now "<<items.size();
|
||||||
} else if (line.size()>=1 && static_cast<qsizetype>(line.size())!=colCount) {
|
} else if (line.size()>=1 && static_cast<size_t>(line.size())!=colCount) {
|
||||||
addToErrorList(tr("error @ ch. %1: wrong number of entries widthin '\\begin{%2}...\\end{%2}'").arg(currentTokenID).arg(envname));
|
addToErrorList(tr("error @ ch. %1: wrong number of entries widthin '\\begin{%2}...\\end{%2}'").arg(currentTokenID).arg(envname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3741,7 +3741,7 @@ bool JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
|
|||||||
QSharedPointer<QPaintDevice> paintDevice=QSharedPointer<QPaintDevice>(jkqtpPaintDeviceAdapters.get()[adapterID]->createPaintdevice(fn, jkqtp_roundTo<int>(gridPrintingSize.width()), jkqtp_roundTo<int>(gridPrintingSize.height())));
|
QSharedPointer<QPaintDevice> paintDevice=QSharedPointer<QPaintDevice>(jkqtpPaintDeviceAdapters.get()[adapterID]->createPaintdevice(fn, jkqtp_roundTo<int>(gridPrintingSize.width()), jkqtp_roundTo<int>(gridPrintingSize.height())));
|
||||||
|
|
||||||
#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
|
#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
|
||||||
if (!printpreviewNew(paintDevice.get(), jkqtpPaintDeviceAdapters.get()[adapterID]->getSetAbsolutePaperSize(), jkqtpPaintDeviceAdapters.get()[adapterID]->getPrintSizeXInMM(), jkqtpPaintDeviceAdapters.get()[adapterID]->getPrintSizeYInMM(), displayPreview)) {
|
if (!printpreviewNew(paintDevice.data(), jkqtpPaintDeviceAdapters.get()[adapterID]->getSetAbsolutePaperSize(), jkqtpPaintDeviceAdapters.get()[adapterID]->getPrintSizeXInMM(), jkqtpPaintDeviceAdapters.get()[adapterID]->getPrintSizeYInMM(), displayPreview)) {
|
||||||
if (QFile::exists(tempFM)) {
|
if (QFile::exists(tempFM)) {
|
||||||
QFile::copy(tempFM, fn);
|
QFile::copy(tempFM, fn);
|
||||||
QFile::remove(tempFM);
|
QFile::remove(tempFM);
|
||||||
@ -3751,7 +3751,7 @@ bool JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
paintDevice.reset(jkqtpPaintDeviceAdapters.get()[adapterID]->createPaintdeviceMM(fn,printSizeX_Millimeter,printSizeY_Millimeter));
|
paintDevice.reset(jkqtpPaintDeviceAdapters.get()[adapterID]->createPaintdeviceMM(fn,printSizeX_Millimeter,printSizeY_Millimeter));
|
||||||
printpreviewPaintRequestedNewPaintDevice(paintDevice.get());
|
printpreviewPaintRequestedNewPaintDevice(paintDevice.data());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,11 @@ QBrush JKQTFillStyleSummmary::brush(const QColor &color) const
|
|||||||
if (brushStyle==Qt::LinearGradientPattern || brushStyle==Qt::RadialGradientPattern || brushStyle==Qt::ConicalGradientPattern) {
|
if (brushStyle==Qt::LinearGradientPattern || brushStyle==Qt::RadialGradientPattern || brushStyle==Qt::ConicalGradientPattern) {
|
||||||
QGradient g=gradient;
|
QGradient g=gradient;
|
||||||
JKQTPReplaceCurrentColor(g, color);
|
JKQTPReplaceCurrentColor(g, color);
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,12,0)
|
||||||
g.setCoordinateMode(QGradient::ObjectMode);
|
g.setCoordinateMode(QGradient::ObjectMode);
|
||||||
|
#else
|
||||||
|
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
|
#endif
|
||||||
b=QBrush(g);
|
b=QBrush(g);
|
||||||
} else {
|
} else {
|
||||||
b.setStyle(brushStyle);
|
b.setStyle(brushStyle);
|
||||||
|
@ -120,11 +120,12 @@ private slots:
|
|||||||
|
|
||||||
QVERIFY_THROWS_EXCEPTION(std::exception, n=JKQTPCSSParser::readGradient("wa__flame"));
|
QVERIFY_THROWS_EXCEPTION(std::exception, n=JKQTPCSSParser::readGradient("wa__flame"));
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
QVERIFY_THROWS_NO_EXCEPTION(n=JKQTPCSSParser::readGradient("warmflame"));
|
QVERIFY_THROWS_NO_EXCEPTION(n=JKQTPCSSParser::readGradient("warmflame"));
|
||||||
g = QGradient(QGradient::WarmFlame);
|
g = QGradient(QGradient::WarmFlame);
|
||||||
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
QCOMPARE_EQ(n, g);
|
QCOMPARE_EQ(n, g);
|
||||||
|
#endif
|
||||||
|
|
||||||
QVERIFY_THROWS_NO_EXCEPTION(n=JKQTPCSSParser::readGradient("linear-gradient(to left, red, blue)"));
|
QVERIFY_THROWS_NO_EXCEPTION(n=JKQTPCSSParser::readGradient("linear-gradient(to left, red, blue)"));
|
||||||
lg = QLinearGradient(1,0.5,0,0.5);
|
lg = QLinearGradient(1,0.5,0,0.5);
|
||||||
@ -171,11 +172,13 @@ private slots:
|
|||||||
QLinearGradient lg;
|
QLinearGradient lg;
|
||||||
|
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("warmflame", &n, nullptr));
|
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("warmflame", &n, nullptr));
|
||||||
g = QGradient(QGradient::WarmFlame);
|
g = QGradient(QGradient::WarmFlame);
|
||||||
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
QCOMPARE_EQ(n, g);
|
QCOMPARE_EQ(n, g);
|
||||||
QCOMPARE_EQ(bs, Qt::LinearGradientPattern);
|
QCOMPARE_EQ(bs, Qt::LinearGradientPattern);
|
||||||
|
#endif
|
||||||
|
|
||||||
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("d1", &n, nullptr));
|
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("d1", &n, nullptr));
|
||||||
QCOMPARE_EQ(bs, Qt::Dense1Pattern);
|
QCOMPARE_EQ(bs, Qt::Dense1Pattern);
|
||||||
|
@ -34,11 +34,13 @@ private slots:
|
|||||||
QLinearGradient lg;
|
QLinearGradient lg;
|
||||||
|
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("warmflame", &n, nullptr));
|
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("warmflame", &n, nullptr));
|
||||||
g = QGradient(QGradient::WarmFlame);
|
g = QGradient(QGradient::WarmFlame);
|
||||||
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
g.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
QCOMPARE_EQ(n, g);
|
QCOMPARE_EQ(n, g);
|
||||||
QCOMPARE_EQ(bs, Qt::LinearGradientPattern);
|
QCOMPARE_EQ(bs, Qt::LinearGradientPattern);
|
||||||
|
#endif
|
||||||
|
|
||||||
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("d1", &n, nullptr));
|
QVERIFY_THROWS_NO_EXCEPTION(bs=jkqtp_String2QBrushStyleExt("d1", &n, nullptr));
|
||||||
QCOMPARE_EQ(bs, Qt::Dense1Pattern);
|
QCOMPARE_EQ(bs, Qt::Dense1Pattern);
|
||||||
|
@ -207,14 +207,17 @@ int main(int argc, char* argv[])
|
|||||||
fileList<<" <table>\n";
|
fileList<<" <table>\n";
|
||||||
fileList<<" <tr>\n";
|
fileList<<" <tr>\n";
|
||||||
i=1;
|
i=1;
|
||||||
|
|
||||||
|
auto myIsLower=[](const QString& s) { for (size_t i=0; i<s.size(); i++) if (!s[i].isLower()) return false; return true; };
|
||||||
|
auto myIsUpper=[](const QString& s) { for (size_t i=0; i<s.size(); i++) if (!s[i].isUpper()) return false; return true; };
|
||||||
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
||||||
std::sort
|
std::sort
|
||||||
#else
|
#else
|
||||||
qSort
|
qSort
|
||||||
#endif
|
#endif
|
||||||
(symbolsAll.begin(), symbolsAll.end(), [](const QString& a, const QString& b) { if (a.contains("harpoon") && !b.contains("harpoon")) return false;
|
(symbolsAll.begin(), symbolsAll.end(), [myIsLower,myIsUpper](const QString& a, const QString& b) { if (a.contains("harpoon") && !b.contains("harpoon")) return false;
|
||||||
else if (a.isLower() && b.isUpper()) return true;
|
else if (myIsLower(a) && myIsUpper(b)) return true;
|
||||||
else if (a.isUpper() && b.isLower()) return false;
|
else if (myIsUpper(a) && myIsLower(b)) return false;
|
||||||
else return a<b;
|
else return a<b;
|
||||||
});
|
});
|
||||||
for (const QString& arrow: arrowNames) {
|
for (const QString& arrow: arrowNames) {
|
||||||
|
Loading…
Reference in New Issue
Block a user