mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
FIX issue #124 QGradient::Preset::NumPresets is undocumented and seems to be missing in some cases --> use QMetaEnum::fromType<QGradient::Preset>().keyCount() instead
This commit is contained in:
parent
378ae79517
commit
77f498f04d
@ -214,7 +214,7 @@ JKQTPExpected<QGradient, JKQTPCSSParser::GeneralError> JKQTPCSSParser::parseGrad
|
|||||||
|
|
||||||
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<QGradient::Preset::NumPresets; i++) {
|
for (int i=1; i<QMetaEnum::fromType<QGradient::Preset>().keyCount(); i++) {
|
||||||
const QString id=QString(QMetaEnum::fromType<QGradient::Preset>().valueToKey(static_cast<QGradient::Preset>(i))).toLower().trimmed().simplified();
|
const QString id=QString(QMetaEnum::fromType<QGradient::Preset>().valueToKey(static_cast<QGradient::Preset>(i))).toLower().trimmed().simplified();
|
||||||
if (id.size()>0) m[id]=static_cast<QGradient::Preset>(i);
|
if (id.size()>0) m[id]=static_cast<QGradient::Preset>(i);
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ namespace {
|
|||||||
|
|
||||||
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<QGradient::Preset::NumPresets; i++) {
|
for (int i=1; i<QMetaEnum::fromType<QGradient::Preset>().keyCount(); i++) {
|
||||||
const QString id=QString(QMetaEnum::fromType<QGradient::Preset>().valueToKey(static_cast<QGradient::Preset>(i))).toLower().trimmed().simplified();
|
const QString id=QString(QMetaEnum::fromType<QGradient::Preset>().valueToKey(static_cast<QGradient::Preset>(i))).toLower().trimmed().simplified();
|
||||||
if (id.size()>0) m[id]=static_cast<QGradient::Preset>(i);
|
if (id.size()>0) m[id]=static_cast<QGradient::Preset>(i);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user