6#include <QtCore/qmap.h>
19#ifndef QT_NO_CSSPARSER
29#include "qcssscanner.cpp"
143 {
"position", Position },
247static const short indexOfId[
NumKnownValues] = { 0, 44, 51, 45, 52, 53, 60, 37, 28, 78, 79, 27, 46, 6, 71, 50,
248 31, 65, 66, 29, 55, 69, 7, 11, 42, 62, 20, 14, 18, 19, 21, 23, 54, 26, 49, 75, 39, 3, 2, 43, 70, 17, 12,
249 63, 15, 34, 72, 35, 73, 61, 74, 36, 64, 22, 56, 41, 5, 57, 67, 77, 9, 30, 40, 13, 38, 68, 8, 10, 4, 76,
250 59, 24, 25, 32, 33, 1, 16, 0, 58, 48, 47 };
360 if ((prop ==
end) || (
name < *prop))
367 switch (propertyId) {
394: declarations(decls), adjustment(0), fontExtracted(
false), pal(pal)
416 data.number =
s.toDouble();
437int ValueExtractor::lengthValue(
const Declaration &decl)
439 if (decl.
d->parsed.isValid())
441 if (decl.
d->values.size() < 1)
444 decl.
d->parsed = QVariant::fromValue<LengthData>(
data);
450 if (decl.
d->parsed.isValid()) {
451 QList<QVariant>
v = decl.
d->parsed.toList();
453 for (
int i = 0;
i < 4;
i++)
460 for (
i = 0;
i <
qMin(decl.
d->values.size(), 4);
i++)
461 datas[
i] = lengthValue(decl.
d->values[
i]);
465 datas[0] = datas[1] = datas[2] = datas[3] =
zero;
467 datas[3] = datas[2] = datas[1] = datas[0];
477 for (
i = 0;
i < 4;
i++) {
478 v += QVariant::fromValue<LengthData>(datas[
i]);
488 for (
int i = 0;
i < declarations.size();
i++) {
490 switch (decl.
d->propertyId) {
491 case Width: *
w = lengthValue(decl);
break;
492 case Height: *
h = lengthValue(decl);
break;
510 for (
int i = 0;
i < declarations.size();
i++) {
512 switch (decl.
d->propertyId) {
513 case Left: *
left = lengthValue(decl);
break;
514 case Top: *
top = lengthValue(decl);
break;
515 case Right: *
right = lengthValue(decl);
break;
533 for (
int i = 0;
i < declarations.size();
i++) {
535 switch (decl.
d->propertyId) {
560 for (
int i = 0;
i < declarations.size();
i++) {
570 if (decl.
d->parsed.isValid()) {
571 QList<QVariant>
v = decl.
d->parsed.toList();
577 if (decl.
d->values.size() > 0)
578 x[0] = lengthValue(decl.
d->values.at(0));
579 if (decl.
d->values.size() > 1)
580 x[1] = lengthValue(decl.
d->values.at(1));
584 v << QVariant::fromValue<LengthData>(
x[0]) << QVariant::fromValue<LengthData>(
x[1]);
591 radii[0] = sizeValue(decl);
592 for (
int i = 1;
i < 4;
i++)
601 for (
int i = 0;
i < declarations.size();
i++) {
603 switch (decl.
d->propertyId) {
660 for (
int i = 0;
i < declarations.size();
i++) {
662 switch (decl.
d->propertyId) {
691 Qt::Alignment
a[2] = { { }, { } };
715 v.variant.convert(QMetaType::fromType<QColor>());
720 return qvariant_cast<QColor>(
v.variant);
732 const QString &identifier = lst.at(0);
743 const bool hsl = !
rgb && !hsv && identifier.
startsWith(
"hsl"_L1);
745 if (!
rgb && !hsv && !hsl)
748 const bool hasAlpha = identifier.
size() == 4 && identifier.
at(3) == u
'a';
756 QList<QCss::Value> colorDigits;
757 if (!
p.parseExpr(&colorDigits))
759 const int tokenCount = colorDigits.size();
761 for (
int i = 0;
i <
qMin(tokenCount, 7);
i += 2) {
763 const qreal maxRange = (
rgb ||
i != 0) ? 255. : 359.;
764 colorDigits[
i].variant = colorDigits.at(
i).variant.toReal() * (maxRange / 100.);
776 qWarning(
"QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'",
qPrintable(lst.join(u
' ')));
780 qWarning(
"QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'",
qPrintable(lst.join(u
' ')));
784 int v1 = colorDigits.at(0).variant.toInt();
785 int v2 = colorDigits.at(2).variant.toInt();
786 int v3 = colorDigits.at(4).variant.toInt();
788 if (tokenCount == 7) {
789 int alphaValue = colorDigits.at(6).variant.toInt();
791 alpha = colorDigits.at(6).variant.toReal() * 255.;
830 gradFuncs <<
"qlineargradient"_L1 <<
"qradialgradient"_L1 <<
"qconicalgradient"_L1 <<
"qgradient"_L1;
833 if ((gradType = gradFuncs.indexOf(lst.at(0).toLower())) == -1)
836 QHash<QString, qreal> vars;
837 QList<QGradientStop> stops;
841 spreads <<
"pad"_L1 <<
"reflect"_L1 <<
"repeat"_L1;
845 coordinateModes <<
"logical"_L1 <<
"stretchtodevice"_L1 <<
"objectbounding"_L1 <<
"object"_L1;
847 bool dependsOnThePalette =
false;
867 dependsOnThePalette =
true;
874 spread = spreads.indexOf(
value.variant.toString());
878 vars[attr] =
value.variant.toReal();
886 vars.value(
"x2"_L1), vars.value(
"y2"_L1));
892 if (dependsOnThePalette)
899 vars.value(
"radius"_L1), vars.value(
"fx"_L1),
900 vars.value(
"fy"_L1));
906 if (dependsOnThePalette)
912 QConicalGradient cg(vars.value(
"cx"_L1), vars.value(
"cy"_L1), vars.value(
"angle"_L1));
918 if (dependsOnThePalette)
938 switch (
v.variant.toInt()) {
973 if (decl.
d->parsed.isValid()) {
985 if (decl.
d->values.isEmpty())
995 data.width = lengthValue(decl.
d->values.at(
i));
997 if (++
i >= decl.
d->values.size()) {
998 decl.
d->parsed = QVariant::fromValue<BorderData>(
data);
1005 *style =
data.style;
1006 if (++
i >= decl.
d->values.size()) {
1007 decl.
d->parsed = QVariant::fromValue<BorderData>(
data);
1018 decl.
d->parsed = QVariant::fromValue<BorderData>(
data);
1029 for (
int i = 0;
i <
values.size(); ++
i) {
1032 *
image =
v.variant.toString();
1044 *repeat = repeatAttempt;
1073 for (
int i = 0;
i < declarations.size(); ++
i) {
1075 if (decl.
d->values.isEmpty())
1078 switch (decl.
d->propertyId) {
1084 *
image = val.variant.toString();
1087 if (decl.
d->parsed.isValid()) {
1088 *repeat =
static_cast<Repeat>(decl.
d->parsed.toInt());
1092 decl.
d->parsed = *repeat;
1105 if (decl.
d->parsed.isValid()) {
1109 *repeat =
data.repeat;
1117 decl.
d->parsed = QVariant::fromValue<BackgroundData>(
data);
1135 switch (
value.variant.toInt()) {
1136 case Value_Small: *fontSizeAdjustment = -1;
break;
1141 default: valid =
false;
break;
1153 if (
value.variant.convert(QMetaType::fromType<qreal>())) {
1160 if (
value.variant.convert(QMetaType::fromType<int>())) {
1172 switch (
value.variant.toInt()) {
1185 switch (
value.variant.toInt()) {
1197 switch (
value.variant.toInt()) {
1220 bool shouldAddSpace =
false;
1226 shouldAddSpace =
false;
1235 shouldAddSpace =
true;
1239 if (families.isEmpty())
1247 for (
int i = 0;
i <
values.size(); ++
i) {
1250 switch (
values.at(
i).variant.toInt()) {
1299 *fontSizeAdjustment = -255;
1323 switch (
value.variant.toInt()) {
1334 switch (
value.variant.toInt()) {
1343bool ValueExtractor::extractFont(
QFont *
font,
int *fontSizeAdjustment)
1345 if (fontExtracted) {
1347 *fontSizeAdjustment = adjustment;
1348 return fontExtracted == 1;
1352 for (
int i = 0;
i < declarations.size(); ++
i) {
1354 if (decl.
d->values.isEmpty())
1357 switch (decl.
d->propertyId) {
1375 adjustment = *fontSizeAdjustment;
1376 fontExtracted = hit ? 1 : 2;
1381 QBrush *selectedForeground,
1382 QBrush *selectedBackground,
1383 QBrush *alternateBackground,
1384 QBrush *placeHolderTextForeground,
1388 for (
int i = 0;
i < declarations.size(); ++
i) {
1390 switch (decl.
d->propertyId) {
1404void ValueExtractor::extractFont()
1409 extractFont(&
f, &dummy);
1415 for (
int i = 0;
i < declarations.size(); ++
i) {
1417 switch (decl.
d->propertyId) {
1420 if (decl.
d->values.size() > 0 && decl.
d->values.at(0).type ==
Value::Uri) {
1422 QImageReader imageReader(decl.
d->values.at(0).variant.toString());
1423 if ((*
size = imageReader.size()).isNull()) {
1426 *
size = imageReader.read().size();
1441 const auto declaration = std::find_if(
1442 declarations.rbegin(), declarations.rend(),
1443 [](
const Declaration &decl) { return decl.d->propertyId == QtIcon; });
1444 if (declaration == declarations.rend())
1447 *
icon = declaration->iconValue();
1450 if (declaration->d->values.isEmpty())
1453 const auto &propertyValue = declaration->d->values.constFirst();
1458 const QString url(propertyValue.variant.toString());
1460 *
size = imageReader.size();
1461 if (!
size->isNull())
1465 *
size = imageReader.read().size();
1473 if (
d->values.size() != 1)
1476 if (
d->parsed.isValid()) {
1477 switch (
d->parsed.typeId()) {
1478 case qMetaTypeId<QColor>():
1479 return qvariant_cast<QColor>(
d->parsed);
1480 case qMetaTypeId<int>():
1482 case qMetaTypeId<QList<QVariant>>():
1483 if (
d->parsed.toList().size() == 1) {
1484 auto parsedList =
d->parsed.toList();
1485 const auto &
value = parsedList.at(0);
1486 return qvariant_cast<QColor>(
value);
1494 d->parsed = QVariant::fromValue<int>(
color.role);
1497 d->parsed = QVariant::fromValue<QColor>(
color.color);
1504 if (
d->values.size() != 1)
1507 if (
d->parsed.isValid()) {
1508 if (
d->parsed.userType() == QMetaType::QBrush)
1509 return qvariant_cast<QBrush>(
d->parsed);
1510 if (
d->parsed.userType() == QMetaType::Int)
1517 d->parsed = QVariant::fromValue<int>(
data.role);
1521 d->parsed = QVariant::fromValue<QBrush>(
data.brush);
1528 int needParse = 0x1f;
1531 if (
d->parsed.isValid()) {
1534 QList<QVariant>
v =
d->parsed.toList();
1535 for (
i = 0;
i <
qMin(
v.size(), 4);
i++) {
1536 if (
v.at(
i).userType() == QMetaType::QBrush) {
1537 c[
i] = qvariant_cast<QBrush>(
v.at(
i));
1538 }
else if (
v.at(
i).userType() == QMetaType::Int) {
1541 needParse |= (1<<
i);
1545 if (needParse != 0) {
1547 for (
i = 0;
i <
qMin(
d->values.size(), 4);
i++) {
1548 if (!(needParse & (1<<
i)))
1552 v += QVariant::fromValue<int>(
data.role);
1556 v += QVariant::fromValue<QBrush>(
data.brush);
1563 if (needParse & 0x10)
1567 else if (
i == 1)
c[3] =
c[2] =
c[1] =
c[0];
1568 else if (
i == 2)
c[2] =
c[0],
c[3] =
c[1];
1569 else if (
i == 3)
c[3] =
c[1];
1574 if (
d->values.size() != 1)
1576 const Value &
v =
d->values.at(0);
1585 s.chop(unitStr.size());
1604 s.chop(unitStr.size());
1615 if (
d->values.size() != 1)
1622 if (
d->parsed.isValid())
1623 return qvariant_cast<QSize>(
d->parsed);
1625 int x[2] = { 0, 0 };
1626 const int count =
d->values.size();
1629 qWarning(
"QCssParser::sizeValue: Too many values provided");
1632 const auto &
value =
d->values.at(
i);
1638 x[
i] = (
x[
i] * 72) / 96;
1647 d->parsed = QVariant::fromValue<QSize>(
size);
1653 if (
d->values.size() != 1)
1656 if (
d->parsed.isValid())
1657 return qvariant_cast<QRect>(
d->parsed);
1663 if (
func.size() != 2 ||
func.at(0).compare(
"rect"_L1) != 0)
1669 d->parsed = QVariant::fromValue<QRect>(
rect);
1676 if (
d->parsed.isValid()) {
1677 QList<QVariant>
v =
d->parsed.toList();
1678 for (
i = 0;
i <
qMin(
d->values.size(), 4);
i++) {
1679 if (
v.at(
i).userType() == QMetaType::QColor) {
1680 c[
i] = qvariant_cast<QColor>(
v.at(
i));
1687 for (
i = 0;
i <
qMin(
d->values.size(), 4);
i++) {
1690 v += QVariant::fromValue<int>(
color.role);
1693 v += QVariant::fromValue<QColor>(
color.color);
1701 else if (
i == 1)
c[3] =
c[2] =
c[1] =
c[0];
1702 else if (
i == 2)
c[2] =
c[0],
c[3] =
c[1];
1703 else if (
i == 3)
c[3] =
c[1];
1708 if (
d->values.size() != 1)
1716 for (
i = 0;
i <
qMin(
d->values.size(), 4);
i++)
1719 else if (
i == 1)
s[3] =
s[2] =
s[1] =
s[0];
1720 else if (
i == 2)
s[2] =
s[0],
s[3] =
s[1];
1721 else if (
i == 3)
s[3] =
s[1];
1726 if (
d->parsed.isValid())
1727 return static_cast<Repeat>(
d->parsed.toInt());
1728 if (
d->values.size() != 1)
1733 return static_cast<Repeat>(
v);
1738 if (
d->parsed.isValid())
1739 return static_cast<Origin>(
d->parsed.toInt());
1740 if (
d->values.size() != 1)
1745 return static_cast<Origin>(
v);
1750 if (
d->parsed.isValid())
1752 if (
d->values.size() != 1)
1762 if (
d->parsed.isValid())
1763 return static_cast<Attachment>(
d->parsed.toInt());
1764 if (
d->values.size() != 1)
1775 if (
d->parsed.isValid())
1776 return d->parsed.toInt();
1778 for (
int i = 0;
i <
d->values.size();
i++) {
1779 features |=
static_cast<int>(
findKnownValue(
d->values.value(
i).variant.toString(),
1782 d->parsed = features;
1788 if (
d->values.isEmpty() ||
d->values.at(0).type !=
Value::Uri)
1790 return d->values.at(0).variant.toString();
1795 if (
d->parsed.isValid())
1796 return Qt::Alignment(
d->parsed.toInt());
1797 if (
d->values.isEmpty() ||
d->values.size() > 2)
1810 for (
int i = 0;
i < 4;
i++)
1814 if (
d->values.size() < 2)
1819 for (
i = 0;
i <
qMin(
d->values.size()-1, 4);
i++) {
1820 const Value&
v =
d->values.at(
i+1);
1823 cuts[
i] =
v.variant.toString().toInt();
1825 if (
i == 0) cuts[0] = cuts[1] = cuts[2] = cuts[3] = 0;
1826 else if (
i == 1) cuts[3] = cuts[2] = cuts[1] = cuts[0];
1827 else if (
i == 2) cuts[2] = cuts[0], cuts[3] = cuts[1];
1828 else if (
i == 3) cuts[3] = cuts[1];
1845 if (
d->values.size() != 1)
1848 return d->values.at(0).toString() ==
"collapse"_L1;
1854 return QList<qreal>();
1856 bool isValid =
true;
1857 QList<qreal> dashes;
1858 for (
int i = 0;
i <
d->values.size();
i++) {
1868 dashes.append(
v.variant.toReal(&
ok));
1876 isValid &= !(dashes.size() & 1);
1877 return isValid ? dashes : QList<qreal>();
1882 if (
d->parsed.isValid())
1883 return qvariant_cast<QIcon>(
d->parsed);
1886 for (
int i = 0;
i <
d->values.size();) {
1893 for (
int j = 0;
j < 2;
j++) {
1895 switch (
d->values.at(
i).variant.toInt()) {
1916 if (
i ==
d->values.size())
1923 d->parsed = QVariant::fromValue<QIcon>(
icon);
1934 if (!sel.elementName.isEmpty())
1937 val += (sel.pseudos.size() + sel.attributeSelectors.size()) * 0x10;
1938 val += sel.ids.size() * 0x100;
1947 return bs.pseudos.at(0).name;
1954 if (bs.pseudos.isEmpty())
1958 const Pseudo &pseudo = bs.pseudos.at(
i);
1961 if (!pseudo.negated)
1964 *negated |= pseudo.type;
1973 QList<StyleRule> universals;
1976 QList<Selector> universalsSelectors;
1977 for (
int j = 0;
j <
rule.selectors.size(); ++
j) {
1980 if (
selector.basicSelectors.isEmpty())
1984 if (
selector.basicSelectors.size() != 1)
1986 }
else if (
selector.basicSelectors.size() <= 1) {
1992 if (!sel.ids.isEmpty()) {
1995 nr.declarations =
rule.declarations;
1997 idIndex.insert(sel.ids.at(0), nr);
1998 }
else if (!sel.elementName.isEmpty()) {
2001 nr.declarations =
rule.declarations;
2011 if (!universalsSelectors.isEmpty()) {
2014 nr.declarations =
rule.declarations;
2040 if (
selector.basicSelectors.isEmpty())
2044 if (
selector.basicSelectors.size() != 1)
2046 return basicSelectorMatches(
selector.basicSelectors.at(0), node);
2048 if (
selector.basicSelectors.size() <= 1)
2051 int i =
selector.basicSelectors.size() - 1;
2057 match = basicSelectorMatches(sel, node);
2059 if (
i ==
selector.basicSelectors.size() - 1)
2084 node = previousSibling;
2098bool StyleSelector::basicSelectorMatches(
const BasicSelector &sel, NodePtr node)
2100 if (!sel.attributeSelectors.isEmpty()) {
2104 for (
int i = 0;
i < sel.attributeSelectors.size(); ++
i) {
2108 if (attrValue.isNull())
2111 switch (
a.valueMatchCriterium) {
2115 if (attrValue !=
a.value)
2121 for (
auto s : lst) {
2132 const QString dashPrefix =
a.value + u
'-';
2133 if (attrValue !=
a.value && !attrValue.startsWith(dashPrefix))
2138 if (!attrValue.startsWith(
a.value))
2142 if (!attrValue.endsWith(
a.value))
2146 if (!attrValue.contains(
a.value))
2153 if (!sel.elementName.isEmpty()
2157 if (!sel.ids.isEmpty()
2165 int depth, QMultiMap<uint, StyleRule> *weightedRules)
2167 for (
int j = 0;
j <
rule.selectors.size(); ++
j) {
2169 if (selectorMatches(
selector, node)) {
2174 if (
rule.selectors.size() > 1) {
2175 newRule.selectors.resize(1);
2179 weightedRules->insert(
weight, newRule);
2188 QList<StyleRule> rules;
2192 QMultiMap<uint, StyleRule> weightedRules;
2195 for (
int sheetIdx = 0; sheetIdx <
styleSheets.size(); ++sheetIdx) {
2201 if (!styleSheet.
idIndex.isEmpty()) {
2203 for (
int i = 0;
i <
ids.size();
i++) {
2207 matchRule(node,
it.value(), styleSheet.
origin, styleSheet.
depth, &weightedRules);
2214 for (
int i = 0;
i <
names.size();
i++) {
2220 matchRule(node,
it.value(), styleSheet.
origin, styleSheet.
depth, &weightedRules);
2228 for (
int j = 0;
j < styleSheet.
mediaRules.at(
i).styleRules.size(); ++
j) {
2230 styleSheet.
depth, &weightedRules);
2237 rules.reserve(weightedRules.size());
2249 QList<Declaration> decls;
2251 for (
int i = 0;
i < rules.size();
i++) {
2256 decls += rules.at(
i).declarations;
2264 decls += rules.at(
i).declarations;
2271 return (
c >=
'0' &&
c <=
'9')
2272 || (
c >=
'a' &&
c <=
'f')
2273 || (
c >=
'A' &&
c <=
'F')
2281 if (hasEscapeSequences)
2282 *hasEscapeSequences =
false;
2291 const int hexStart =
i;
2298 if (hexCount == 0) {
2299 if (hasEscapeSequences)
2300 *hasEscapeSequences =
true;
2304 hexCount =
qMin(hexCount, 6);
2308 output.replace(hexStart - 1, hexCount + 1, code);
2336 int tok = scanner.lex();
2339 sym.
text = scanner.input;
2340 sym.
start = scanner.lexemStart;
2341 sym.
len = scanner.lexemLength;
2342 symbols->append(sym);
2343 tok = scanner.lex();
2352 for (
int i = 0;
i <
len; ++
i) {
2380 styleSheet =
stream.readAll();
2382 qWarning() <<
"QCss::Parser - Failed to load file " << css;
2457 importRule->href =
lexem();
2466 if (!
parseMedium(&importRule->media))
return false;
2493 mediaRule->styleRules.append(
rule);
2503 media->append(
lexem());
2523 pageRule->declarations.append(decl);
2544 default:
prev();
break;
2571 decl->
d->property =
lexem();
2582 styleRule->selectors.append(sel);
2588 styleRule->selectors.append(sel);
2593 const int declarationStart =
index;
2598 const int rewind =
index;
2602 const int semicolonIndex =
index;
2604 index = declarationStart;
2607 if (foundSemicolon && semicolonIndex <
index) {
2609 index = semicolonIndex - 1;
2616 styleRule->declarations.append(decl);
2632 sel->basicSelectors.append(basicSel);
2637 sel->basicSelectors.append(basicSel);
2658 basicSel->ids.
append(theid);
2663 a.
name =
"class"_L1;
2666 basicSel->attributeSelectors.
append(
a);
2671 basicSel->attributeSelectors.append(
a);
2676 basicSel->pseudos.append(ps);
2678 if (onceMore) ++
count;
2680 return count >= minCount;
2695 default:
return false;
2737 pseudo->name =
lexem();
2742 pseudo->function =
lexem();
2744 pseudo->function.chop(1);
2747 pseudo->name =
lexem();
2767 const int rewind =
index;
2783 declaration->
d->important =
true;
2825 bool haveUnary =
false;
2838 value->variant.convert(QMetaType::fromType<double>());
2850 if (haveUnary)
return false;
2857 if (haveUnary)
return false;
2862 value->variant = theid;
2867 if (haveUnary)
return false;
2873 value->variant = col;
2877 if (
name ==
"url"_L1) {
2921 qWarning(
"QCssParser::parseHexColor: Unknown color name '%s'",
lexem().toLatin1().constData());
2930 const int rewind =
index;
2999 case LBRACE: ++braceCount;
break;
3000 case LBRACKET: ++brackCount;
break;
3002 case LPAREN: ++parenCount;
break;
3009 case LBRACE: ++braceCount;
break;
3010 case RBRACE: --braceCount;
break;
3011 case LBRACKET: ++brackCount;
break;
3012 case RBRACKET: --brackCount;
break;
3014 case LPAREN: ++parenCount;
break;
3015 case RPAREN: --parenCount;
break;
3024 if (braceCount < 0 || brackCount < 0 || parenCount < 0) {
3034 if (!
test(
t))
return false;
The QColor class provides colors based on RGB, HSV or CMYK values.
static QColor fromRgb(QRgb rgb) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgb.
static QColor fromString(QAnyStringView name) noexcept
static QColor fromHsv(int h, int s, int v, int a=255)
Static convenience function that returns a QColor constructed from the HSV color values,...
static QColor fromHsl(int h, int s, int l, int a=255)
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
bool parsePseudoPage(QString *selector)
bool parseFunction(QString *name, QString *args)
bool until(TokenType target, TokenType target2=NONE)
bool parseSelector(Selector *sel)
bool parseSimpleSelector(BasicSelector *basicSel)
bool parseRuleset(StyleRule *styleRule)
bool parsePage(PageRule *pageRule)
void init(const QString &css, bool file=false)
bool testTokenAndEndsWith(TokenType t, QLatin1StringView str)
bool parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity=Qt::CaseSensitive)
bool testSimpleSelector()
bool parseCombinator(BasicSelector::Relation *relation)
bool parseNextOperator(Value *value)
bool parseNextMedium(QStringList *media)
bool parseMedium(QStringList *media)
const Symbol & symbol() const
QString unquotedLexem() const
bool parsePseudo(Pseudo *pseudo)
bool parseClass(QString *name)
bool parseProperty(Declaration *decl)
bool parseMedia(MediaRule *mediaRule)
bool parseNextExpr(QList< Value > *values)
bool parseNextSelector(Selector *sel)
bool parseAttrib(AttributeSelector *attr)
bool parseTerm(Value *value)
QString lexemUntil(TokenType t)
bool parseNextDeclaration(Declaration *declaration)
bool lookupElementName() const
bool testAndParseUri(QString *uri)
bool parseExpr(QList< Value > *values)
bool parseElementName(QString *name)
bool parseHexColor(QColor *col)
bool parsePrio(Declaration *declaration)
bool parseImport(ImportRule *importRule)
static QString preprocess(const QString &input, bool *hasEscapeSequences=nullptr)
static void scan(const QString &preprocessedInput, QList< Symbol > *symbols)
virtual NodePtr parentNode(NodePtr node) const =0
virtual QStringList nodeNames(NodePtr node) const =0
virtual bool nodeNameEquals(NodePtr node, const QString &nodeName) const
virtual NodePtr previousSiblingNode(NodePtr node) const =0
virtual void freeNode(NodePtr node) const =0
virtual bool hasAttributes(NodePtr node) const =0
virtual bool isNullNode(NodePtr node) const =0
QList< StyleSheet > styleSheets
virtual NodePtr duplicateNode(NodePtr node) const =0
virtual QString attributeValue(NodePtr node, const QCss::AttributeSelector &aSelector) const =0
Qt::CaseSensitivity nameCaseSensitivity
virtual QStringList nodeIds(NodePtr node) const
QList< StyleRule > styleRulesForNode(NodePtr node)
QList< Declaration > declarationsForNode(NodePtr node, const char *extraPseudo=nullptr)
QString absolutePath() const
Returns the absolute path of the file system entry this QFileInfo refers to, excluding the entry's na...
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
\reentrant \inmodule QtGui
int height() const
Returns the height of the font.
int xHeight() const
Returns the 'x' height of the font.
void setStyle(Style style)
Sets the style of the font to style.
void setOverline(bool)
If enable is true, sets overline on; otherwise sets overline off.
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
void setFamilies(const QStringList &)
void setCapitalization(Capitalization)
void setWordSpacing(qreal spacing)
void setLetterSpacing(SpacingType type, qreal spacing)
void setKerning(bool)
Enables kerning for this font if enable is true; otherwise disables it.
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
void setPointSizeF(qreal)
Sets the point size to pointSize.
Weight
Qt uses a weighting scale from 1 to 1000 compatible with OpenType.
void setWeight(Weight weight)
Sets the weight of the font to weight, using the scale defined by \l QFont::Weight enumeration.
void setSpread(Spread spread)
Specifies the spread method that should be used for this gradient.
void setCoordinateMode(CoordinateMode mode)
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
Spread
Specifies how the area outside the gradient area should be filled.
The QIcon class provides scalable icons in different modes and states.
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
State
This enum describes the state for which a pixmap is intended to be used.
The QImageReader class provides a format independent interface for reading images from files or other...
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void prepend(rvalue_ref t)
void reserve(qsizetype size)
void append(parameter_type t)
The QPalette class contains color groups for each widget state.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
\inmodule QtCore\reentrant
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
constexpr auto tokenize(Needle &&needle, Flags...flags) const noexcept(noexcept(qTokenize(std::declval< const QStringView & >(), std::forward< Needle >(needle), flags...))) -> decltype(qTokenize(*this, std::forward< Needle >(needle), flags...))
Q_CORE_EXPORT QList< QStringView > split(QStringView sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the view into substring views wherever sep occurs, and returns the list of those string views.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
void chop(qsizetype n)
Removes n characters from the end of the string.
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
void clear()
Clears the contents of the string and makes it null.
qsizetype size() const noexcept
Returns the number of characters in this string.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString toLower() const &
QString & append(QChar c)
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
qreal toReal(bool *ok=nullptr) const
Returns the variant as a qreal if the variant has userType() \l QMetaType::Double,...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QSet< QString >::iterator it
const quint64 PseudoClass_Unknown
const quint64 PseudoClass_Floatable
const quint64 PseudoClass_Movable
const quint64 PseudoClass_Children
const quint64 PseudoClass_Disabled
const quint64 PseudoClass_Sibling
const quint64 PseudoClass_ReadOnly
const quint64 PseudoClass_Closed
const quint64 PseudoClass_Maximized
const quint64 PseudoClass_Default
const quint64 PseudoClass_Bottom
const quint64 PseudoClass_EditFocus
const quint64 PseudoClass_Focus
const quint64 PseudoClass_Enabled
const quint64 PseudoClass_Editable
const quint64 PseudoClass_Vertical
const quint64 PseudoClass_Flat
const quint64 PseudoClass_NonExclusive
const quint64 PseudoClass_Pressed
const quint64 PseudoClass_Item
const quint64 PseudoClass_Alternate
const quint64 PseudoClass_PreviousSelected
const quint64 PseudoClass_Closable
const quint64 PseudoClass_Horizontal
const quint64 PseudoClass_Active
const quint64 PseudoClass_NextSelected
@ StyleFeature_BackgroundGradient
@ StyleFeature_BackgroundColor
const quint64 PseudoClass_Open
const quint64 PseudoClass_Frameless
const quint64 PseudoClass_Checked
const quint64 PseudoClass_Selected
const quint64 PseudoClass_Right
@ OutlineBottomRightRadius
@ BorderBottomRightRadius
@ OutlineBottomLeftRadius
@ QtForegroundTextureCacheKey
const quint64 PseudoClass_Window
const quint64 PseudoClass_Minimized
const quint64 PseudoClass_Unspecified
const quint64 PseudoClass_Unchecked
const quint64 PseudoClass_First
const quint64 PseudoClass_Indeterminate
const quint64 PseudoClass_Middle
const quint64 PseudoClass_Top
const quint64 PseudoClass_Hover
const quint64 PseudoClass_Left
const quint64 PseudoClass_Last
const quint64 PseudoClass_OnlyOne
const quint64 PseudoClass_Exclusive
Combined button and popup list for selecting options.
QPair< qreal, QColor > QGradientStop
QList< QString > QStringList
Constructs a string list that contains the given string, str.
static void setTextDecorationFromValues(const QList< QCss::Value > &values, QFont *font)
static void removeOptionalQuotes(QString *str)
static bool setFontFamilyFromValues(const QList< QCss::Value > &values, QFont *font, int start=0)
static bool setFontWeightFromValue(const QCss::Value &value, QFont *font)
static const QCssKnownValue origins[NumKnownOrigins - 1]
static int lengthValueFromData(const LengthData &data, const QFont &f)
static void setTextTransformFromValue(const QCss::Value &value, QFont *font)
static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAdjustment)
static const QCssKnownValue pseudos[NumPseudos - 1]
static bool setFontStyleFromValue(const QCss::Value &value, QFont *font)
static ColorData parseColorValue(QCss::Value v)
static BorderStyle parseStyleValue(const QCss::Value &v)
static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1]
static void setFontVariantFromValue(const QCss::Value &value, QFont *font)
static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues)
static const QCssKnownValue positions[NumKnownPositionModes - 1]
static Qt::Alignment parseAlignment(const QCss::Value *values, int count)
static void setLetterSpacingFromValue(const QCss::Value &value, QFont *font)
static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
static const QCssKnownValue properties[NumProperties - 1]
static bool isHexDigit(const char c)
static bool isInheritable(Property propertyId)
static bool setFontKerningFromValue(const QCss::Value &value, QFont *font)
static void parseShorthandBackgroundProperty(const QList< QCss::Value > &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal)
static void parseShorthandFontProperty(const QList< QCss::Value > &values, QFont *font, int *fontSizeAdjustment)
static const QCssKnownValue tileModes[NumKnownTileModes - 1]
static QBrush brushFromData(const BrushData &c, const QPalette &pal)
static const short indexOfId[NumKnownValues]
static void setWordSpacingFromValue(const QCss::Value &value, QFont *font)
static const QCssKnownValue repeats[NumKnownRepeats - 1]
static QColor colorFromData(const ColorData &c, const QPalette &pal)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char * rule
static bool isValidNumber(QChar c)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
GLint GLfloat GLfloat GLfloat v2
GLenum GLsizei GLsizei GLint * values
[15]
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint * ids
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLuint GLfloat weight
GLsizei const GLenum * attachments
GLint GLfloat GLfloat GLfloat GLfloat v3
GLfloat GLfloat GLfloat GLfloat h
GLuint GLsizei const GLuint const GLintptr * offsets
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLenum GLuint GLenum target2
GLfloat GLfloat GLfloat alpha
GLenum GLenum GLenum GLenum GLenum scale
GLenum GLenum GLenum input
static QGradient::CoordinateMode coordinateMode(const QBrush &brush)
static bool hasAlpha(const QImage &image)
static QT_BEGIN_NAMESPACE bool isRelative(const QString &path)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
#define qPrintable(string)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
static int compare(quint64 a, quint64 b)
unsigned long long quint64
static int toInt(const QChar &qc, int R)
QT_BEGIN_NAMESPACE typedef uchar * output
QFileSelector selector
[1]
QUrl url("example.com")
[constructor-url-reference]
ValueMatchType valueMatchCriterium
@ MatchNextSelectorIfDirectAdjecent
@ MatchNextSelectorIfIndirectAdjecent
@ MatchNextSelectorIfParent
@ MatchNextSelectorIfAncestor
enum QCss::BrushData::@368 type
enum QCss::ColorData::@367 type
void colorValues(QColor *c, const QPalette &=QPalette()) const
int styleFeaturesValue() const
Attachment attachmentValue() const
Origin originValue() const
void styleValues(BorderStyle *s) const
Qt::Alignment alignmentValue() const
bool realValue(qreal *r, const char *unit=nullptr) const
QExplicitlySharedDataPointer< DeclarationData > d
QColor colorValue(const QPalette &=QPalette()) const
void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const
void brushValues(QBrush *c, const QPalette &=QPalette()) const
bool intValue(int *i, const char *unit=nullptr) const
QList< qreal > dashArray() const
BorderStyle styleValue() const
Repeat repeatValue() const
PositionMode positionValue() const
bool borderCollapseValue() const
QBrush brushValue(const QPalette &=QPalette()) const
enum QCss::LengthData::@369 unit
QList< BasicSelector > basicSelectors
QString pseudoElement() const
quint64 pseudoClass(quint64 *negated=nullptr) const
QList< Selector > selectors
QList< StyleRule > styleRules
QList< MediaRule > mediaRules
Q_GUI_EXPORT void buildIndexes(Qt::CaseSensitivity nameCaseSensitivity=Qt::CaseSensitive)
QMultiHash< QString, StyleRule > idIndex
QMultiHash< QString, StyleRule > nameIndex
QList< ImportRule > importRules
QList< PageRule > pageRules
Q_GUI_EXPORT QString lexem() const
Q_GUI_EXPORT QString toString() const