Qt 4.8
Classes | Macros | Enumerations | Functions | Variables
qstylesheetstyle.cpp File Reference
#include <qglobal.h>
#include "qstylesheetstyle_p.h"
#include "private/qcssutil_p.h"
#include <qdebug.h>
#include <qapplication.h>
#include <qmenu.h>
#include <qmenubar.h>
#include <qpainter.h>
#include <qstyleoption.h>
#include <qlineedit.h>
#include <qwindowsstyle.h>
#include <qcombobox.h>
#include <qplastiquestyle.h>
#include "private/qcssparser_p.h"
#include "private/qmath_p.h"
#include <qabstractscrollarea.h>
#include "private/qabstractscrollarea_p.h"
#include <qtooltip.h>
#include <qshareddata.h>
#include <qradiobutton.h>
#include <qtoolbutton.h>
#include <qscrollbar.h>
#include <qstring.h>
#include <qfile.h>
#include <qcheckbox.h>
#include <qstatusbar.h>
#include <qheaderview.h>
#include <qprogressbar.h>
#include <private/qwindowsstyle_p.h>
#include <qtabbar.h>
#include <QMetaProperty>
#include <qmainwindow.h>
#include <qdockwidget.h>
#include <qmdisubwindow.h>
#include <qdialog.h>
#include <private/qwidget_p.h>
#include <QAbstractSpinBox>
#include <QLabel>
#include "qdrawutil.h"
#include <limits.h>
#include <QtGui/qtoolbar.h>
#include "moc_qstylesheetstyle_p.cpp"

Go to the source code of this file.

Classes

struct  PseudoElementInfo
 
class  QRenderRule
 
struct  QStyleSheetBackgroundData
 
struct  QStyleSheetBorderData
 
struct  QStyleSheetBorderImageData
 
struct  QStyleSheetBoxData
 
struct  QStyleSheetGeometryData
 
struct  QStyleSheetImageData
 
struct  QStyleSheetOutlineData
 
struct  QStyleSheetPaletteData
 
struct  QStyleSheetPositionData
 
class  QStyleSheetStylePrivate
 
class  QStyleSheetStyleRecursionGuard
 
class  QStyleSheetStyleSelector
 

Macros

#define ceil(x)   ((int)(x) + ((x) > 0 && (x) != (int)(x)))
 
#define RECURSION_GUARD(RETURN)
 
#define WIDGET(x)   (static_cast<QWidget *>(x.ptr))
 

Enumerations

enum  PseudoElement {
  PseudoElement_None, PseudoElement_DownArrow, PseudoElement_UpArrow, PseudoElement_LeftArrow,
  PseudoElement_RightArrow, PseudoElement_Indicator, PseudoElement_ExclusiveIndicator, PseudoElement_PushButtonMenuIndicator,
  PseudoElement_ComboBoxDropDown, PseudoElement_ComboBoxArrow, PseudoElement_Item, PseudoElement_SpinBoxUpButton,
  PseudoElement_SpinBoxUpArrow, PseudoElement_SpinBoxDownButton, PseudoElement_SpinBoxDownArrow, PseudoElement_GroupBoxTitle,
  PseudoElement_GroupBoxIndicator, PseudoElement_ToolButtonMenu, PseudoElement_ToolButtonMenuArrow, PseudoElement_ToolButtonDownArrow,
  PseudoElement_ToolBoxTab, PseudoElement_ScrollBarSlider, PseudoElement_ScrollBarAddPage, PseudoElement_ScrollBarSubPage,
  PseudoElement_ScrollBarAddLine, PseudoElement_ScrollBarSubLine, PseudoElement_ScrollBarFirst, PseudoElement_ScrollBarLast,
  PseudoElement_ScrollBarUpArrow, PseudoElement_ScrollBarDownArrow, PseudoElement_ScrollBarLeftArrow, PseudoElement_ScrollBarRightArrow,
  PseudoElement_SplitterHandle, PseudoElement_ToolBarHandle, PseudoElement_ToolBarSeparator, PseudoElement_MenuScroller,
  PseudoElement_MenuTearoff, PseudoElement_MenuCheckMark, PseudoElement_MenuSeparator, PseudoElement_MenuIcon,
  PseudoElement_MenuRightArrow, PseudoElement_TreeViewBranch, PseudoElement_HeaderViewSection, PseudoElement_HeaderViewUpArrow,
  PseudoElement_HeaderViewDownArrow, PseudoElement_ProgressBarChunk, PseudoElement_TabBarTab, PseudoElement_TabBarScroller,
  PseudoElement_TabBarTear, PseudoElement_SliderGroove, PseudoElement_SliderHandle, PseudoElement_SliderAddPage,
  PseudoElement_SliderSubPage, PseudoElement_SliderTickmark, PseudoElement_TabWidgetPane, PseudoElement_TabWidgetTabBar,
  PseudoElement_TabWidgetLeftCorner, PseudoElement_TabWidgetRightCorner, PseudoElement_DockWidgetTitle, PseudoElement_DockWidgetCloseButton,
  PseudoElement_DockWidgetFloatButton, PseudoElement_DockWidgetSeparator, PseudoElement_MdiCloseButton, PseudoElement_MdiMinButton,
  PseudoElement_MdiNormalButton, PseudoElement_TitleBar, PseudoElement_TitleBarCloseButton, PseudoElement_TitleBarMinButton,
  PseudoElement_TitleBarMaxButton, PseudoElement_TitleBarShadeButton, PseudoElement_TitleBarUnshadeButton, PseudoElement_TitleBarNormalButton,
  PseudoElement_TitleBarContextHelpButton, PseudoElement_TitleBarSysMenu, PseudoElement_ViewItem, PseudoElement_ViewItemIcon,
  PseudoElement_ViewItemText, PseudoElement_ViewItemIndicator, PseudoElement_ScrollAreaCorner, PseudoElement_TabBarTabCloseButton,
  NumPseudoElements
}
 

