Qt 4.8
Public Functions | Public Variables | List of all members
QCss::StyleSheet Struct Reference

#include <qcssparser_p.h>

Public Functions

void buildIndexes (Qt::CaseSensitivity nameCaseSensitivity=Qt::CaseSensitive)
 
 StyleSheet ()
 

Public Variables

int depth
 
QMultiHash< QString, StyleRuleidIndex
 
QVector< ImportRuleimportRules
 
QVector< MediaRulemediaRules
 
QMultiHash< QString, StyleRulenameIndex
 
StyleSheetOrigin origin
 
QVector< PageRulepageRules
 
QVector< StyleRulestyleRules
 

Detailed Description

Definition at line 636 of file qcssparser_p.h.

Constructors and Destructors

◆ StyleSheet()

QCss::StyleSheet::StyleSheet ( )
inline

Functions

◆ buildIndexes()

void StyleSheet::buildIndexes ( Qt::CaseSensitivity  nameCaseSensitivity = Qt::CaseSensitive)

Definition at line 1737 of file qcssparser.cpp.

Referenced by QStyleSheetStyle::getDefaultStyleSheet(), and QCss::Parser::parse().

1738 {
1739  QVector<StyleRule> universals;
1740  for (int i = 0; i < styleRules.count(); ++i) {
1741  const StyleRule &rule = styleRules.at(i);
1742  QVector<Selector> universalsSelectors;
1743  for (int j = 0; j < rule.selectors.count(); ++j) {
1744  const Selector& selector = rule.selectors.at(j);
1745 
1746  if (selector.basicSelectors.isEmpty())
1747  continue;
1748 
1749  if (selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation) {
1750  if (selector.basicSelectors.count() != 1)
1751  continue;
1752  } else if (selector.basicSelectors.count() <= 1) {
1753  continue;
1754  }
1755 
1756  const BasicSelector &sel = selector.basicSelectors.at(selector.basicSelectors.count() - 1);
1757 
1758  if (!sel.ids.isEmpty()) {
1759  StyleRule nr;
1760  nr.selectors += selector;
1761  nr.declarations = rule.declarations;
1762  nr.order = i;
1763  idIndex.insert(sel.ids.at(0), nr);
1764  } else if (!sel.elementName.isEmpty()) {
1765  StyleRule nr;
1766  nr.selectors += selector;
1767  nr.declarations = rule.declarations;
1768  nr.order = i;
1769  QString name = sel.elementName;
1770  if (nameCaseSensitivity == Qt::CaseInsensitive)
1771  name=name.toLower();
1772  nameIndex.insert(name, nr);
1773  } else {
1774  universalsSelectors += selector;
1775  }
1776  }
1777  if (!universalsSelectors.isEmpty()) {
1778  StyleRule nr;
1779  nr.selectors = universalsSelectors;
1780  nr.declarations = rule.declarations;
1781  nr.order = i;
1782  universals << nr;
1783  }
1784  }
1785  styleRules = universals;
1786 }
QVector< BasicSelector > basicSelectors
Definition: qcssparser_p.h:557
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QMultiHash< QString, StyleRule > idIndex
Definition: qcssparser_p.h:646
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QVector< Selector > selectors
Definition: qcssparser_p.h:605
const char * name
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QVector< StyleRule > styleRules
Definition: qcssparser_p.h:639
QVector< Declaration > declarations
Definition: qcssparser_p.h:606
QMultiHash< QString, StyleRule > nameIndex
Definition: qcssparser_p.h:645
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
Definition: qstring.cpp:5389
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139

Properties

◆ depth

int QCss::StyleSheet::depth

◆ idIndex

QMultiHash<QString, StyleRule> QCss::StyleSheet::idIndex

Definition at line 646 of file qcssparser_p.h.

Referenced by QCss::StyleSelector::styleRulesForNode().

◆ importRules

QVector<ImportRule> QCss::StyleSheet::importRules

◆ mediaRules

QVector<MediaRule> QCss::StyleSheet::mediaRules

Definition at line 640 of file qcssparser_p.h.

Referenced by QCss::Parser::parse(), and QCss::StyleSelector::styleRulesForNode().

◆ nameIndex

QMultiHash<QString, StyleRule> QCss::StyleSheet::nameIndex

Definition at line 645 of file qcssparser_p.h.

Referenced by QCss::StyleSelector::styleRulesForNode().

◆ origin

StyleSheetOrigin QCss::StyleSheet::origin

◆ pageRules

QVector<PageRule> QCss::StyleSheet::pageRules

Definition at line 641 of file qcssparser_p.h.

Referenced by QCss::Parser::parse().

◆ styleRules

QVector<StyleRule> QCss::StyleSheet::styleRules

The documentation for this struct was generated from the following files: