source: trunk/src/gui/styles/qstylesheetstyle_default.cpp@ 661

Last change on this file since 661 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 14.9 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/* This is the default Qt style sheet.
43
44 IMPORTANT: This style sheet is primarily meant for defining feature
45 capablities of styles. Do NOT add default styling rules here. When in
46 doubt ask the stylesheet maintainer.
47
48 The stylesheet in here used to be in a CSS file, but was moved here to
49 avoid parsing overhead.
50*/
51
52#include "private/qcssparser_p.h"
53#include "qstylesheetstyle_p.h"
54
55#ifndef QT_NO_STYLE_STYLESHEET
56
57QT_BEGIN_NAMESPACE
58
59using namespace QCss;
60
61// This is the class name of the selector.
62// Use an empty string where you would use '*' in CSS.
63// Ex. QHeaderView
64
65#define SET_ELEMENT_NAME(x) \
66 bSelector.elementName = (x)
67
68// This acts as both pseudo state and sub control. The first parameter is the
69// string name, and the second is the PseudoClass_* constant.
70// The sub control specifier is always the first, and has the type
71// PseudoClass_Unknown.
72// If there is no PseudoClass_Unknown as the first pseudo, it is assumed to be
73// a pseudo state.
74// Ex. QComboBox::drop-down:enabled
75// ^ ^
76
77#define ADD_PSEUDO(x, y) \
78 pseudo.type = (y); \
79 pseudo.name = (x); \
80 bSelector.pseudos << pseudo
81
82// This is attributes. The third parameter is AttributeSelector::*
83// Ex. QComboBox[style="QWindowsXPStyle"]
84// ^ ^
85
86#define ADD_ATTRIBUTE_SELECTOR(x, y, z) \
87 attr.name = (x); \
88 attr.value = (y); \
89 attr.valueMatchCriterium = (z); \
90 bSelector.attributeSelectors << attr
91
92// Adds the current basic selector to the rule.
93// Several basic selectors behave as AND (space in CSS).
94
95#define ADD_BASIC_SELECTOR \
96 selector.basicSelectors << bSelector; \
97 bSelector.ids.clear(); \
98 bSelector.pseudos.clear(); \
99 bSelector.attributeSelectors.clear()
100
101// Adds the current selector to the rule.
102// Several selectors behave as OR (comma in CSS).
103
104#define ADD_SELECTOR \
105 styleRule.selectors << selector; \
106 selector.basicSelectors.clear()
107
108// Sets the name of a property.
109// Ex. background: red;
110// ^
111
112#define SET_PROPERTY(x, y) \