Functions

static QWidgetcontainerWidget (const QWidget *w)
 
static QVector< Declarationdeclarations (const QVector< StyleRule > &styleRules, const QString &part, quint64 pseudoClass=PseudoClass_Unspecified)
 
static Origin defaultOrigin (int pe)
 
static Qt::Alignment defaultPosition (int pe)
 
static PositionMode defaultPositionMode (int pe)
 
static QWidgetembeddedWidget (QWidget *w)
 
static quint64 extendedPseudoClass (const QWidget *w)
 
static QWidgetparentWidget (const QWidget *w)
 
static QLatin1String propertyNameForStandardPixmap (QStyle::StandardPixmap sp)
 
static quint64 pseudoClass (QStyle::State state)
 
static void qt_check_if_internal_widget (const QWidget **w, int *element)
 
static QStyle::StandardPixmap subControlIcon (int pe)
 
static QList< QVariantsubControlLayout (const QString &layout)
 
static bool unstylable (const QWidget *w)
 
static void updateWidgets (const QList< const QWidget *> &widgets)
 
static bool verticalTabs (QTabBar::Shape shape)
 

Variables

static const QStyleSheetStyleglobalStyleSheetStyle = 0
 
static const PseudoElementInfo knownPseudoElements [NumPseudoElements]
 
static const char * knownStyleHints []
 
static const int numKnownStyleHints = sizeof(knownStyleHints)/sizeof(knownStyleHints[0])
 
static QStyleSheetStyleCachesstyleSheetCaches = 0
 

Macro Definition Documentation

◆ ceil

#define ceil (   x)    ((int)(x) + ((x) > 0 && (x) != (int)(x)))

◆ RECURSION_GUARD

#define RECURSION_GUARD (   RETURN)

◆ WIDGET

#define WIDGET (   x)    (static_cast<QWidget *>(x.ptr))

Enumeration Type Documentation

◆ PseudoElement

