annotate examples/widgets/styles/widgetgallery.d @ 374:681af90e1d53

Removed debug writelns. Fixed build script.
author Max Samukha <maxter@spambox.com>
date Thu, 08 Jul 2010 22:21:56 +0300
parents 37cf6fd1ee85
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
156
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
1 /****************************************************************************
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
2 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
4 ** Contact: Qt Software Information (qt-info@nokia.com)
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
5 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
6 ** This file is part of the examples of the Qt Toolkit.
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
7 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
8 ** $QT_BEGIN_LICENSE:LGPL$
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
9 ** Commercial Usage
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
10 ** Licensees holding valid Qt Commercial licenses may use this file in
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
11 ** accordance with the Qt Commercial License Agreement provided with the
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
12 ** Software or, alternatively, in accordance with the terms contained in
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
13 ** a written agreement between you and Nokia.
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
14 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
15 ** GNU Lesser General Public License Usage
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
16 ** Alternatively, this file may be used under the terms of the GNU Lesser
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
17 ** General Public License version 2.1 as published by the Free Software
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
18 ** Foundation and appearing in the file LICENSE.LGPL included in the
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
19 ** packaging of this file. Please review the following information to
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
20 ** ensure the GNU Lesser General Public License version 2.1 requirements
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
21 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
22 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
23 ** In addition, as a special exception, Nokia gives you certain
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
24 ** additional rights. These rights are described in the Nokia Qt LGPL
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
26 ** package.
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
27 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
28 ** GNU General Public License Usage
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
29 ** Alternatively, this file may be used under the terms of the GNU
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
30 ** General Public License version 3.0 as published by the Free Software
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
31 ** Foundation and appearing in the file LICENSE.GPL included in the
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
32 ** packaging of this file. Please review the following information to
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
33 ** ensure the GNU General Public License version 3.0 requirements will be
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
34 ** met: http://www.gnu.org/copyleft/gpl.html.
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
35 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
36 ** If you are unsure which license is appropriate for your use, please
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
37 ** contact the sales department at qt-sales@nokia.com.
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
38 ** $QT_END_LICENSE$
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
39 **
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
40 ****************************************************************************/
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
41 module widgetgallery;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
42
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
43
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
44 import qt.gui.QDialog;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
45 import qt.gui.QCheckBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
46 import qt.gui.QComboBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
47 import qt.gui.QDateTimeEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
48 import qt.gui.QDial;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
49 import qt.gui.QGroupBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
50 import qt.gui.QLabel;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
51 import qt.gui.QLineEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
52 import qt.gui.QProgressBar;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
53 import qt.gui.QPushButton;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
54 import qt.gui.QRadioButton;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
55 import qt.gui.QScrollBar;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
56 import qt.gui.QSlider;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
57 import qt.gui.QSpinBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
58 import qt.gui.QTabWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
59 import qt.gui.QTableWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
60 import qt.gui.QTextEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
61 import qt.gui.QStyleFactory;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
62 import qt.gui.QHBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
63 import qt.gui.QGridLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
64 import qt.gui.QVBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
65 import qt.core.QTimer;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
66
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
67 import norwegianwoodstyle;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
68
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
69
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
70 class WidgetGallery : public QDialog
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
71 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
72 public:
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
73
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
74 this(QWidget parent = null)
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
75 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
76 super(parent);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
77 originalPalette = QApplication.palette();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
78
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
79 styleComboBox = new QComboBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
80 styleComboBox.addItem("NorwegianWood");
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
81 styleComboBox.addItems(QStyleFactory.keys());
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
82
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
83 styleLabel = new QLabel(tr("&Style:"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
84 styleLabel.setBuddy(styleComboBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
85
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
86 useStylePaletteCheckBox = new QCheckBox(tr("&Use style's standard palette"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
87 useStylePaletteCheckBox.setChecked(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
88
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
89 disableWidgetsCheckBox = new QCheckBox(tr("&Disable widgets"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
90
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
91 createTopLeftGroupBox();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
92 createTopRightGroupBox();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
93 createBottomLeftTabWidget();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
94 createBottomRightGroupBox();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
95 createProgressBar();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
96
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
97 styleComboBox.activated.connect(&this.changeStyle);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
98 useStylePaletteCheckBox.toggled.connect(&this.changePalette);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
99 disableWidgetsCheckBox.toggled.connect(&topLeftGroupBox.setDisabled);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
100 disableWidgetsCheckBox.toggled.connect(&topRightGroupBox.setDisabled);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
101 disableWidgetsCheckBox.toggled.connect(&bottomLeftTabWidget.setDisabled);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
102 disableWidgetsCheckBox.toggled.connect(&bottomRightGroupBox.setDisabled);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
103
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
104 QHBoxLayout topLayout = new QHBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
105
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
106 topLayout.addWidget(styleLabel);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
107 topLayout.addWidget(styleComboBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
108 topLayout.addStretch(1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
109 topLayout.addWidget(useStylePaletteCheckBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
110 topLayout.addWidget(disableWidgetsCheckBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
111
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
112 QGridLayout mainLayout = new QGridLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
113 mainLayout.addLayout(topLayout, 0, 0, 1, 2);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
114 mainLayout.addWidget(topLeftGroupBox, 1, 0);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
115 mainLayout.addWidget(topRightGroupBox, 1, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
116 mainLayout.addWidget(bottomLeftTabWidget, 2, 0);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
117 mainLayout.addWidget(bottomRightGroupBox, 2, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
118 mainLayout.addWidget(progressBar, 3, 0, 1, 2);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
119 mainLayout.setRowStretch(1, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
120 mainLayout.setRowStretch(2, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
121 mainLayout.setColumnStretch(0, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
122 mainLayout.setColumnStretch(1, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
123 setLayout(mainLayout);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
124
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
125 setWindowTitle(tr("Styles"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
126 changeStyle("NorwegianWood");
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
127 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
128
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
129 private:
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
130
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
131 void changeStyle(string styleName)
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
132 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
133 if (styleName == "NorwegianWood") {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
134 QApplication.setStyle(new NorwegianWoodStyle);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
135 } else {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
136 QApplication.setStyle(QStyleFactory.create(styleName));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
137 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
138 changePalette();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
139 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
140
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
141 void changePalette()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
142 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
143 if (useStylePaletteCheckBox.isChecked())
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
144 QApplication.setPalette(QApplication.style().standardPalette());
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
145 else
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
146 QApplication.setPalette(originalPalette);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
147 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
148
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
149 void advanceProgressBar()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
150 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
151 int curVal = progressBar.value();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
152 int maxVal = progressBar.maximum();
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
153 progressBar.setValue(curVal + (maxVal - curVal) / 100);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
154 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
155
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
156 private:
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
157
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
158 void createTopLeftGroupBox()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
159 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
160 topLeftGroupBox = new QGroupBox(tr("Group 1"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
161
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
162 radioButton1 = new QRadioButton(tr("Radio button 1"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
163 radioButton2 = new QRadioButton(tr("Radio button 2"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
164 radioButton3 = new QRadioButton(tr("Radio button 3"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
165 radioButton1.setChecked(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
166
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
167 checkBox = new QCheckBox(tr("Tri-state check box"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
168 checkBox.setTristate(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
169 checkBox.setCheckState(Qt.PartiallyChecked);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
170
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
171 QVBoxLayout layout = new QVBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
172 layout.addWidget(radioButton1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
173 layout.addWidget(radioButton2);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
174 layout.addWidget(radioButton3);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
175 layout.addWidget(checkBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
176 layout.addStretch(1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
177 topLeftGroupBox.setLayout(layout);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
178 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
179
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
180 void createTopRightGroupBox()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
181 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
182 topRightGroupBox = new QGroupBox(tr("Group 2"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
183
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
184 defaultPushButton = new QPushButton(tr("Default Push Button"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
185 defaultPushButton.setDefault(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
186
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
187 togglePushButton = new QPushButton(tr("Toggle Push Button"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
188 togglePushButton.setCheckable(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
189 togglePushButton.setChecked(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
190
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
191 flatPushButton = new QPushButton(tr("Flat Push Button"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
192 flatPushButton.setFlat(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
193
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
194 QVBoxLayout layout = new QVBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
195 layout.addWidget(defaultPushButton);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
196 layout.addWidget(togglePushButton);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
197 layout.addWidget(flatPushButton);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
198 layout.addStretch(1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
199 topRightGroupBox.setLayout(layout);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
200 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
201
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
202 void createBottomLeftTabWidget()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
203 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
204 bottomLeftTabWidget = new QTabWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
205 bottomLeftTabWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Ignored);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
206
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
207 QWidget tab1 = new QWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
208 tableWidget = new QTableWidget(10, 10);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
209
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
210 QHBoxLayout tab1hbox = new QHBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
211 tab1hbox.setMargin(5);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
212 tab1hbox.addWidget(tableWidget);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
213 tab1.setLayout(tab1hbox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
214
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
215 QWidget tab2 = new QWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
216 textEdit = new QTextEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
217
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
218 textEdit.setPlainText(tr("Twinkle, twinkle, little star,\n"
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
219 "How I wonder what you are.\n"
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
220 "Up above the world so high,\n"
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
221 "Like a diamond in the sky.\n"
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
222 "Twinkle, twinkle, little star,\n"
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
223 "How I wonder what you are!\n"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
224
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
225 QHBoxLayout tab2hbox = new QHBoxLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
226 tab2hbox.setMargin(5);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
227 tab2hbox.addWidget(textEdit);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
228 tab2.setLayout(tab2hbox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
229
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
230 bottomLeftTabWidget.addTab(tab1, tr("&Table"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
231 bottomLeftTabWidget.addTab(tab2, tr("Text &Edit"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
232 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
233
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
234 void createBottomRightGroupBox()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
235 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
236 bottomRightGroupBox = new QGroupBox(tr("Group 3"));
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
237 bottomRightGroupBox.setCheckable(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
238 bottomRightGroupBox.setChecked(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
239
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
240 lineEdit = new QLineEdit("s3cRe7");
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
241 lineEdit.setEchoMode(QLineEdit.Password);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
242
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
243 spinBox = new QSpinBox(bottomRightGroupBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
244 spinBox.setValue(50);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
245
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
246 dateTimeEdit = new QDateTimeEdit(bottomRightGroupBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
247 dateTimeEdit.setDateTime(QDateTime.currentDateTime());
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
248
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
249 slider = new QSlider(Qt.Horizontal, bottomRightGroupBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
250 slider.setValue(40);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
251
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
252 scrollBar = new QScrollBar(Qt.Horizontal, bottomRightGroupBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
253 scrollBar.setValue(60);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
254
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
255 dial = new QDial(bottomRightGroupBox);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
256 dial.setValue(30);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
257 dial.setNotchesVisible(true);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
258
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
259 QGridLayout layout = new QGridLayout;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
260 layout.addWidget(lineEdit, 0, 0, 1, 2);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
261 layout.addWidget(spinBox, 1, 0, 1, 2);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
262 layout.addWidget(dateTimeEdit, 2, 0, 1, 2);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
263 layout.addWidget(slider, 3, 0);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
264 layout.addWidget(scrollBar, 4, 0);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
265 layout.addWidget(dial, 3, 1, 2, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
266 layout.setRowStretch(5, 1);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
267 bottomRightGroupBox.setLayout(layout);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
268 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
269
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
270 void createProgressBar()
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
271 {
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
272 progressBar = new QProgressBar;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
273 progressBar.setRange(0, 10000);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
274 progressBar.setValue(0);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
275
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
276 QTimer timer = new QTimer(this);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
277 timer.timeout.connect(&this.advanceProgressBar);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
278 timer.start(1000);
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
279 }
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
280
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
281
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
282 QPalette originalPalette;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
283
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
284 QLabel styleLabel;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
285 QComboBox styleComboBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
286 QCheckBox useStylePaletteCheckBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
287 QCheckBox disableWidgetsCheckBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
288
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
289 QGroupBox topLeftGroupBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
290 QRadioButton radioButton1;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
291 QRadioButton radioButton2;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
292 QRadioButton radioButton3;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
293 QCheckBox checkBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
294
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
295 QGroupBox topRightGroupBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
296 QPushButton defaultPushButton;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
297 QPushButton togglePushButton;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
298 QPushButton flatPushButton;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
299
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
300 QTabWidget bottomLeftTabWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
301 QTableWidget tableWidget;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
302 QTextEdit textEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
303
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
304 QGroupBox bottomRightGroupBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
305 QLineEdit lineEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
306 QSpinBox spinBox;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
307 QDateTimeEdit dateTimeEdit;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
308 QSlider slider;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
309 QScrollBar scrollBar;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
310 QDial dial;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
311
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
312 QProgressBar progressBar;
37cf6fd1ee85 add styles example, still buggs
mandel
parents:
diff changeset
313 }