source: trunk/doc/src/snippets/brushstyles/stylewidget.cpp@ 568

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

trunk: Merged in qt 4.6.1 sources.

File size: 5.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 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: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#include <QtGui>
43
44#include "stylewidget.h"
45
46StyleWidget::StyleWidget(QWidget *parent)
47 : QWidget(parent)
48{
49 solid = new RenderArea(new QBrush(Qt::SolidPattern));
50 dense1 = new RenderArea(new QBrush(Qt::Dense1Pattern));
51 dense2 = new RenderArea(new QBrush(Qt::Dense2Pattern));
52 dense3 = new RenderArea(new QBrush(Qt::Dense3Pattern));
53 dense4 = new RenderArea(new QBrush(Qt::Dense4Pattern));
54 dense5 = new RenderArea(new QBrush(Qt::Dense5Pattern));
55 dense6 = new RenderArea(new QBrush(Qt::Dense6Pattern));
56 dense7 = new RenderArea(new QBrush(Qt::Dense7Pattern));
57 no = new RenderArea(new QBrush(Qt::NoBrush));
58 hor = new RenderArea(new QBrush(Qt::HorPattern));
59 ver = new RenderArea(new QBrush(Qt::VerPattern));
60 cross = new RenderArea(new QBrush(Qt::CrossPattern));
61 bdiag = new RenderArea(new QBrush(Qt::BDiagPattern));
62 fdiag = new RenderArea(new QBrush(Qt::FDiagPattern));
63 diagCross = new RenderArea(new QBrush(Qt::DiagCrossPattern));
64 linear = new RenderArea(new QBrush(QLinearGradient()));
65 radial = new RenderArea(new QBrush(QRadialGradient()));
66 conical = new RenderArea(new QBrush(QConicalGradient()));
67 texture = new RenderArea(new QBrush(QPixmap("qt-logo.png")));
68
69 solidLabel = new QLabel("Qt::SolidPattern");
70 dense1Label = new QLabel("Qt::Dense1Pattern");
71 dense2Label = new QLabel("Qt::Dense2Pattern");
72 dense3Label = new QLabel("Qt::Dense3Pattern");
73 dense4Label = new QLabel("Qt::Dense4Pattern");
74 dense5Label = new QLabel("Qt::Dense5Pattern");
75 dense6Label = new QLabel("Qt::Dense6Pattern");
76 dense7Label = new QLabel("Qt::Dense7Pattern");
77 noLabel = new QLabel("Qt::NoPattern");
78 horLabel = new QLabel("Qt::HorPattern");
79 verLabel = new QLabel("Qt::VerPattern");
80 crossLabel = new QLabel("Qt::CrossPattern");
81 bdiagLabel = new QLabel("Qt::BDiagPattern");
82 fdiagLabel = new QLabel("Qt::FDiagPattern");
83 diagCrossLabel = new QLabel("Qt::DiagCrossPattern");
84 linearLabel = new QLabel("Qt::LinearGradientPattern");
85 radialLabel = new QLabel("Qt::RadialGradientPattern");
86 conicalLabel = new QLabel("Qt::ConicalGradientPattern");
87 textureLabel = new QLabel("Qt::TexturePattern");
88
89 QGridLayout *layout = new QGridLayout;
90 layout->addWidget(solid, 0, 0);
91 layout->addWidget(dense1, 0, 1);
92 layout->addWidget(dense2, 0, 2);
93 layout->addWidget(solidLabel, 1, 0);
94 layout->addWidget(dense1Label, 1, 1);
95 layout->addWidget(dense2Label, 1, 2);
96
97 layout->addWidget(dense3, 2, 0 );
98 layout->addWidget(dense4, 2, 1);
99 layout->addWidget(dense5, 2, 2);
100 layout->addWidget(dense3Label, 3, 0);
101 layout->addWidget(dense4Label, 3, 1);
102 layout->addWidget(dense5Label, 3, 2);
103
104 layout->addWidget(dense6, 4, 0);
105 layout->addWidget(dense7, 4, 1);
106 layout->addWidget(no, 4, 2);
107 layout->addWidget(dense6Label, 5, 0);
108 layout->addWidget(dense7Label, 5, 1);
109 layout->addWidget(noLabel, 5, 2);
110
111 layout->addWidget(hor, 6, 0);
112 layout->addWidget(ver, 6, 1);
113 layout->addWidget(cross, 6, 2);
114 layout->addWidget(horLabel, 7, 0);
115 layout->addWidget(verLabel, 7, 1);
116 layout->addWidget(crossLabel, 7, 2);
117
118 layout->addWidget(bdiag, 8, 0);
119 layout->addWidget(fdiag, 8, 1);
120 layout->addWidget(diagCross, 8, 2);
121 layout->addWidget(bdiagLabel, 9, 0);
122 layout->addWidget(fdiagLabel, 9, 1);
123 layout->addWidget(diagCrossLabel, 9, 2);
124
125 layout->addWidget(linear, 10, 0);
126 layout->addWidget(radial, 10, 1);
127 layout->addWidget(conical, 10, 2);
128 layout->addWidget(linearLabel, 11, 0);
129 layout->addWidget(radialLabel, 11, 1);
130 layout->addWidget(conicalLabel, 11, 2);
131
132 layout->addWidget(texture, 12, 0, 1, 3);
133 layout->addWidget(textureLabel, 13, 0, 1, 3);
134
135 setLayout(layout);
136
137 QPalette newPalette = palette();
138 newPalette.setColor(QPalette::Window, Qt::white);
139 setPalette(newPalette);
140
141 setWindowTitle(tr("Brush Styles"));
142 resize(430, 605);
143}
144
145
Note: See TracBrowser for help on using the repository browser.