Enumerator
PseudoElement_None 
PseudoElement_DownArrow 
PseudoElement_UpArrow 
PseudoElement_LeftArrow 
PseudoElement_RightArrow 
PseudoElement_Indicator 
PseudoElement_ExclusiveIndicator 
PseudoElement_PushButtonMenuIndicator 
PseudoElement_ComboBoxDropDown 
PseudoElement_ComboBoxArrow 
PseudoElement_Item 
PseudoElement_SpinBoxUpButton 
PseudoElement_SpinBoxUpArrow 
PseudoElement_SpinBoxDownButton 
PseudoElement_SpinBoxDownArrow 
PseudoElement_GroupBoxTitle 
PseudoElement_GroupBoxIndicator 
PseudoElement_ToolButtonMenu 
PseudoElement_ToolButtonMenuArrow 
PseudoElement_ToolButtonDownArrow 
PseudoElement_ToolBoxTab 
PseudoElement_ScrollBarSlider 
PseudoElement_ScrollBarAddPage 
PseudoElement_ScrollBarSubPage 
PseudoElement_ScrollBarAddLine 
PseudoElement_ScrollBarSubLine 
PseudoElement_ScrollBarFirst 
PseudoElement_ScrollBarLast 
PseudoElement_ScrollBarUpArrow 
PseudoElement_ScrollBarDownArrow 
PseudoElement_ScrollBarLeftArrow 
PseudoElement_ScrollBarRightArrow 
PseudoElement_SplitterHandle 
PseudoElement_ToolBarHandle 
PseudoElement_ToolBarSeparator 
PseudoElement_MenuScroller 
PseudoElement_MenuTearoff 
PseudoElement_MenuCheckMark 
PseudoElement_MenuSeparator 
PseudoElement_MenuIcon 
PseudoElement_MenuRightArrow 
PseudoElement_TreeViewBranch 
PseudoElement_HeaderViewSection 
PseudoElement_HeaderViewUpArrow 
PseudoElement_HeaderViewDownArrow 
PseudoElement_ProgressBarChunk 
PseudoElement_TabBarTab 
PseudoElement_TabBarScroller 
PseudoElement_TabBarTear 
PseudoElement_SliderGroove 
PseudoElement_SliderHandle 
PseudoElement_SliderAddPage 
PseudoElement_SliderSubPage 
PseudoElement_SliderTickmark 
PseudoElement_TabWidgetPane 
PseudoElement_TabWidgetTabBar 
PseudoElement_TabWidgetLeftCorner 
PseudoElement_TabWidgetRightCorner 
PseudoElement_DockWidgetTitle 
PseudoElement_DockWidgetCloseButton 
PseudoElement_DockWidgetFloatButton 
PseudoElement_DockWidgetSeparator 
PseudoElement_MdiCloseButton 
PseudoElement_MdiMinButton 
PseudoElement_MdiNormalButton 
PseudoElement_TitleBar 
PseudoElement_TitleBarCloseButton 
PseudoElement_TitleBarMinButton 
PseudoElement_TitleBarMaxButton 
PseudoElement_TitleBarShadeButton 
PseudoElement_TitleBarUnshadeButton 
PseudoElement_TitleBarNormalButton 
PseudoElement_TitleBarContextHelpButton 
PseudoElement_TitleBarSysMenu 
PseudoElement_ViewItem 
PseudoElement_ViewItemIcon 
PseudoElement_ViewItemText 
PseudoElement_ViewItemIndicator 
PseudoElement_ScrollAreaCorner 
PseudoElement_TabBarTabCloseButton 
NumPseudoElements 

Definition at line 131 of file qstylesheetstyle.cpp.

131  {
213 };

Function Documentation

◆ containerWidget()

static QWidget* containerWidget ( const QWidget w)
static
Warning
This function is not part of the public interface. in case w is an embedded widget, return the container widget (i.e, the widget for which the rules actualy apply) (exemple, if w is a lineedit embedded in a combobox, return the combobox)

if w is not embedded, return w itself

Definition at line 2356 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::drawPrimitive(), QStyleSheetStyle::styleSheetPalette(), unstylable(), and QStyleSheetStyle::updateStyleSheetFont().

2357 {
2358 #ifndef QT_NO_LINEEDIT
2359  if (qobject_cast<const QLineEdit *>(w)) {
2360  //if the QLineEdit is an embeddedWidget, we need the rule of the real widget
2361 #ifndef QT_NO_COMBOBOX
2362  if (qobject_cast<const QComboBox *>(w->parentWidget()))
2363  return w->parentWidget();
2364 #endif
2365 #ifndef QT_NO_SPINBOX
2366  if (qobject_cast<const QAbstractSpinBox *>(w->parentWidget()))
2367  return w->parentWidget();
2368 #endif
2369  }
2370 #endif // QT_NO_LINEEDIT
2371 
2372 #ifndef QT_NO_SCROLLAREA
2373  if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) {
2374  if (sa->viewport() == w)
2375  return w->parentWidget();
2376  }
2377 #endif
2378 
2379  return const_cast<QWidget *>(w);
2380 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.

◆ declarations()

static QVector<Declaration> declarations ( const QVector< StyleRule > &  styleRules,
const QString part,
quint64  pseudoClass = PseudoClass_Unspecified 
)
static

Definition at line 1597 of file qstylesheetstyle.cpp.

Referenced by QScript::AST::VariableStatement::accept0(), QScript::AST::LocalForStatement::accept0(), QDeclarativeJS::AST::VariableStatement::accept0(), QDeclarativeJS::AST::LocalForStatement::accept0(), QStyleSheetStyle::hasStyleRule(), QStyleSheetStyle::renderRule(), QDeclarativeXmlListModel::setNamespaceDeclarations(), QStyleSheetStyle::setProperties(), and QTextHtmlParserNode::uncollapsedMargin().

