1 /****************************************************************************
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
6 ** This file is part of the documentation of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
20 ** * Neither the name of The Qt Company Ltd nor the names of its
21 ** contributors may be used to endorse or promote products derived
22 ** from this software without specific prior written permission.
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
39 ****************************************************************************/
43 #include "stylewidget.h"
45 StyleWidget::StyleWidget(QWidget *parent)
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")));
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");
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);
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);
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);
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);
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);
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);
131 layout->addWidget(texture, 12, 0, 1, 3);
132 layout->addWidget(textureLabel, 13, 0, 1, 3);
136 QPalette newPalette = palette();
137 newPalette.setColor(QPalette::Window, Qt::white);
138 setPalette(newPalette);
140 setWindowTitle(tr("Brush Styles"));