author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 22 Apr 2010 16:15:11 +0300 | |
branch | RCL_3 |
changeset 14 | 8c4229025c0b |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
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 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
||
43 |
#include "mainwindow.h" |
|
44 |
#include <QSplitter> |
|
45 |
#include <QHeaderView> |
|
46 |
||
47 |
StyleWidget::StyleWidget(QWidget *parent, Qt::WFlags f) |
|
48 |
: QWidget(parent, f) |
|
49 |
{ |
|
50 |
QHBoxLayout *hbox = new QHBoxLayout(this); |
|
51 |
QSplitter *spl = new QSplitter(this); |
|
52 |
||
53 |
// standard widgets |
|
54 |
QWidget *leftWidget = new QWidget(this); |
|
55 |
m_staWidget.setupUi(leftWidget); |
|
56 |
||
57 |
// advanced/system widgets |
|
58 |
QGroupBox *rightWidget = new QGroupBox("Advanced", this); |
|
59 |
QVBoxLayout *vbox = new QVBoxLayout(rightWidget); |
|
60 |
QWidget *adv = new QWidget(rightWidget); |
|
61 |
m_advWidget.setupUi(adv); |
|
62 |
QWidget *sys = new QWidget(rightWidget); |
|
63 |
m_sysWidget.setupUi(sys); |
|
64 |
vbox->addWidget(adv); |
|
65 |
vbox->addWidget(sys); |
|
66 |
||
67 |
spl->addWidget(leftWidget); |
|
68 |
spl->addWidget(rightWidget); |
|
69 |
||
70 |
hbox->setMargin(4); |
|
71 |
hbox->addWidget(spl); |
|
72 |
||
73 |
m_small1 = QIcon(":/icons/icon.bmp"); |
|
74 |
m_small2 = QIcon(":/icons/icon.png"); |
|
75 |
m_big = QIcon(":/icons/big.png"); |
|
76 |
||
77 |
addComboBoxItems(); |
|
78 |
addTreeItems(); |
|
79 |
addTreeListItems(); |
|
80 |
addListItems(); |
|
81 |
addTextEdit(); |
|
82 |
setupOtherWidgets(); |
|
83 |
setupButtons(); |
|
84 |
||
85 |
foreach(QWidget *w, qFindChildren<QWidget *>(parentWidget())) |
|
86 |
w->setWhatsThis(w->metaObject()->className()); |
|
87 |
} |
|
88 |
||
89 |
StyleWidget::~StyleWidget() |
|
90 |
{ |
|
91 |
||
92 |
} |
|
93 |
||
94 |
void StyleWidget::addTextEdit() |
|
95 |
{ |
|
96 |
m_staWidget.textEdit->setPlainText( |
|
97 |
"Some Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text"); |
|
98 |
m_staWidget.textEdit_2->setPlainText( |
|
99 |
"Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text"); |
|
100 |
m_staWidget.textEdit_3->setPlainText( |
|
101 |
"Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text" \ |
|
102 |
"Some Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\n"); |
|
103 |
} |
|
104 |
||
105 |
void StyleWidget::addComboBoxItems() |
|
106 |
{ |
|
107 |
m_staWidget.comboBox->addItem("Item 1"); |
|
108 |
m_staWidget.comboBox->addItem("Item 2"); |
|
109 |
m_staWidget.comboBox->addItem("Item 3"); |
|
110 |
m_staWidget.comboBox->addItem("Item 4"); |
|
111 |
m_staWidget.comboBox->addItem("Item 5"); |
|
112 |
} |
|
113 |
||
114 |
void StyleWidget::addListItems() |
|
115 |
{ |
|
116 |
m_staWidget.listWidget->addItem("Item 1"); |
|
117 |
m_staWidget.listWidget->addItem("Item 2"); |
|
118 |
m_staWidget.listWidget->addItem("Item 3"); |
|
119 |
m_staWidget.listWidget->addItem("Item 4"); |
|
120 |
m_staWidget.listWidget->addItem("Item 5"); |
|
121 |
||
122 |
QListWidgetItem *tmp = new QListWidgetItem("Item 1", m_staWidget.listWidget_2); |
|
123 |
tmp->setCheckState(Qt::Checked); |
|
124 |
tmp = new QListWidgetItem("Item 2", m_staWidget.listWidget_2); |
|
125 |
tmp->setCheckState(Qt::Checked); |
|
126 |
tmp = new QListWidgetItem("Item 3", m_staWidget.listWidget_2); |
|
127 |
tmp->setCheckState(Qt::Checked); |
|
128 |
tmp = new QListWidgetItem("Item 4", m_staWidget.listWidget_2); |
|
129 |
tmp->setCheckState(Qt::Checked); |
|
130 |
tmp = new QListWidgetItem("Item 5", m_staWidget.listWidget_2); |
|
131 |
tmp->setCheckState(Qt::Checked); |
|
132 |
||
133 |
tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget_3); |
|
134 |
tmp->setCheckState(Qt::Checked); |
|
135 |
tmp->setIcon(m_small1); |
|
136 |
tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget_3); |
|
137 |
tmp->setCheckState(Qt::Checked); |
|
138 |
tmp->setIcon(m_small1); |
|
139 |
tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget_3); |
|
140 |
tmp->setCheckState(Qt::Checked); |
|
141 |
tmp->setIcon(m_small1); |
|
142 |
tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget_3); |
|
143 |
tmp->setCheckState(Qt::Checked); |
|
144 |
tmp->setIcon(m_small1); |
|
145 |
tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget_3); |
|
146 |
tmp->setCheckState(Qt::Checked); |
|
147 |
tmp->setIcon(m_small1); |
|
148 |
||
149 |
m_advWidget.listWidget->setViewMode(QListView::IconMode); |
|
150 |
QIcon folder(":/icons/folder.png"); |
|
151 |
tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget); |
|
152 |
tmp->setIcon(folder); |
|
153 |
tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget); |
|
154 |
tmp->setIcon(folder); |
|
155 |
tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget); |
|
156 |
tmp->setIcon(folder); |
|
157 |
tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget); |
|
158 |
tmp->setIcon(folder); |
|
159 |
tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget); |
|
160 |
tmp->setIcon(folder); |
|
161 |
||
162 |
tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget_2); |
|
163 |
tmp->setIcon(m_small1); |
|
164 |
tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget_2); |
|
165 |
tmp->setIcon(m_small1); |
|
166 |
tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget_2); |
|
167 |
tmp->setIcon(m_small1); |
|
168 |
tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget_2); |
|
169 |
tmp->setIcon(m_small1); |
|
170 |
tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget_2); |
|
171 |
tmp->setIcon(m_small1); |
|
172 |
} |
|
173 |
||
174 |
void StyleWidget::setupOtherWidgets() |
|
175 |
{ |
|
176 |
m_sysWidget.tableWidget->setRowCount(100); |
|
177 |
m_sysWidget.tableWidget->setColumnCount(100); |
|
178 |
} |
|
179 |
||
180 |
void StyleWidget::addTreeItems() |
|
181 |
{ |
|
182 |
//standard tree |
|
183 |
m_staWidget.treeWidget_2->setColumnCount(1); |
|
184 |
m_staWidget.treeWidget_2->header()->hide(); |
|
185 |
||
186 |
QTreeWidgetItem *tmp; |
|
187 |
QTreeWidgetItem *subtmp; |
|
188 |
QTreeWidgetItem *root1 = new QTreeWidgetItem(m_staWidget.treeWidget_2); |
|
189 |
root1->setText(0, "Root 1"); |
|
190 |
QTreeWidgetItem *root2 = new QTreeWidgetItem(m_staWidget.treeWidget_2); |
|
191 |
root2->setText(0, "Root 2"); |
|
192 |
||
193 |
for (int i=1; i<=10; ++i) |
|
194 |
{ |
|
195 |
tmp = new QTreeWidgetItem(root1); |
|
196 |
tmp->setText(0, QString("Item %1").arg(i)); |
|
197 |
for (int j=1; j<=5; ++j) |
|
198 |
{ |
|
199 |
subtmp = new QTreeWidgetItem(tmp); |
|
200 |
subtmp->setText(0, QString("Sub Item %1").arg(j)); |
|
201 |
} |
|
202 |
} |
|
203 |
||
204 |
// standard checked tree |
|
205 |
m_staWidget.treeWidget_4->setColumnCount(1); |
|
206 |
m_staWidget.treeWidget_4->header()->hide(); |
|
207 |
||
208 |
root1 = new QTreeWidgetItem(m_staWidget.treeWidget_4); |
|
209 |
root1->setText(0, "Root 1"); |
|
210 |
root1->setCheckState(0, Qt::Checked); |
|
211 |
root2 = new QTreeWidgetItem(m_staWidget.treeWidget_4); |
|
212 |
root2->setText(0, "Root 2"); |
|
213 |
root2->setCheckState(0, Qt::Checked); |
|
214 |
||
215 |
for (int i=1; i<=10; ++i) |
|
216 |
{ |
|
217 |
tmp = new QTreeWidgetItem(root1); |
|
218 |
tmp->setText(0, QString("Item %1").arg(i)); |
|
219 |
tmp->setCheckState(0, Qt::Checked); |
|
220 |
for (int j=1; j<=5; ++j) |
|
221 |
{ |
|
222 |
subtmp = new QTreeWidgetItem(tmp); |
|
223 |
subtmp->setText(0, QString("Sub Item %1").arg(j)); |
|
224 |
subtmp->setCheckState(0, Qt::Checked); |
|
225 |
} |
|
226 |
} |
|
227 |
||
228 |
// advanced (images) tree |
|
229 |
m_advWidget.treeWidget_2->setColumnCount(1); |
|
230 |
m_advWidget.treeWidget_2->header()->hide(); |
|
231 |
||
232 |
root1 = new QTreeWidgetItem(m_advWidget.treeWidget_2); |
|
233 |
root1->setText(0, "Root 1"); |
|
234 |
root1->setIcon(0, m_small1); |
|
235 |
root2 = new QTreeWidgetItem(m_advWidget.treeWidget_2); |
|
236 |
root2->setText(0, "Root 2"); |
|
237 |
root2->setIcon(0, m_small1); |
|
238 |
||
239 |
for (int i=1; i<=10; ++i) |
|
240 |
{ |
|
241 |
tmp = new QTreeWidgetItem(root1); |
|
242 |
tmp->setText(0, QString("Item %1").arg(i)); |
|
243 |
tmp->setIcon(0, m_small2); |
|
244 |
for (int j=1; j<=5; ++j) |
|
245 |
{ |
|
246 |
subtmp = new QTreeWidgetItem(tmp); |
|
247 |
subtmp->setText(0, QString("Sub Item %1").arg(j)); |
|
248 |
tmp->setIcon(0, m_small1); |
|
249 |
} |
|
250 |
} |
|
251 |
||
252 |
} |
|
253 |
||
254 |
void StyleWidget::addTreeListItems() |
|
255 |
{ |
|
256 |
//standard list |
|
257 |
QTreeWidgetItem *tmp; |
|
258 |
m_staWidget.treeWidget->setColumnCount(3); |
|
259 |
m_staWidget.treeWidget->headerItem()->setText(0, "Col1"); |
|
260 |
m_staWidget.treeWidget->headerItem()->setText(1, "Col2"); |
|
261 |
m_staWidget.treeWidget->headerItem()->setText(2, "Col3"); |
|
262 |
||
263 |
for (int i=1; i<10; ++i) |
|
264 |
{ |
|
265 |
tmp = new QTreeWidgetItem(m_staWidget.treeWidget); |
|
266 |
tmp->setText(0, QString("Item%1").arg(i)); |
|
267 |
tmp->setText(1, QString("Item%11").arg(i)); |
|
268 |
tmp->setText(2, QString("Item%12").arg(i)); |
|
269 |
} |
|
270 |
||
271 |
//standard checked list |
|
272 |
m_staWidget.treeWidget_3->setColumnCount(3); |
|
273 |
m_staWidget.treeWidget_3->headerItem()->setText(0, "Col1"); |
|
274 |
m_staWidget.treeWidget_3->headerItem()->setText(1, "Col2"); |
|
275 |
m_staWidget.treeWidget_3->headerItem()->setText(2, "Col3"); |
|
276 |
||
277 |
for (int i=1; i<10; ++i) |
|
278 |
{ |
|
279 |
tmp = new QTreeWidgetItem(m_staWidget.treeWidget_3); |
|
280 |
tmp->setText(0, QString("Item%1").arg(i)); |
|
281 |
tmp->setCheckState(0, Qt::Checked); |
|
282 |
tmp->setText(1, QString("Item%11").arg(i)); |
|
283 |
tmp->setText(2, QString("Item%12").arg(i)); |
|
284 |
} |
|
285 |
||
286 |
//with images |
|
287 |
m_advWidget.treeWidget->setColumnCount(2); |
|
288 |
m_advWidget.treeWidget->headerItem()->setText(0, "Col1"); |
|
289 |
m_advWidget.treeWidget->headerItem()->setIcon(0, m_small2); |
|
290 |
m_advWidget.treeWidget->headerItem()->setText(1, "Col2"); |
|
291 |
m_advWidget.treeWidget->headerItem()->setIcon(1, m_small2); |
|
292 |
||
293 |
for (int i=1; i<10; ++i) |
|
294 |
{ |
|
295 |
tmp = new QTreeWidgetItem(m_advWidget.treeWidget); |
|
296 |
tmp->setText(0, QString("Item%1").arg(i)); |
|
297 |
tmp->setIcon(0, m_small1); |
|
298 |
tmp->setText(1, QString("Item%11").arg(i)); |
|
299 |
} |
|
300 |
} |
|
301 |
||
302 |
void StyleWidget::setupButtons() |
|
303 |
{ |
|
304 |
m_advWidget.pushButton->setIcon(m_small1); |
|
305 |
m_advWidget.pushButton_2->setIcon(m_small1); |
|
306 |
m_advWidget.checkBox->setIcon(m_small2); |
|
307 |
m_advWidget.checkBox_2->setIcon(m_small2); |
|
308 |
m_advWidget.radioButton->setIcon(m_small2); |
|
309 |
m_advWidget.radioButton_2->setIcon(m_small2); |
|
310 |
||
311 |
// tab page images |
|
312 |
m_advWidget.tabWidget->setTabIcon(0, m_small2); |
|
313 |
m_advWidget.tabWidget->setTabIcon(1, m_small2); |
|
314 |
} |