1598 {
1599  QVector<Declaration> decls;
1600  for (int i = 0; i < styleRules.count(); i++) {
1601  const Selector& selector = styleRules.at(i).selectors.at(0);
1602  // Rules with pseudo elements don't cascade. This is an intentional
1603  // diversion for CSS
1604  if (part.compare(selector.pseudoElement(), Qt::CaseInsensitive) != 0)
1605  continue;
1606  quint64 negated = 0;
1607  quint64 cssClass = selector.pseudoClass(&negated);
1608  if ((pseudoClass == PseudoClass_Any) || (cssClass == PseudoClass_Unspecified)
1609  || ((((cssClass & pseudoClass) == cssClass)) && ((negated & pseudoClass) == 0)))
1610  decls += styleRules.at(i).declarations;
1611  }
1612  return decls;
1613 }
QString pseudoElement() const
const quint64 PseudoClass_Any
Definition: qcssparser_p.h:508
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
quint64 pseudoClass(quint64 *negated=0) const
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
unsigned __int64 quint64
Definition: qglobal.h:943
QVector< Selector > selectors
Definition: qcssparser_p.h:605
QVector< Declaration > declarations
Definition: qcssparser_p.h:606
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int compare(const QString &s) const
Definition: qstring.cpp:5037
const quint64 PseudoClass_Unspecified
Definition: qcssparser_p.h:470
static quint64 pseudoClass(QStyle::State state)

◆ defaultOrigin()

static Origin defaultOrigin ( int  pe)
static

Definition at line 2061 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::positionRect(), and QStyleSheetStyle::subControlRect().

2062 {
2063  switch (pe) {
2071  case PseudoElement_GroupBoxIndicator: // never used
2075  return Origin_Border;
2076 
2085  return Origin_Padding;
2086 
2102  return Origin_Content;
2103 
2104  default:
2105  return Origin_Margin;
2106  }
2107 }

◆ defaultPosition()

static Qt::Alignment defaultPosition ( int  pe)
static

Definition at line 2109 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::positionRect().

2110 {
2111  switch (pe) {
2117 
2124 
2132  return Qt::AlignRight | Qt::AlignTop;
2133 
2144  return Qt::AlignCenter;
2145 
2147  case PseudoElement_GroupBoxIndicator: // never used
2148  return Qt::AlignLeft | Qt::AlignTop;
2149 
2154 
2155  default:
2156  return 0;
2157  }
2158 }

◆ defaultPositionMode()

static PositionMode defaultPositionMode ( int  pe)
static

◆ embeddedWidget()

static QWidget* embeddedWidget ( QWidget w)
static
Warning
This function is not part of the public interface. For widget that have an embedded widget (such as combobox) return that embedded widget. otherwise return the widget itself

Definition at line 2325 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::polish(), QStyleSheetStyle::setPalette(), and QStyleSheetStyle::unsetPalette().

2326 {
2327 #ifndef QT_NO_COMBOBOX
2328  if (QComboBox *cmb = qobject_cast<QComboBox *>(w)) {
2329  if (cmb->isEditable())
2330  return cmb->lineEdit();
2331  else
2332  return cmb;
2333  }
2334 #endif
2335 
2336 #ifndef QT_NO_SPINBOX
2337  if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w))
2338  return sb->findChild<QLineEdit *>();
2339 #endif
2340 
2341 #ifndef QT_NO_SCROLLAREA
2342  if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w))
2343  return sa->viewport();
2344 #endif
2345 
2346  return w;
2347 }
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66

◆ extendedPseudoClass()

static quint64 extendedPseudoClass ( const QWidget w)
static

Definition at line 2410 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::setGeometry(), QStyleSheetStyle::setPalette(), QStyleSheetStyle::styleSheetPalette(), and QStyleSheetStyle::updateStyleSheetFont().

2411 {
2412  quint64 pc = w->isWindow() ? quint64(PseudoClass_Window) : 0;
2413  if (const QAbstractSlider *slider = qobject_cast<const QAbstractSlider *>(w)) {
2414  pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal);
2415  } else
2416 #ifndef QT_NO_COMBOBOX
2417  if (const QComboBox *combo = qobject_cast<const QComboBox *>(w)) {
2418  if (combo->isEditable())
2419  pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly);
2420  } else
2421 #endif
2422 #ifndef QT_NO_LINEEDIT
2423  if (const QLineEdit *edit = qobject_cast<const QLineEdit *>(w)) {
2424  pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable);
2425  } else
2426 #endif
2427  { } // required for the above ifdef'ery to work
2428  return pc;
2429 }
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
const quint64 PseudoClass_Vertical
Definition: qcssparser_p.h:473
const quint64 PseudoClass_ReadOnly
Definition: qcssparser_p.h:492
const quint64 PseudoClass_Horizontal
Definition: qcssparser_p.h:472
unsigned __int64 quint64
Definition: qglobal.h:943
const quint64 PseudoClass_Window
Definition: qcssparser_p.h:474
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
const quint64 PseudoClass_Editable
Definition: qcssparser_p.h:501
The QAbstractSlider class provides an integer value within a range.
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66

