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

#include <qcssparser_p.h>

Public Functions

quint64 pseudoClass (quint64 *negated=0) const
 
QString pseudoElement () const
 
int specificity () const
 

Public Variables

QVector< BasicSelectorbasicSelectors
 

Detailed Description

Definition at line 555 of file qcssparser_p.h.

Functions

◆ pseudoClass()

quint64 Selector::pseudoClass ( quint64 negated = 0) const

Definition at line 1717 of file qcssparser.cpp.

Referenced by declarations(), QCss::StyleSelector::declarationsForNode(), QStyleSheetStyle::polish(), and QStyleSheetStyle::renderRule().

1718 {
1719  const BasicSelector& bs = basicSelectors.last();
1720  if (bs.pseudos.isEmpty())
1721  return PseudoClass_Unspecified;
1723  for (int i = !pseudoElement().isEmpty(); i < bs.pseudos.count(); i++) {
1724  const Pseudo &pseudo = bs.pseudos.at(i);
1725  if (pseudo.type == PseudoClass_Unknown)
1726  return PseudoClass_Unknown;
1727  if (!pseudo.negated)
1728  pc |= pseudo.type;
1729  else if (negated)
1730  *negated |= pseudo.type;
1731  }
1732  return pc;
1733 }
QString pseudoElement() const
QVector< BasicSelector > basicSelectors
Definition: qcssparser_p.h:557
const quint64 PseudoClass_Unknown
Definition: qcssparser_p.h:461
QVector< Pseudo > pseudos
Definition: qcssparser_p.h:549
unsigned __int64 quint64
Definition: qglobal.h:943
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
quint64 type
Definition: qcssparser_p.h:514
const quint64 PseudoClass_Unspecified
Definition: qcssparser_p.h:470

◆ pseudoElement()

QString Selector::pseudoElement ( ) const

Definition at line 1709 of file qcssparser.cpp.

Referenced by declarations(), QCss::StyleSelector::declarationsForNode(), and QStyleSheetStyle::hasStyleRule().

1710 {
1711  const BasicSelector& bs = basicSelectors.last();
1712  if (!bs.pseudos.isEmpty() && bs.pseudos.at(0).type == PseudoClass_Unknown)
1713  return bs.pseudos.at(0).name;
1714  return QString();
1715 }
QVector< BasicSelector > basicSelectors
Definition: qcssparser_p.h:557
The QString class provides a Unicode character string.
Definition: qstring.h:83
const quint64 PseudoClass_Unknown
Definition: qcssparser_p.h:461
QVector< Pseudo > pseudos
Definition: qcssparser_p.h:549

◆ specificity()

int Selector::specificity ( ) const

Definition at line 1695 of file qcssparser.cpp.

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

1696 {
1697  int val = 0;
1698  for (int i = 0; i < basicSelectors.count(); ++i) {
1699  const BasicSelector &sel = basicSelectors.at(i);
1700  if (!sel.elementName.isEmpty())
1701  val += 1;
1702 
1703  val += (sel.pseudos.count() + sel.attributeSelectors.count()) * 0x10;
1704  val += sel.ids.count() * 0x100;
1705  }
1706  return val;
1707 }
QVector< BasicSelector > basicSelectors
Definition: qcssparser_p.h:557
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QVector< Pseudo > pseudos
Definition: qcssparser_p.h:549
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QVector< AttributeSelector > attributeSelectors
Definition: qcssparser_p.h:550

Properties

◆ basicSelectors

QVector<BasicSelector> QCss::Selector::basicSelectors

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