51 #include "private/qfunctions_p.h" 53 #ifndef QT_NO_CSSPARSER 248 static const short indexOfId[
NumKnownValues] = { 0, 41, 48, 42, 49, 54, 35, 26, 70, 71, 25, 43, 5, 63, 47,
249 29, 58, 59, 27, 51, 61, 6, 10, 39, 56, 19, 13, 17, 18, 20, 21, 50, 24, 46, 67, 37, 3, 2, 40, 62, 16,
250 11, 57, 14, 32, 64, 33, 65, 55, 66, 34, 69, 8, 28, 38, 12, 36, 60, 7, 9, 4, 68, 53, 22, 23, 30, 31,
251 1, 15, 0, 52, 45, 44 };
255 if (
type == KnownIdentifier) {
369 :
declarations(decls), adjustment(0), fontExtracted(false), pal(pal)
404 if (decl.
d->parsed.isValid())
406 if (decl.
d->values.count() < 1)
409 decl.
d->parsed = QVariant::fromValue<LengthData>(
data);
415 if (decl.
d->parsed.isValid()) {
417 for (
int i = 0; i < 4; i++)
424 for (i = 0; i <
qMin(decl.
d->values.count(), 4); i++)
429 datas[0] = datas[1] = datas[2] = datas[3] =
zero;
431 datas[3] = datas[2] = datas[1] = datas[0];
440 for (i = 0; i < 4; i++) {
441 v += QVariant::fromValue<LengthData>(datas[i]);
453 switch (decl.
d->propertyId) {
475 switch (decl.
d->propertyId) {
498 switch (decl.
d->propertyId) {
533 if (decl.
d->parsed.isValid()) {
540 if (decl.
d->values.count() > 0)
542 if (decl.
d->values.count() > 1)
547 v << QVariant::fromValue<LengthData>(x[0]) << qVariantFromValue<LengthData>(x[1]);
555 for (
int i = 1; i < 4; i++)
566 switch (decl.
d->propertyId) {
604 borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
619 QSize *radii,
int *offsets)
625 switch (decl.
d->propertyId) {
654 Qt::Alignment
a[2] = { 0, 0 };
655 for (
int i = 0; i <
qMin(2, count); i++) {
658 switch (values[i].
variant.toInt()) {
692 if (lst.
count() != 2)
710 if (!p.parseExpr(&colorDigits))
713 for (
int i = 0; i <
qMin(colorDigits.
count(), 7); i += 2) {
715 colorDigits[i].variant = colorDigits.
at(i).
variant.
toReal() * (255. / 100.);
754 if (lst.
count() != 2)
771 bool dependsOnThePalette =
false;
773 while (parser.hasNext()) {
775 if (!parser.test(
IDENT))
779 if (!parser.test(
COLON))
785 if (!parser.parseTerm(&stop))
return BrushData();
788 if (!parser.parseTerm(&color))
return BrushData();
791 dependsOnThePalette =
true;
796 (void)parser.parseTerm(&value);
804 (void)parser.test(
COMMA);
815 if (dependsOnThePalette)
829 if (dependsOnThePalette)
842 if (dependsOnThePalette)
897 if (decl.
d->parsed.isValid()) {
909 if (decl.
d->values.isEmpty())
921 if (++i >= decl.
d->values.count()) {
922 decl.
d->parsed = QVariant::fromValue<BorderData>(
data);
930 if (++i >= decl.
d->values.count()) {
931 decl.
d->parsed = QVariant::fromValue<BorderData>(
data);
941 decl.
d->parsed = QVariant::fromValue<BorderData>(
data);
951 for (
int i = 0; i < values.
count(); ++i) {
966 *repeat = repeatAttempt;
973 if (i < values.
count() - 1
997 if (decl.
d->values.isEmpty())
1000 switch (decl.
d->propertyId) {
1009 if (decl.
d->parsed.isValid()) {
1010 *repeat =
static_cast<Repeat>(decl.
d->parsed.toInt());
1014 decl.
d->parsed = *repeat;
1027 if (decl.
d->parsed.isValid()) {
1030 *image = data.
image;
1039 decl.
d->parsed = QVariant::fromValue<BackgroundData>(
data);
1058 case Value_Small: *fontSizeAdjustment = -1;
break;
1063 default: valid =
false;
break;
1127 bool shouldAddSpace =
false;
1128 for (
int i = start; i < values.
count(); ++i) {
1132 shouldAddSpace =
false;
1141 shouldAddSpace =
true;
1151 for (
int i = 0; i < values.
count(); ++i) {
1172 *fontSizeAdjustment = -255;
1175 while (i < values.
count()) {
1183 if (i < values.
count()) {
1188 if (i < values.
count()) {
1227 if (decl.
d->values.isEmpty())
1230 switch (decl.
d->propertyId) {
1255 switch (decl.
d->propertyId) {
1280 switch (decl.
d->propertyId) {
1283 if (decl.
d->values.count() > 0 && decl.
d->values.at(0).type ==
Value::Uri) {
1285 QImageReader imageReader(decl.
d->values.at(0).variant.toString());
1286 if ((*size = imageReader.size()).
isNull()) {
1289 *size = imageReader.read().size();
1305 if (
d->values.count() != 1)
1308 if (
d->parsed.isValid()) {
1310 return qvariant_cast<QColor>(
d->parsed);
1317 d->parsed = QVariant::fromValue<int>(color.
role);
1320 d->parsed = QVariant::fromValue<QColor>(color.
color);
1327 if (
d->values.count() != 1)
1330 if (
d->parsed.isValid()) {
1332 return qvariant_cast<QBrush>(
d->parsed);
1340 d->parsed = QVariant::fromValue<int>(data.
role);
1344 d->parsed = QVariant::fromValue<QBrush>(data.
brush);
1351 int needParse = 0x1f;
1354 if (
d->parsed.isValid()) {
1357 for (i = 0; i <
qMin(v.
count(), 4); i++) {
1363 needParse |= (1<<i);
1367 if (needParse != 0) {
1369 for (i = 0; i <
qMin(
d->values.count(), 4); i++) {
1370 if (!(needParse & (1<<i)))
1374 v += QVariant::fromValue<int>(data.
role);
1378 v += QVariant::fromValue<QBrush>(data.
brush);
1385 if (needParse & 0x10)
1388 if (i == 0) c[0] = c[1] = c[2] = c[3] =
QBrush();
1389 else if (i == 1) c[3] = c[2] = c[1] = c[0];
1390 else if (i == 2) c[2] = c[0], c[3] = c[1];
1391 else if (i == 3) c[3] = c[1];
1396 if (
d->values.count() != 1)
1398 const Value &v =
d->values.at(0);
1425 int val = s.
toInt(&ok);
1433 if (
d->values.count() != 1)
1440 if (
d->parsed.isValid())
1441 return qvariant_cast<QSize>(
d->parsed);
1443 int x[2] = { 0, 0 };
1444 if (
d->values.count() > 0)
1446 if (
d->values.count() > 1)
1450 QSize size(x[0], x[1]);
1451 d->parsed = QVariant::fromValue<QSize>(size);
1457 if (
d->values.count() != 1)
1460 if (
d->parsed.isValid())
1461 return qvariant_cast<QRect>(
d->parsed);
1470 if (args.
count() != 4)
1473 d->parsed = QVariant::fromValue<QRect>(rect);
1480 if (
d->parsed.isValid()) {
1482 for (i = 0; i <
qMin(
d->values.count(), 4); i++) {
1491 for (i = 0; i <
qMin(
d->values.count(), 4); i++) {
1494 v += QVariant::fromValue<int>(color.
role);
1497 v += QVariant::fromValue<QColor>(color.
color);
1504 if (i == 0) c[0] = c[1] = c[2] = c[3] =
QColor();
1505 else if (i == 1) c[3] = c[2] = c[1] = c[0];
1506 else if (i == 2) c[2] = c[0], c[3] = c[1];
1507 else if (i == 3) c[3] = c[1];
1512 if (
d->values.count() != 1)
1520 for (i = 0; i <
qMin(
d->values.count(), 4); i++)
1523 else if (i == 1) s[3] = s[2] = s[1] = s[0];
1524 else if (i == 2) s[2] = s[0], s[3] = s[1];
1525 else if (i == 3) s[3] = s[1];
1530 if (
d->parsed.isValid())
1531 return static_cast<Repeat>(
d->parsed.toInt());
1532 if (
d->values.count() != 1)
1537 return static_cast<Repeat>(v);
1542 if (
d->parsed.isValid())
1543 return static_cast<Origin>(
d->parsed.toInt());
1544 if (
d->values.count() != 1)
1549 return static_cast<Origin>(v);
1554 if (
d->parsed.isValid())
1555 return static_cast<PositionMode>(
d->parsed.toInt());
1556 if (
d->values.count() != 1)
1566 if (
d->parsed.isValid())
1567 return static_cast<Attachment>(
d->parsed.toInt());
1568 if (
d->values.count() != 1)
1579 if (
d->parsed.isValid())
1580 return d->parsed.toInt();
1582 for (
int i = 0; i <
d->values.count(); i++) {
1583 features |=
static_cast<int>(
findKnownValue(
d->values.value(i).variant.toString(),
1586 d->parsed = features;
1592 if (
d->values.isEmpty() ||
d->values.at(0).type !=
Value::Uri)
1594 return d->values.at(0).variant.toString();
1599 if (
d->parsed.isValid())
1600 return Qt::Alignment(
d->parsed.toInt());
1601 if (
d->values.isEmpty() ||
d->values.count() > 2)
1604 Qt::Alignment v =
parseAlignment(
d->values.constData(),
d->values.count());
1612 *image = uriValue();
1613 for (
int i = 0; i < 4; i++)
1617 if (
d->values.count() < 2)
1622 for (i = 0; i <
qMin(
d->values.count()-1, 4); i++) {
1623 const Value& v =
d->values.at(i+1);
1628 if (i == 0) cuts[0] = cuts[1] = cuts[2] = cuts[3] = 0;
1629 else if (i == 1) cuts[3] = cuts[2] = cuts[1] = cuts[0];
1630 else if (i == 2) cuts[2] = cuts[0], cuts[3] = cuts[1];
1631 else if (i == 3) cuts[3] = cuts[1];
1648 if (
d->parsed.isValid())
1649 return qvariant_cast<QIcon>(
d->parsed);
1652 for (
int i = 0; i <
d->values.count();) {
1653 const Value &value =
d->values.at(i++);
1659 for (
int j = 0; j < 2; j++) {
1661 switch (
d->values.at(i).variant.toInt()) {
1682 if (i ==
d->values.count())
1689 d->parsed = QVariant::fromValue<QIcon>(icon);
1698 for (
int i = 0; i < basicSelectors.count(); ++i) {
1723 for (
int i = !pseudoElement().isEmpty(); i < bs.
pseudos.count(); i++) {
1730 *negated |= pseudo.
type;
1740 for (
int i = 0; i < styleRules.count(); ++i) {
1741 const StyleRule &rule = styleRules.at(i);
1743 for (
int j = 0; j < rule.
selectors.count(); ++j) {
1763 idIndex.insert(sel.
ids.
at(0), nr);
1772 nameIndex.
insert(name, nr);
1774 universalsSelectors += selector;
1777 if (!universalsSelectors.
isEmpty()) {
1785 styleRules = universals;
1796 return nodeNames(node).contains(nodeName, nameCaseSensitivity);
1812 return basicSelectorMatches(selector.
basicSelectors.at(0), node);
1818 node = duplicateNode(node);
1823 match = basicSelectorMatches(sel, node);
1840 NodePtr nextParent = parentNode(node);
1844 NodePtr previousSibling = previousSiblingNode(node);
1846 node = previousSibling;
1848 if (isNullNode(node)) {
1862 if (!hasAttributes(node))
1868 const QString attrValue = attribute(node, a.
name);
1879 && attrValue != a.
value)
1893 && sel.
ids != nodeIds(node))
1902 for (
int j = 0; j < rule.
selectors.count(); ++j) {
1904 if (selectorMatches(selector, node)) {
1907 + (
uint(origin) + depth)*0x100000;
1924 if (styleSheets.isEmpty())
1930 for (
int sheetIdx = 0; sheetIdx < styleSheets.count(); ++sheetIdx) {
1931 const StyleSheet &styleSheet = styleSheets.at(sheetIdx);
1932 for (
int i = 0; i < styleSheet.
styleRules.count(); ++i) {
1936 if (!styleSheet.
idIndex.isEmpty()) {
1938 for (
int i = 0; i < ids.
count(); i++) {
1941 while (it != styleSheet.
idIndex.constEnd() && it.
key() ==
key) {
1942 matchRule(node, it.
value(), styleSheet.
origin, styleSheet.
depth, &weightedRules);
1949 for (
int i = 0; i < names.
count(); i++) {
1955 matchRule(node, it.
value(), styleSheet.
origin, styleSheet.
depth, &weightedRules);
1960 if (!medium.isEmpty()) {
1961 for (
int i = 0; i < styleSheet.
mediaRules.count(); ++i) {
1963 for (
int j = 0; j < styleSheet.
mediaRules.at(i).styleRules.count(); ++j) {
1964 matchRule(node, styleSheet.
mediaRules.at(i).styleRules.at(j), styleSheet.
origin,
1965 styleSheet.
depth, &weightedRules);
1974 for ( ; it != weightedRules.
constEnd() ; ++
it)
1986 for (
int i = 0; i < rules.
count(); i++) {
1990 if (extraPseudo && pseudoElement ==
QLatin1String(extraPseudo)) {
2006 return (c >=
'0' && c <=
'9')
2007 || (c >=
'a' && c <=
'f')
2008 || (c >=
'A' && c <=
'F')
2016 if (hasEscapeSequences)
2017 *hasEscapeSequences =
false;
2020 while (i < output.
size()) {
2026 const int hexStart = i;
2027 while (i < output.
size()
2033 if (hexCount == 0) {
2034 if (hasEscapeSequences)
2035 *hasEscapeSequences =
true;
2039 hexCount =
qMin(hexCount, 6);
2043 output.
replace(hexStart - 1, hexCount + 1,
QChar(code));
2057 while (pos < input.size() - 1) {
2072 int tok = scanner.
lex();
2079 tok = scanner.
lex();
2088 for (
int i = 0; i < len; ++i) {
2091 result +=
text.at(start + i);
2105 hasEscapeSequences =
false;
2116 styleSheet = stream.
readAll();
2118 qWarning() <<
"QCss::Parser - Failed to load file " << css;
2125 hasEscapeSequences =
false;
2136 if (!next(
STRING))
return false;
2140 while (test(
S) || test(
CDO) || test(
CDC)) {}
2142 while (testImport()) {
2144 if (!parseImport(&rule))
return false;
2146 while (test(
S) || test(
CDO) || test(
CDC)) {}
2152 if (!parseMedia(&rule))
return false;
2154 }
else if (testPage()) {
2156 if (!parsePage(&rule))
return false;
2158 }
else if (testRuleset()) {
2160 if (!parseRuleset(&rule))
return false;
2163 if (!until(
RBRACE))
return false;
2164 }
else if (hasNext()) {
2167 while (test(
S) || test(
CDO) || test(
CDC)) {}
2168 }
while (hasNext());
2175 if (errorIndex == -1)
return Symbol();
2176 return symbols.at(errorIndex);
2193 importRule->
href = lexem();
2195 if (!testAndParseUri(&importRule->
href))
return false;
2202 if (!parseMedium(&importRule->
media))
return false;
2204 while (test(
COMMA)) {
2206 if (!parseNextMedium(&importRule->
media))
return false;
2220 if (!parseNextMedium(&mediaRule->
media))
return false;
2221 }
while (test(
COMMA));
2223 if (!next(
LBRACE))
return false;
2226 while (testRuleset()) {
2228 if (!parseRuleset(&rule))
return false;
2232 if (!next(
RBRACE))
return false;
2248 if (testPseudoPage())
2249 if (!parsePseudoPage(&pageRule->
selector))
return false;
2252 if (!next(
LBRACE))
return false;
2257 if (!parseNextDeclaration(&decl))
return false;
2262 if (!next(
RBRACE))
return false;
2269 if (!next(
IDENT))
return false;
2270 *selector = lexem();
2276 if (!hasNext())
return true;
2280 default: prev();
break;
2305 decl->
d->property = lexem();
2314 if (!parseSelector(&sel))
return false;
2317 while (test(
COMMA)) {
2320 if (!parseNextSelector(&sel))
return false;
2325 if (!next(
LBRACE))
return false;
2326 const int declarationStart =
index;
2332 if (!parseNextDeclaration(&decl)) {
2334 const bool foundSemicolon = until(
SEMICOLON);
2335 const int semicolonIndex =
index;
2337 index = declarationStart;
2338 const bool foundRBrace = until(
RBRACE);
2340 if (foundSemicolon && semicolonIndex <
index) {
2342 index = semicolonIndex - 1;
2352 if (!next(
RBRACE))
return false;
2360 if (!parseSimpleSelector(&basicSel))
return false;
2361 while (testCombinator()) {
2364 if (!testSimpleSelector())
break;
2368 if (!parseSimpleSelector(&basicSel))
return false;
2377 if (lookupElementName()) {
2378 if (!parseElementName(&basicSel->
elementName))
return false;
2393 }
else if (testClass()) {
2398 if (!parseClass(&a.
value))
return false;
2400 }
else if (testAttrib()) {
2403 if (!parseAttrib(&a))
return false;
2405 }
else if (testPseudo()) {
2408 if (!parsePseudo(&ps))
return false;
2411 if (onceMore) ++count;
2413 return count >= minCount;
2418 if (!next(
IDENT))
return false;
2427 case IDENT: *name = lexem();
break;
2428 default:
return false;
2436 if (!next(
IDENT))
return false;
2437 attr->
name = lexem();
2453 attr->
value = unquotedLexem();
2464 pseudo->
name = lexem();
2473 if (!test(
IDENT))
return false;
2474 pseudo->
name = lexem();
2481 if (!testProperty())
2483 if (!parseProperty(decl))
return false;
2484 if (!next(
COLON))
return false;
2486 if (!parseNextExpr(&decl->
d->values))
return false;
2488 if (!parsePrio(decl))
return false;
2510 declaration->
d->important =
true;
2518 if (!parseTerm(&val))
return false;
2524 if (!parseNextOperator(&val))
return false;
2530 if (!parseTerm(&val))
return false;
2552 bool haveUnary =
false;
2555 if (!hasNext())
return false;
2577 if (haveUnary)
return false;
2584 if (haveUnary)
return false;
2594 if (haveUnary)
return false;
2596 if (testHexColor()) {
2598 if (!parseHexColor(&col))
return false;
2601 }
else if (testFunction()) {
2603 if (!parseFunction(&name, &args))
return false;
2607 if (
QFileInfo(args).isRelative() && !sourcePath.isEmpty()) {
2616 return recordError();
2630 const int start =
index;
2631 if (!until(
RPAREN))
return false;
2632 for (
int i = start; i <
index - 1; ++i)
2633 args->
append(symbols.at(i).lexem());
2646 qWarning(
"QCssParser::parseHexColor: Unknown color name '%s'",lexem().toLatin1().constData());
2656 if (!testFunction())
return false;
2659 if (!parseFunction(&name, &args)) {
2674 return testElementName()
2683 if (hasNext() && next() == t)
2685 return recordError();
2690 if (
index >= symbols.count())
2692 if (symbols.at(
index).token == t) {
2712 while (hasNext() && next() != t)
2713 lexem += symbol().lexem();
2723 switch(symbols.at(
index-1).token) {
2724 case LBRACE: ++braceCount;
break;
2725 case LBRACKET: ++brackCount;
break;
2727 case LPAREN: ++parenCount;
break;
2731 while (
index < symbols.size()) {
2734 case LBRACE: ++braceCount;
break;
2735 case RBRACE: --braceCount;
break;
2736 case LBRACKET: ++brackCount;
break;
2737 case RBRACKET: --brackCount;
break;
2739 case LPAREN: ++parenCount;
break;
2740 case RPAREN: --parenCount;
break;
2743 if ((t == target || (target2 !=
NONE && t == target2))
2749 if (braceCount < 0 || brackCount < 0 || parenCount < 0) {
2759 if (!test(t))
return false;
2768 #endif // QT_NO_CSSPARSER The QVariant class acts like a union for the most common Qt data types.
bool selectorMatches(const Selector &rule, NodePtr node)
The QColor class provides colors based on RGB, HSV or CMYK values.
const quint64 PseudoClass_Open
QColor colorValue(const QPalette &=QPalette()) const
void buildIndexes(Qt::CaseSensitivity nameCaseSensitivity=Qt::CaseSensitive)
const quint64 PseudoClass_Closed
bool parseProperty(Declaration *decl)
const quint64 PseudoClass_Last
void setCapitalization(Capitalization)
Sets the capitalization of the text in this font to caps.
const quint64 PseudoClass_Enabled
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
bool parseTerm(Value *value)
void setNamedColor(const QString &name)
Sets the RGB value of this QColor to name, which may be in one of these formats:
static void parseShorthandBackgroundProperty(const QVector< QCss::Value > &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal)
QString pseudoElement() const
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
bool parsePrio(Declaration *declaration)
static bool setFontFamilyFromValues(const QVector< QCss::Value > &values, QFont *font, int start=0)
bool parseMedium(QStringList *media)
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
const QChar at(int i) const
Returns the character at the given index position in the string.
const quint64 PseudoClass_Exclusive
bool parseElementName(QString *name)
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
ushort toUShort(bool *ok=0, int base=10) const
Returns the string converted to an unsigned short using base base, which is 10 by default and must be...
bool parseNextOperator(Value *value)
#define it(className, varName)
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
enum QCss::BrushData::@265 type
const quint64 PseudoClass_Focus
const quint64 PseudoClass_Hover
QVector< BasicSelector > basicSelectors
const quint64 PseudoClass_Vertical
QString & replace(int i, int len, QChar after)
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
const quint64 PseudoClass_Active
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, h (hue), s (saturation), v (value), and a (alpha-channel, i.e.
QString & prepend(QChar c)
void colorValues(QColor *c, const QPalette &=QPalette()) const
const quint64 PseudoClass_Middle
bool parsePage(PageRule *pageRule)
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
bool parseSelector(Selector *sel)
static Qt::Alignment parseAlignment(const QCss::Value *values, int count)
State
This enum describes the state for which a pixmap is intended to be used.
QString unquotedLexem() const
int count(const Key &key) const
Returns the number of items associated with key key.
const quint64 PseudoClass_Minimized
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
static QString preprocess(const QString &input, bool *hasEscapeSequences=0)
void styleValues(BorderStyle *s) const
static const QCssKnownValue attachments[NumKnownAttachments - 1]
virtual QStringList nodeIds(NodePtr node) const
static bool match(const uchar *found, const char *target, uint len)
static QColor colorFromData(const ColorData &c, const QPalette &pal)
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
quint64 pseudoClass(quint64 *negated=0) const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
The QString class provides a Unicode character string.
Repeat repeatValue() const
static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
The QVector class is a template class that provides a dynamic array.
const quint64 PseudoClass_Pressed
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
The QChar class provides a 16-bit Unicode character.
const quint64 PseudoClass_ReadOnly
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
const T value(const Key &key) const
Returns the value associated with the key.
void brushValues(QBrush *c, const QPalette &=QPalette()) const
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
const quint64 PseudoClass_Checked
static bool setFontStyleFromValue(const QCss::Value &value, QFont *font)
static const QCssKnownValue pseudos[NumPseudos - 1]
const quint64 PseudoClass_Unchecked
bool parseAttrib(AttributeSelector *attr)
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
void setFamily(const QString &)
Sets the family name of the font.
static void removeOptionalQuotes(QString *str)
QExplicitlySharedDataPointer< DeclarationData > d
const Key & key() const
Returns the current item's key.
static const QCssKnownValue origins[NumKnownOrigins - 1]
iterator insertMulti(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
void reserve(int size)
Attempts to allocate memory for at least size characters.
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
void append(const T &t)
Inserts value at the end of the list.
const quint64 PseudoClass_Horizontal
int indexOf(const QRegExp &rx, int from=0) const
Returns the index position of the first exact match of rx in the list, searching forward from index p...
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
Compares a to b.
QMultiHash< QString, StyleRule > idIndex
const quint64 PseudoClass_Unknown
Attachment attachmentValue() const
QVector< Pseudo > pseudos
bool basicSelectorMatches(const BasicSelector &rule, NodePtr node)
bool parseRuleset(StyleRule *styleRule)
bool parseFunction(QString *name, QString *args)
static void setTextTransformFromValue(const QCss::Value &value, QFont *font)
const quint64 PseudoClass_Window
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
int size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
const quint64 PseudoClass_Left
static const QCssKnownValue positions[NumKnownPositionModes - 1]
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
QVector< Selector > selectors
const quint64 PseudoClass_Sibling
void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const
Mode
This enum type describes the mode for which a pixmap is intended to be used.
#define Q_STATIC_GLOBAL_OPERATOR
const T & at(int i) const
Returns the item at index position i in the list.
static BorderStyle parseStyleValue(QCss::Value v)
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
The QStringList class provides a list of strings.
static int toInt(const QByteArray &str)
void matchRule(NodePtr node, const StyleRule &rules, StyleSheetOrigin origin, int depth, QMap< uint, StyleRule > *weightedRules)
const quint64 PseudoClass_Movable
bool parseExpr(QVector< Value > *values)
void append(const T &t)
Inserts value at the end of the vector.
const quint64 PseudoClass_NonExclusive
QVector< StyleRule > styleRules
const T & value() const
Returns the current item's value.
Q_CORE_EXPORT void qWarning(const char *,...)
bool intValue(int *i, const char *unit=0) const
static QVector< Declaration > declarations(const QVector< StyleRule > &styleRules, const QString &part, quint64 pseudoClass=PseudoClass_Unspecified)
const quint64 PseudoClass_Right
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &name, const QCssKnownValue &prop)
static const char * data(const QByteArray &arr)
const quint64 PseudoClass_Bottom
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
const quint64 PseudoClass_Selected
Type
This enum type defines the types of variable that a QVariant can contain.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
The BorderImage element provides an image that can be used as a border.
QVector< MediaRule > mediaRules
const quint64 PseudoClass_Flat
bool parsePseudo(Pseudo *pseudo)
QVector< Declaration > declarations
const quint64 PseudoClass_Alternate
const quint64 PseudoClass_Frameless
static void setTextDecorationFromValues(const QVector< QCss::Value > &values, QFont *font)
static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
static void scan(const QString &preprocessedInput, QVector< Symbol > *symbols)
bool parsePseudoPage(QString *selector)
QString lexemUntil(TokenType t)
bool until(TokenType target, TokenType target2=NONE)
PositionMode positionValue() const
The QImageReader class provides a format independent interface for reading images from files or other...
const quint64 PseudoClass_Editable
const T & at(int i) const
Returns the item at index position i in the vector.
Spread
Specifies how the area outside the gradient area should be filled.
static void parseShorthandFontProperty(const QVector< QCss::Value > &values, QFont *font, int *fontSizeAdjustment)
static const QCssKnownValue values[NumKnownValues - 1]
bool convert(Type t)
Casts the variant to the requested type, t.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
bool parseClass(QString *name)
static bool isHexDigit(const char c)
uint qstrlen(const char *str)
The QMap::const_iterator class provides an STL-style const iterator for QMap and QMultiMap.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
static ColorData parseColorValue(QCss::Value v)
enum QCss::LengthData::@266 unit
QString & append(QChar c)
int compare(const QString &s) const
const quint64 PseudoClass_OnlyOne
QBrush brushValue(const QPalette &=QPalette()) const
The QFile class provides an interface for reading from and writing to files.
const quint64 PseudoClass_EditFocus
const quint64 PseudoClass_PreviousSelected
The QTextStream class provides a convenient interface for reading and writing text.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
static int lengthValueFromData(const LengthData &data, const QFont &f)
The QFont class specifies a font used for drawing text.
const quint64 PseudoClass_Unspecified
void clear()
Clears the contents of the string and makes it empty.
const quint64 PseudoClass_Children
QPair< qreal, QColor > QGradientStop
const quint64 PseudoClass_Maximized
Type type() const
Returns the storage type of the value stored in the variant.
bool parseSimpleSelector(BasicSelector *basicSel)
void setCoordinateMode(CoordinateMode mode)
Sets the coordinate mode of this gradient to mode.
void setOverline(bool)
If enable is true, sets overline on; otherwise sets overline off.
bool parseMedia(MediaRule *mediaRule)
enum QCss::ColorData::@264 type
QMultiHash< QString, StyleRule > nameIndex
ValueMatchType valueMatchCriterium
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
double toDouble(bool *ok=0) const
Returns the string converted to a double value.
virtual bool nodeNameEquals(NodePtr node, const QString &nodeName) const
const quint64 PseudoClass_Indeterminate
void setWeight(int)
Sets the weight the font to weight, which should be a value from the QFont::Weight enumeration...
bool parseHexColor(QColor *col)
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
bool testSimpleSelector()
T qvariant_cast(const QVariant &)
static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAdjustment)
QVector< Declaration > declarationsForNode(NodePtr node, const char *extraPseudo=0)
char toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0.
static const QCssKnownValue properties[NumProperties - 1]
static quint64 pseudoClass(QStyle::State state)
static QColor fromRgb(QRgb rgb)
Static convenience function that returns a QColor constructed from the given QRgb value rgb...
QVector< StyleRule > styleRulesForNode(NodePtr node)
void setPointSizeF(qreal)
Sets the point size to pointSize.
static const QCssKnownValue tileModes[NumKnownTileModes - 1]
const quint64 PseudoClass_First
static bool setFontWeightFromValue(const QCss::Value &value, QFont *font)
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
QString readAll()
Reads the entire content of the stream, and returns it as a QString.
bool parseNextDeclaration(Declaration *declaration)
bool realValue(qreal *r, const char *unit=0) const
The QSize class defines the size of a two-dimensional object using integer point precision.
bool parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity=Qt::CaseSensitive)
bool parseCombinator(BasicSelector::Relation *relation)
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
static void setFontVariantFromValue(const QCss::Value &value, QFont *font)
Origin originValue() const
const T * constData() const
Returns a const pointer to the data stored in the vector.
void reserve(int size)
Attempts to allocate memory for at least size elements.
const quint64 PseudoClass_Top
bool testTokenAndEndsWith(TokenType t, const QLatin1String &str)
bool isValid() const
Returns true if the color is valid; otherwise returns false.
static const QCssKnownValue repeats[NumKnownRepeats - 1]
const quint64 PseudoClass_Default
void setPixelSize(int)
Sets the font size to pixelSize pixels.
bool parseImport(ImportRule *importRule)
static const short indexOfId[NumKnownValues]
QVector< PageRule > pageRules
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
const quint64 PseudoClass_Closable
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
The QFileInfo class provides system-independent file information.
static const KeyPair *const end
static QBrush brushFromData(const BrushData &c, const QPalette &pal)
static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1]
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
bool testAndParseUri(QString *uri)
const quint64 PseudoClass_Disabled
QString & insert(int i, QChar c)
QString absolutePath() const
Returns a file's path absolute path.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QVector< AttributeSelector > attributeSelectors
void setStyle(Style style)
Sets the style of the font to style.
BorderStyle styleValue() const
Q_DECL_CONSTEXPR int qRound(qreal d)
Qt::Alignment alignmentValue() const
const quint64 PseudoClass_Floatable
The QMap class is a template class that provides a skip-list-based dictionary.
static bool isNull(const QVariant::Private *d)
qreal toReal(bool *ok=0) const
Returns the variant as a qreal if the variant has type() Double , QMetaType::Float ...
QVector< ImportRule > importRules
void init(const QString &css, bool file=false)
const quint64 PseudoClass_NextSelected
int styleFeaturesValue() const
const quint64 PseudoClass_Item
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.