◆ parentWidget()

static QWidget* parentWidget ( const QWidget w)
inlinestatic

Definition at line 1411 of file qstylesheetstyle.cpp.

Referenced by QGraphicsAnchorLayoutPrivate::addAnchor(), QLayout::addChildLayout(), QLayout::addChildWidget(), QLayout::alignmentRect(), QWidgetPrivate::create_sys(), QWidget::destroy(), getNetWmState(), QFormLayoutPrivate::getStyle(), QToolBarPrivate::init(), QTabBar::initStyleOption(), QWidgetPrivate::isBackgroundInherited(), isServerProcess(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QStyleSheetStyleSelector::parentNode(), q_createNativeChildrenAndSetParent(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), QWidgetPrivate::raise_sys(), QMainWindowLayout::removeFromMacToolbar(), QMainWindowLayout::removeToolBar(), QGraphicsWidgetPrivate::resolveLayoutDirection(), QDeclarativeVME::run(), QWidget::setShown(), QBoxLayoutPrivate::setupGeom(), QGridLayoutPrivate::setupSpacings(), QXlibWindow::setVisible(), QWidget::setWindowState(), QStyleSheetStyle::styleRules(), QMdiAreaTabBar::subWindowFromIndex(), QCoreFuriCuri::timerEvent(), QMainWindowLayout::toggleToolBarsVisible(), QLayout::totalHeightForWidth(), QLayout::totalMaximumSize(), QLayout::totalMinimumSize(), QLayout::totalSizeHint(), QAccessible::updateAccessibility(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), and updateRedirectedToGraphicsProxyWidget().

1412 {
1413  if(qobject_cast<const QLabel *>(w) && qstrcmp(w->metaObject()->className(), "QTipLabel") == 0) {
1414  QWidget *p = qvariant_cast<QWidget *>(w->property("_q_stylesheet_parent"));
1415  if (p)
1416  return p;
1417  }
1418  return w->parentWidget();
1419 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int qstrcmp(const char *str1, const char *str2)
A safe strcmp() function.
Definition: qbytearray.cpp:231
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
QVariant property(const char *name) const
Returns the value of the object&#39;s name property.
Definition: qobject.cpp:3807
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
T qvariant_cast(const QVariant &value)
Returns the given value converted to the template type T.
Definition: qvariant.h:571

◆ propertyNameForStandardPixmap()

static QLatin1String propertyNameForStandardPixmap ( QStyle::StandardPixmap  sp)
static
Warning
This function is not part of the public interface.

Definition at line 5013 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::standardIconImplementation(), and QStyleSheetStyle::standardPixmap().

5014 {
5015  switch (sp) {
5016  case QStyle::SP_TitleBarMenuButton: return QLatin1String("titlebar-menu-icon");
5017  case QStyle::SP_TitleBarMinButton: return QLatin1String("titlebar-minimize-icon");
5018  case QStyle::SP_TitleBarMaxButton: return QLatin1String("titlebar-maximize-icon");
5019  case QStyle::SP_TitleBarCloseButton: return QLatin1String("titlebar-close-icon");
5020  case QStyle::SP_TitleBarNormalButton: return QLatin1String("titlebar-normal-icon");
5021  case QStyle::SP_TitleBarShadeButton: return QLatin1String("titlebar-shade-icon");
5022  case QStyle::SP_TitleBarUnshadeButton: return QLatin1String("titlebar-unshade-icon");
5023  case QStyle::SP_TitleBarContextHelpButton: return QLatin1String("titlebar-contexthelp-icon");
5024  case QStyle::SP_DockWidgetCloseButton: return QLatin1String("dockwidget-close-icon");
5025  case QStyle::SP_MessageBoxInformation: return QLatin1String("messagebox-information-icon");
5026  case QStyle::SP_MessageBoxWarning: return QLatin1String("messagebox-warning-icon");
5027  case QStyle::SP_MessageBoxCritical: return QLatin1String("messagebox-critical-icon");
5028  case QStyle::SP_MessageBoxQuestion: return QLatin1String("messagebox-question-icon");
5029  case QStyle::SP_DesktopIcon: return QLatin1String("desktop-icon");
5030  case QStyle::SP_TrashIcon: return QLatin1String("trash-icon");
5031  case QStyle::SP_ComputerIcon: return QLatin1String("computer-icon");
5032  case QStyle::SP_DriveFDIcon: return QLatin1String("floppy-icon");
5033  case QStyle::SP_DriveHDIcon: return QLatin1String("harddisk-icon");
5034  case QStyle::SP_DriveCDIcon: return QLatin1String("cd-icon");
5035  case QStyle::SP_DriveDVDIcon: return QLatin1String("dvd-icon");
5036  case QStyle::SP_DriveNetIcon: return QLatin1String("network-icon");
5037  case QStyle::SP_DirOpenIcon: return QLatin1String("directory-open-icon");
5038  case QStyle::SP_DirClosedIcon: return QLatin1String("directory-closed-icon");
5039  case QStyle::SP_DirLinkIcon: return QLatin1String("directory-link-icon");
5040  case QStyle::SP_FileIcon: return QLatin1String("file-icon");
5041  case QStyle::SP_FileLinkIcon: return QLatin1String("file-link-icon");
5042  case QStyle::SP_FileDialogStart: return QLatin1String("filedialog-start-icon");
5043  case QStyle::SP_FileDialogEnd: return QLatin1String("filedialog-end-icon");
5044  case QStyle::SP_FileDialogToParent: return QLatin1String("filedialog-parent-directory-icon");
5045  case QStyle::SP_FileDialogNewFolder: return QLatin1String("filedialog-new-directory-icon");
5046  case QStyle::SP_FileDialogDetailedView: return QLatin1String("filedialog-detailedview-icon");
5047  case QStyle::SP_FileDialogInfoView: return QLatin1String("filedialog-infoview-icon");
5048  case QStyle::SP_FileDialogContentsView: return QLatin1String("filedialog-contentsview-icon");
5049  case QStyle::SP_FileDialogListView: return QLatin1String("filedialog-listview-icon");
5050  case QStyle::SP_FileDialogBack: return QLatin1String("filedialog-backward-icon");
5051  case QStyle::SP_DirIcon: return QLatin1String("directory-icon");
5052  case QStyle::SP_DialogOkButton: return QLatin1String("dialog-ok-icon");
5053  case QStyle::SP_DialogCancelButton: return QLatin1String("dialog-cancel-icon");
5054  case QStyle::SP_DialogHelpButton: return QLatin1String("dialog-help-icon");
5055  case QStyle::SP_DialogOpenButton: return QLatin1String("dialog-open-icon");
5056  case QStyle::SP_DialogSaveButton: return QLatin1String("dialog-save-icon");
5057  case QStyle::SP_DialogCloseButton: return QLatin1String("dialog-close-icon");
5058  case QStyle::SP_DialogApplyButton: return QLatin1String("dialog-apply-icon");
5059  case QStyle::SP_DialogResetButton: return QLatin1String("dialog-reset-icon");
5060  case QStyle::SP_DialogDiscardButton: return QLatin1String("discard-icon");
5061  case QStyle::SP_DialogYesButton: return QLatin1String("dialog-yes-icon");
5062  case QStyle::SP_DialogNoButton: return QLatin1String("dialog-no-icon");
5063  case QStyle::SP_ArrowUp: return QLatin1String("uparrow-icon");
5064  case QStyle::SP_ArrowDown: return QLatin1String("downarrow-icon");
5065  case QStyle::SP_ArrowLeft: return QLatin1String("leftarrow-icon");
5066  case QStyle::SP_ArrowRight: return QLatin1String("rightarrow-icon");
5067  case QStyle::SP_ArrowBack: return QLatin1String("backward-icon");
5068  case QStyle::SP_ArrowForward: return QLatin1String("forward-icon");
5069  case QStyle::SP_DirHomeIcon: return QLatin1String("home-icon");
5070  default: return QLatin1String("");
5071  }
5072 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ pseudoClass()

static quint64 pseudoClass ( QStyle::State  state)
static

Definition at line 1651 of file qstylesheetstyle.cpp.

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

1652 {
1653  quint64 pc = 0;
1654  if (state & QStyle::State_Enabled) {
1655  pc |= PseudoClass_Enabled;
1656  if (state & QStyle::State_MouseOver)
1657  pc |= PseudoClass_Hover;
1658  } else {
1659  pc |= PseudoClass_Disabled;
1660  }
1661  if (state & QStyle::State_Active)
1662  pc |= PseudoClass_Active;
1663  if (state & QStyle::State_Window)
1664  pc |= PseudoClass_Window;
1665  if (state & QStyle::State_Sunken)
1666  pc |= PseudoClass_Pressed;
1667  if (state & QStyle::State_HasFocus)
1668  pc |= PseudoClass_Focus;
1669  if (state & QStyle::State_On)
1671  if (state & QStyle::State_Off)
1673  if (state & QStyle::State_NoChange)
1675  if (state & QStyle::State_Selected)
1676  pc |= PseudoClass_Selected;
1677  if (state & QStyle::State_Horizontal)
1678  pc |= PseudoClass_Horizontal;
1679  else
1680  pc |= PseudoClass_Vertical;
1681  if (state & (QStyle::State_Open | QStyle::State_On | QStyle::State_Sunken))
1682  pc |= PseudoClass_Open;
1683  else
1684  pc |= PseudoClass_Closed;
1685  if (state & QStyle::State_Children)
1686  pc |= PseudoClass_Children;
1687  if (state & QStyle::State_Sibling)
1688  pc |= PseudoClass_Sibling;
1689  if (state & QStyle::State_ReadOnly)
1690  pc |= PseudoClass_ReadOnly;
1691  if (state & QStyle::State_Item)
1692  pc |= PseudoClass_Item;
1693 #ifdef QT_KEYPAD_NAVIGATION
1694  if (state & QStyle::State_HasEditFocus)
1695  pc |= PseudoClass_EditFocus;
1696 #endif
1697  return pc;
1698 }
const quint64 PseudoClass_Off
Definition: qcssparser_p.h:500
const quint64 PseudoClass_Open
Definition: qcssparser_p.h:504
const quint64 PseudoClass_Closed
Definition: qcssparser_p.h:503
const quint64 PseudoClass_Enabled
Definition: qcssparser_p.h:462
const quint64 PseudoClass_Focus
Definition: qcssparser_p.h:465
const quint64 PseudoClass_Hover
Definition: qcssparser_p.h:466
const quint64 PseudoClass_Vertical
Definition: qcssparser_p.h:473
const quint64 PseudoClass_Active
Definition: qcssparser_p.h:493
const quint64 PseudoClass_Pressed
Definition: qcssparser_p.h:464
const quint64 PseudoClass_ReadOnly
Definition: qcssparser_p.h:492
const quint64 PseudoClass_Checked
Definition: qcssparser_p.h:467
const quint64 PseudoClass_Unchecked
Definition: qcssparser_p.h:468
const quint64 PseudoClass_Horizontal
Definition: qcssparser_p.h:472
unsigned __int64 quint64
Definition: qglobal.h:943
const quint64 PseudoClass_Window
Definition: qcssparser_p.h:474
const quint64 PseudoClass_Sibling
Definition: qcssparser_p.h:476
const quint64 PseudoClass_Selected
Definition: qcssparser_p.h:471
const quint64 PseudoClass_EditFocus
Definition: qcssparser_p.h:505
const quint64 PseudoClass_Children
Definition: qcssparser_p.h:475
const quint64 PseudoClass_Indeterminate
Definition: qcssparser_p.h:469
const quint64 PseudoClass_Disabled
Definition: qcssparser_p.h:463
const quint64 PseudoClass_On
Definition: qcssparser_p.h:499
const quint64 PseudoClass_Item
Definition: qcssparser_p.h:502

◆ qt_check_if_internal_widget()

static void qt_check_if_internal_widget ( const QWidget **  w,
int *  element 
)
static

Definition at line 1700 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::renderRule().

1701 {
1702 #ifdef QT_NO_DOCKWIDGET
1703  Q_UNUSED(w);
1704  Q_UNUSED(element);
1705 #else
1706  if (*w && qstrcmp((*w)->metaObject()->className(), "QDockWidgetTitleButton") == 0) {
1707  if ((*w)->objectName() == QLatin1String("qt_dockwidget_closebutton")) {
1709  } else if ((*w)->objectName() == QLatin1String("qt_dockwidget_floatbutton")) {
1711  }
1712  *w = (*w)->parentWidget();
1713  }
1714 #endif
1715 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int qstrcmp(const char *str1, const char *str2)
A safe strcmp() function.
Definition: qbytearray.cpp:231
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ subControlIcon()

static QStyle::StandardPixmap subControlIcon ( int  pe)
static

Definition at line 845 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::drawComplexControl().

846 {
847  switch (pe) {
858  default: break;
859  }
860  return QStyle::SP_CustomBase;
861 }

◆ subControlLayout()

static QList<QVariant> subControlLayout ( const QString layout)
static

Definition at line 690 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::drawComplexControl(), QRenderRule::QRenderRule(), QStyleSheetStyle::sizeFromContents(), QStyleSheetStyle::subControlRect(), and QStyleSheetStyle::titleBarLayout().

691 {
693  for (int i = 0; i < layout.count(); i++) {
694  int button = layout[i].toAscii();
695  switch (button) {
696  case 'm':
699  break;
700  case 'M':
702  break;
703  case 'X':
706  break;
707  case 'N':
710  break;
711  case 'I':
713  break;
714  case 'T':
716  break;
717  case 'H':
719  break;
720  case 'S':
722  break;
723  default:
724  buttons.append(button);
725  break;
726  }
727  }
728  return buttons;
729 }
static Qt::MouseButtons buttons
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int count() const
Definition: qstring.h:103
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014

◆ unstylable()

static bool unstylable ( const QWidget w)
static
Warning
This function is not part of the public interface. returns true if the widget can NOT be styled directly

Definition at line 2385 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::initWidget().

2386 {
2387  if (w->windowType() == Qt::Desktop)
2388  return true;
2389 
2390  if (!w->styleSheet().isEmpty())
2391  return false;
2392 
2393  if (containerWidget(w) != w)
2394  return true;
2395 
2396 #ifndef QT_NO_FRAME
2397  // detect QComboBoxPrivateContainer
2398  else if (qobject_cast<const QFrame *>(w)) {
2399  if (0
2400 #ifndef QT_NO_COMBOBOX
2401  || qobject_cast<const QComboBox *>(w->parentWidget())
2402 #endif
2403  )
2404  return true;
2405  }
2406 #endif
2407  return false;
2408 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString styleSheet
the widget&#39;s style sheet
Definition: qwidget.h:220
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
static QWidget * containerWidget(const QWidget *w)
#define QT_NO_COMBOBOX

◆ updateWidgets()

static void updateWidgets ( const QList< const QWidget *> &  widgets)
static

Definition at line 2587 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::repolish().

2588 {
2590  for (int i = 0; i < widgets.size(); ++i) {
2591  const QWidget *widget = widgets.at(i);
2594  styleSheetCaches->renderRulesCache.remove(widget);
2595  }
2596  }
2597  for (int i = 0; i < widgets.size(); ++i) {
2598  QWidget *widget = const_cast<QWidget *>(widgets.at(i));
2599  if (widget == 0)
2600  continue;
2601  widget->style()->polish(widget);
2603  QApplication::sendEvent(widget, &event);
2604  widget->update();
2605  widget->updateGeometry();
2606  }
2607 }
EventRef event
QPointer< QWidget > widget
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QHash< const QWidget *, QHash< int, bool > > hasStyleRuleCache
QHash< const QWidget *, QRenderRules > renderRulesCache
QStyle * style() const
Definition: qwidget.cpp:2742
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
static QStyleSheetStyleCaches * styleSheetCaches
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
virtual void polish(QWidget *)
Initializes the appearance of the given widget.
Definition: qstyle.cpp:390
void updateGeometry()
Notifies the layout system that this widget has changed and may need to change geometry.
Definition: qwidget.cpp:10372
QHash< const QWidget *, QVector< QCss::StyleRule > > styleRulesCache
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ verticalTabs()

static bool verticalTabs ( QTabBar::Shape  shape)
inlinestatic

Variable Documentation

◆ globalStyleSheetStyle

const QStyleSheetStyle* globalStyleSheetStyle = 0
static

Definition at line 113 of file qstylesheetstyle.cpp.

Referenced by QRenderRule::QRenderRule().

◆ knownPseudoElements

const PseudoElementInfo knownPseudoElements[NumPseudoElements]
static

Definition at line 220 of file qstylesheetstyle.cpp.

◆ knownStyleHints

const char* knownStyleHints[]
static

Definition at line 599 of file qstylesheetstyle.cpp.

Referenced by QRenderRule::QRenderRule().

◆ numKnownStyleHints

const int numKnownStyleHints = sizeof(knownStyleHints)/sizeof(knownStyleHints[0])
static

Definition at line 688 of file qstylesheetstyle.cpp.

Referenced by QRenderRule::QRenderRule().

◆ styleSheetCaches

QStyleSheetStyleCaches* styleSheetCaches = 0
static

Definition at line 102 of file qstylesheetstyle.cpp.

Referenced by QStyleSheetStyle::~QStyleSheetStyle().