1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 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 documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:BSD$
|
---|
10 | ** You may use this file under the terms of the BSD license as follows:
|
---|
11 | **
|
---|
12 | ** "Redistribution and use in source and binary forms, with or without
|
---|
13 | ** modification, are permitted provided that the following conditions are
|
---|
14 | ** met:
|
---|
15 | ** * Redistributions of source code must retain the above copyright
|
---|
16 | ** notice, this list of conditions and the following disclaimer.
|
---|
17 | ** * Redistributions in binary form must reproduce the above copyright
|
---|
18 | ** notice, this list of conditions and the following disclaimer in
|
---|
19 | ** the documentation and/or other materials provided with the
|
---|
20 | ** distribution.
|
---|
21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
---|
22 | ** the names of its contributors may be used to endorse or promote
|
---|
23 | ** products derived from this software without specific prior written
|
---|
24 | ** permission.
|
---|
25 | **
|
---|
26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
---|
30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
---|
37 | ** $QT_END_LICENSE$
|
---|
38 | **
|
---|
39 | ****************************************************************************/
|
---|
40 |
|
---|
41 | #include <QtGui>
|
---|
42 |
|
---|
43 | #include "stylewidget.h"
|
---|
44 |
|
---|
45 | StyleWidget::StyleWidget(QWidget *parent)
|
---|
46 | : QWidget(parent)
|
---|
47 | {
|
---|
48 | solid = new RenderArea(new QBrush(Qt::SolidPattern));
|
---|
49 | dense1 = new RenderArea(new QBrush(Qt::Dense1Pattern));
|
---|
50 | dense2 = new RenderArea(new QBrush(Qt::Dense2Pattern));
|
---|
51 | dense3 = new RenderArea(new QBrush(Qt::Dense3Pattern));
|
---|
52 | dense4 = new RenderArea(new QBrush(Qt::Dense4Pattern));
|
---|
53 | dense5 = new RenderArea(new QBrush(Qt::Dense5Pattern));
|
---|
54 | dense6 = new RenderArea(new QBrush(Qt::Dense6Pattern));
|
---|
55 | dense7 = new RenderArea(new QBrush(Qt::Dense7Pattern));
|
---|
56 | no = new RenderArea(new QBrush(Qt::NoBrush));
|
---|
57 | hor = new RenderArea(new QBrush(Qt::HorPattern));
|
---|
58 | ver = new RenderArea(new QBrush(Qt::VerPattern));
|
---|
59 | cross = new RenderArea(new QBrush(Qt::CrossPattern));
|
---|
60 | bdiag = new RenderArea(new QBrush(Qt::BDiagPattern));
|
---|
61 | fdiag = new RenderArea(new QBrush(Qt::FDiagPattern));
|
---|
62 | diagCross = new RenderArea(new QBrush(Qt::DiagCrossPattern));
|
---|
63 | linear = new RenderArea(new QBrush(QLinearGradient()));
|
---|
64 | radial = new RenderArea(new QBrush(QRadialGradient()));
|
---|
65 | conical = new RenderArea(new QBrush(QConicalGradient()));
|
---|
66 | texture = new RenderArea(new QBrush(QPixmap("qt-logo.png")));
|
---|
67 |
|
---|
68 | solidLabel = new QLabel("Qt::SolidPattern");
|
---|
69 | dense1Label = new QLabel("Qt::Dense1Pattern");
|
---|
70 | dense2Label = new QLabel("Qt::Dense2Pattern");
|
---|
71 | dense3Label = new QLabel("Qt::Dense3Pattern");
|
---|
72 | dense4Label = new QLabel("Qt::Dense4Pattern");
|
---|
73 | dense5Label = new QLabel("Qt::Dense5Pattern");
|
---|
74 | dense6Label = new QLabel("Qt::Dense6Pattern");
|
---|
75 | dense7Label = new QLabel("Qt::Dense7Pattern");
|
---|
76 | noLabel = new QLabel("Qt::NoPattern");
|
---|
77 | horLabel = new QLabel("Qt::HorPattern");
|
---|
78 | verLabel = new QLabel("Qt::VerPattern");
|
---|
79 | crossLabel = new QLabel("Qt::CrossPattern");
|
---|
80 | bdiagLabel = new QLabel("Qt::BDiagPattern");
|
---|
81 | fdiagLabel = new QLabel("Qt::FDiagPattern");
|
---|
82 | diagCrossLabel = new QLabel("Qt::DiagCrossPattern");
|
---|
83 | linearLabel = new QLabel("Qt::LinearGradientPattern");
|
---|
84 | radialLabel = new QLabel("Qt::RadialGradientPattern");
|
---|
85 | conicalLabel = new QLabel("Qt::ConicalGradientPattern");
|
---|
86 | textureLabel = new QLabel("Qt::TexturePattern");
|
---|
87 |
|
---|
88 | QGridLayout *layout = new QGridLayout;
|
---|
89 | layout->addWidget(solid, 0, 0);
|
---|
90 | layout->addWidget(dense1, 0, 1);
|
---|
91 | layout->addWidget(dense2, 0, 2);
|
---|
92 | layout->addWidget(solidLabel, 1, 0);
|
---|
93 | layout->addWidget(dense1Label, 1, 1);
|
---|
94 | layout->addWidget(dense2Label, 1, 2);
|
---|
95 |
|
---|
96 | layout->addWidget(dense3, 2, 0 );
|
---|
97 | layout->addWidget(dense4, 2, 1);
|
---|
98 | layout->addWidget(dense5, 2, 2);
|
---|
99 | layout->addWidget(dense3Label, 3, 0);
|
---|
100 | layout->addWidget(dense4Label, 3, 1);
|
---|
101 | layout->addWidget(dense5Label, 3, 2);
|
---|
102 |
|
---|
103 | layout->addWidget(dense6, 4, 0);
|
---|
104 | layout->addWidget(dense7, 4, 1);
|
---|
105 | layout->addWidget(no, 4, 2);
|
---|
106 | layout->addWidget(dense6Label, 5, 0);
|
---|
107 | layout->addWidget(dense7Label, 5, 1);
|
---|
108 | layout->addWidget(noLabel, 5, 2);
|
---|
109 |
|
---|
110 | layout->addWidget(hor, 6, 0);
|
---|
111 | layout->addWidget(ver, 6, 1);
|
---|
112 | layout->addWidget(cross, 6, 2);
|
---|
113 | layout->addWidget(horLabel, 7, 0);
|
---|
114 | layout->addWidget(verLabel, 7, 1);
|
---|
115 | layout->addWidget(crossLabel, 7, 2);
|
---|
116 |
|
---|
117 | layout->addWidget(bdiag, 8, 0);
|
---|
118 | layout->addWidget(fdiag, 8, 1);
|
---|
119 | layout->addWidget(diagCross, 8, 2);
|
---|
120 | layout->addWidget(bdiagLabel, 9, 0);
|
---|
121 | layout->addWidget(fdiagLabel, 9, 1);
|
---|
122 | layout->addWidget(diagCrossLabel, 9, 2);
|
---|
123 |
|
---|
124 | layout->addWidget(linear, 10, 0);
|
---|
125 | layout->addWidget(radial, 10, 1);
|
---|
126 | layout->addWidget(conical, 10, 2);
|
---|
127 | layout->addWidget(linearLabel, 11, 0);
|
---|
128 | layout->addWidget(radialLabel, 11, 1);
|
---|
129 | layout->addWidget(conicalLabel, 11, 2);
|
---|
130 |
|
---|
131 | layout->addWidget(texture, 12, 0, 1, 3);
|
---|
132 | layout->addWidget(textureLabel, 13, 0, 1, 3);
|
---|
133 |
|
---|
134 | setLayout(layout);
|
---|
135 |
|
---|
136 | QPalette newPalette = palette();
|
---|
137 | newPalette.setColor(QPalette::Window, Qt::white);
|
---|
138 | setPalette(newPalette);
|
---|
139 |
|
---|
140 | setWindowTitle(tr("Brush Styles"));
|
---|
141 | resize(430, 605);
|
---|
142 | }
|
---|
143 |
|
---|
144 |
|
---|