qwizard.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/dialogs/qwizard.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qwizard.h"-
35-
36#ifndef QT_NO_WIZARD-
37-
38#include "qabstractspinbox.h"-
39#include "qalgorithms.h"-
40#include "qapplication.h"-
41#include "qboxlayout.h"-
42#include "qlayoutitem.h"-
43#include "qdesktopwidget.h"-
44#include "qevent.h"-
45#include "qframe.h"-
46#include "qlabel.h"-
47#include "qlineedit.h"-
48#include "qpainter.h"-
49#include "qwindow.h"-
50#include "qpushbutton.h"-
51#include "qset.h"-
52#include "qstyle.h"-
53#include "qvarlengtharray.h"-
54#if defined(Q_OS_MACX)-
55#include <QtCore/QMetaMethod>-
56#include <QtGui/QGuiApplication>-
57#include <qpa/qplatformnativeinterface.h>-
58#elif !defined(QT_NO_STYLE_WINDOWSVISTA)-
59#include "qwizard_win_p.h"-
60#include "qtimer.h"-
61#endif-
62-
63#include "private/qdialog_p.h"-
64#include <qdebug.h>-
65-
66#ifdef Q_OS_WINCE-
67extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp-
68#endif-
69-
70#include <string.h> // for memset()-
71#include <algorithm>-
72-
73QT_BEGIN_NAMESPACE-
74-
75// These fudge terms were needed a few places to obtain pixel-perfect results-
76const int GapBetweenLogoAndRightEdge = 5;-
77const int ModernHeaderTopMargin = 2;-
78const int ClassicHMargin = 4;-
79const int MacButtonTopMargin = 13;-
80const int MacLayoutLeftMargin = 20;-
81//const int MacLayoutTopMargin = 14; // Unused. Save some space and avoid warning.-
82const int MacLayoutRightMargin = 20;-
83const int MacLayoutBottomMargin = 17;-
84-
85static void changeSpacerSize(QLayout *layout, int index, int width, int height)-
86{-
87 QSpacerItem *spacer = layout->itemAt(index)->spacerItem();-
88 if (!spacer)
!spacerDescription
TRUEnever evaluated
FALSEnever evaluated
0
89 return;
never executed: return;
0
90 spacer->changeSize(width, height);-
91}
never executed: end of block
0
92-
93static QWidget *iWantTheFocus(QWidget *ancestor)-
94{-
95 const int MaxIterations = 100;-
96-
97 QWidget *candidate = ancestor;-
98 for (int i = 0; i < MaxIterations; ++i) {
i < MaxIterationsDescription
TRUEnever evaluated
FALSEnever evaluated
0
99 candidate = candidate->nextInFocusChain();-
100 if (!candidate)
!candidateDescription
TRUEnever evaluated
FALSEnever evaluated
0
101 break;
never executed: break;
0
102-
103 if (candidate->focusPolicy() & Qt::TabFocus) {
candidate->foc...& Qt::TabFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
104 if (candidate != ancestor && ancestor->isAncestorOf(candidate))
candidate != ancestorDescription
TRUEnever evaluated
FALSEnever evaluated
ancestor->isAn...rOf(candidate)Description
TRUEnever evaluated
FALSEnever evaluated
0
105 return candidate;
never executed: return candidate;
0
106 }
never executed: end of block
0
107 }
never executed: end of block
0
108 return 0;
never executed: return 0;
0
109}-
110-
111static bool objectInheritsXAndXIsCloserThanY(const QObject *object, const QByteArray &classX,-
112 const QByteArray &classY)-
113{-
114 const QMetaObject *metaObject = object->metaObject();-
115 while (metaObject) {
metaObjectDescription
TRUEnever evaluated
FALSEnever evaluated
0
116 if (metaObject->className() == classX)
metaObject->cl...me() == classXDescription
TRUEnever evaluated
FALSEnever evaluated
0
117 return true;
never executed: return true;
0
118 if (metaObject->className() == classY)
metaObject->cl...me() == classYDescription
TRUEnever evaluated
FALSEnever evaluated
0
119 return false;
never executed: return false;
0
120 metaObject = metaObject->superClass();-
121 }
never executed: end of block
0
122 return false;
never executed: return false;
0
123}-
124-
125const struct {-
126 const char className[16];-
127 const char property[13];-
128} fallbackProperties[] = {-
129 // If you modify this list, make sure to update the documentation (and the auto test)-
130 { "QAbstractButton", "checked" },-
131 { "QAbstractSlider", "value" },-
132 { "QComboBox", "currentIndex" },-
133 { "QDateTimeEdit", "dateTime" },-
134 { "QLineEdit", "text" },-
135 { "QListWidget", "currentRow" },-
136 { "QSpinBox", "value" },-
137};-
138const size_t NFallbackDefaultProperties = sizeof fallbackProperties / sizeof *fallbackProperties;-
139-
140static const char *changed_signal(int which)-
141{-
142 // since it might expand to a runtime function call (to-
143 // qFlagLocations()), we cannot store the result of SIGNAL() in a-
144 // character array and expect it to be statically initialized. To-
145 // avoid the relocations caused by a char pointer table, use a-
146 // switch statement:-
147 switch (which) {-
148 case 0: return SIGNAL(toggled(bool));
never executed: return qFlagLocation("2""toggled(bool)" "\0" __FILE__ ":" "148");
never executed: case 0:
0
149 case 1: return SIGNAL(valueChanged(int));
never executed: return qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "149");
never executed: case 1:
0
150 case 2: return SIGNAL(currentIndexChanged(int));
never executed: return qFlagLocation("2""currentIndexChanged(int)" "\0" __FILE__ ":" "150");
never executed: case 2:
0
151 case 3: return SIGNAL(dateTimeChanged(QDateTime));
never executed: return qFlagLocation("2""dateTimeChanged(QDateTime)" "\0" __FILE__ ":" "151");
never executed: case 3:
0
152 case 4: return SIGNAL(textChanged(QString));
never executed: return qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "152");
never executed: case 4:
0
153 case 5: return SIGNAL(currentRowChanged(int));
never executed: return qFlagLocation("2""currentRowChanged(int)" "\0" __FILE__ ":" "153");
never executed: case 5:
0
154 case 6: return SIGNAL(valueChanged(int));
never executed: return qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "154");
never executed: case 6:
0
155 };-
156 Q_STATIC_ASSERT(7 == NFallbackDefaultProperties);-
157 Q_UNREACHABLE();-
158 return 0;
never executed: return 0;
0
159}-
160-
161class QWizardDefaultProperty-
162{-
163public:-
164 QByteArray className;-
165 QByteArray property;-
166 QByteArray changedSignal;-
167-
168 inline QWizardDefaultProperty() {}-
169 inline QWizardDefaultProperty(const char *className, const char *property,-
170 const char *changedSignal)-
171 : className(className), property(property), changedSignal(changedSignal) {}
never executed: end of block
0
172};-
173Q_DECLARE_TYPEINFO(QWizardDefaultProperty, Q_MOVABLE_TYPE);-
174-
175class QWizardField-
176{-
177public:-
178 inline QWizardField() {}-
179 QWizardField(QWizardPage *page, const QString &spec, QObject *object, const char *property,-
180 const char *changedSignal);-
181-
182 void resolve(const QVector<QWizardDefaultProperty> &defaultPropertyTable);-
183 void findProperty(const QWizardDefaultProperty *properties, int propertyCount);-
184-
185 QWizardPage *page;-
186 QString name;-
187 bool mandatory;-
188 QObject *object;-
189 QByteArray property;-
190 QByteArray changedSignal;-
191 QVariant initialValue;-
192};-
193Q_DECLARE_TYPEINFO(QWizardField, Q_MOVABLE_TYPE);-
194-
195QWizardField::QWizardField(QWizardPage *page, const QString &spec, QObject *object,-
196 const char *property, const char *changedSignal)-
197 : page(page), name(spec), mandatory(false), object(object), property(property),-
198 changedSignal(changedSignal)-
199{-
200 if (name.endsWith(QLatin1Char('*'))) {
name.endsWith(...tin1Char('*'))Description
TRUEnever evaluated
FALSEnever evaluated
0
201 name.chop(1);-
202 mandatory = true;-
203 }
never executed: end of block
0
204}
never executed: end of block
0
205-
206void QWizardField::resolve(const QVector<QWizardDefaultProperty> &defaultPropertyTable)-
207{-
208 if (property.isEmpty())
property.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
209 findProperty(defaultPropertyTable.constData(), defaultPropertyTable.count());
never executed: findProperty(defaultPropertyTable.constData(), defaultPropertyTable.count());
0
210 initialValue = object->property(property);-
211}
never executed: end of block
0
212-
213void QWizardField::findProperty(const QWizardDefaultProperty *properties, int propertyCount)-
214{-
215 QByteArray className;-
216-
217 for (int i = 0; i < propertyCount; ++i) {
i < propertyCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
218 if (objectInheritsXAndXIsCloserThanY(object, properties[i].className, className)) {
objectInherits...me, className)Description
TRUEnever evaluated
FALSEnever evaluated
0
219 className = properties[i].className;-
220 property = properties[i].property;-
221 changedSignal = properties[i].changedSignal;-
222 }
never executed: end of block
0
223 }
never executed: end of block
0
224}
never executed: end of block
0
225-
226class QWizardLayoutInfo-
227{-
228public:-
229 inline QWizardLayoutInfo()-
230 : topLevelMarginLeft(-1), topLevelMarginRight(-1), topLevelMarginTop(-1),-
231 topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1),-
232 childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1),-
233 wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false),-
234 subTitle(false), extension(false), sideWidget(false) {}
never executed: end of block
0
235-
236 int topLevelMarginLeft;-
237 int topLevelMarginRight;-
238 int topLevelMarginTop;-
239 int topLevelMarginBottom;-
240 int childMarginLeft;-
241 int childMarginRight;-
242 int childMarginTop;-
243 int childMarginBottom;-
244 int hspacing;-
245 int vspacing;-
246 int buttonSpacing;-
247 QWizard::WizardStyle wizStyle;-
248 bool header;-
249 bool watermark;-
250 bool title;-
251 bool subTitle;-
252 bool extension;-
253 bool sideWidget;-
254-
255 bool operator==(const QWizardLayoutInfo &other);-
256 inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); }
never executed: return !operator==(other);
0
257};-
258-
259bool QWizardLayoutInfo::operator==(const QWizardLayoutInfo &other)-
260{-
261 return topLevelMarginLeft == other.topLevelMarginLeft
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
topLevelMargin...evelMarginLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
262 && topLevelMarginRight == other.topLevelMarginRight
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
topLevelMargin...velMarginRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
263 && topLevelMarginTop == other.topLevelMarginTop
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
topLevelMargin...LevelMarginTopDescription
TRUEnever evaluated
FALSEnever evaluated
0
264 && topLevelMarginBottom == other.topLevelMarginBottom
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
topLevelMargin...elMarginBottomDescription
TRUEnever evaluated
FALSEnever evaluated
0
265 && childMarginLeft == other.childMarginLeft
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
childMarginLef...hildMarginLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
266 && childMarginRight == other.childMarginRight
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
childMarginRig...ildMarginRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
267 && childMarginTop == other.childMarginTop
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
childMarginTop...childMarginTopDescription
TRUEnever evaluated
FALSEnever evaluated
0
268 && childMarginBottom == other.childMarginBottom
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
childMarginBot...ldMarginBottomDescription
TRUEnever evaluated
FALSEnever evaluated
0
269 && hspacing == other.hspacing
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
hspacing == other.hspacingDescription
TRUEnever evaluated
FALSEnever evaluated
0
270 && vspacing == other.vspacing
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
vspacing == other.vspacingDescription
TRUEnever evaluated
FALSEnever evaluated
0
271 && buttonSpacing == other.buttonSpacing
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
buttonSpacing ....buttonSpacingDescription
TRUEnever evaluated
FALSEnever evaluated
0
272 && wizStyle == other.wizStyle
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
wizStyle == other.wizStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
273 && header == other.header
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
header == other.headerDescription
TRUEnever evaluated
FALSEnever evaluated
0
274 && watermark == other.watermark
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
watermark == other.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
0
275 && title == other.title
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
title == other.titleDescription
TRUEnever evaluated
FALSEnever evaluated
0
276 && subTitle == other.subTitle
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
subTitle == other.subTitleDescription
TRUEnever evaluated
FALSEnever evaluated
0
277 && extension == other.extension
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
extension == other.extensionDescription
TRUEnever evaluated
FALSEnever evaluated
0
278 && sideWidget == other.sideWidget;
never executed: return topLevelMarginLeft == other.topLevelMarginLeft && topLevelMarginRight == other.topLevelMarginRight && topLevelMarginTop == other.topLevelMarginTop && topLevelMarginBottom == other.topLevelMarginBottom && childMarginLeft == other.childMarginLeft && ...pacing && buttonSpacing == other.buttonSpacing && wizStyle == other.wizStyle && header == other.header && watermark == other.watermark && title == other.title && subTitle == other.subTitle && extension == other.extension && sideWidget == other.sideWidget;
sideWidget == other.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
279}-
280-
281class QWizardHeader : public QWidget-
282{-
283public:-
284 enum RulerType { Ruler };-
285-
286 inline QWizardHeader(RulerType /* ruler */, QWidget *parent = 0)-
287 : QWidget(parent) { setFixedHeight(2); }
never executed: end of block
0
288 QWizardHeader(QWidget *parent = 0);-
289-
290 void setup(const QWizardLayoutInfo &info, const QString &title,-
291 const QString &subTitle, const QPixmap &logo, const QPixmap &banner,-
292 Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat);-
293-
294protected:-
295 void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;-
296#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
297private:-
298 bool vistaDisabled() const;-
299#endif-
300private:-
301 QLabel *titleLabel;-
302 QLabel *subTitleLabel;-
303 QLabel *logoLabel;-
304 QGridLayout *layout;-
305 QPixmap bannerPixmap;-
306};-
307-
308QWizardHeader::QWizardHeader(QWidget *parent)-
309 : QWidget(parent)-
310{-
311 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);-
312 setBackgroundRole(QPalette::Base);-
313-
314 titleLabel = new QLabel(this);-
315 titleLabel->setBackgroundRole(QPalette::Base);-
316-
317 subTitleLabel = new QLabel(this);-
318 subTitleLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);-
319 subTitleLabel->setWordWrap(true);-
320-
321 logoLabel = new QLabel(this);-
322-
323 QFont font = titleLabel->font();-
324 font.setBold(true);-
325 titleLabel->setFont(font);-
326-
327 layout = new QGridLayout(this);-
328 layout->setMargin(0);-
329 layout->setSpacing(0);-
330-
331 layout->setRowMinimumHeight(3, 1);-
332 layout->setRowStretch(4, 1);-
333-
334 layout->setColumnStretch(2, 1);-
335 layout->setColumnMinimumWidth(4, 2 * GapBetweenLogoAndRightEdge);-
336 layout->setColumnMinimumWidth(6, GapBetweenLogoAndRightEdge);-
337-
338 layout->addWidget(titleLabel, 2, 1, 1, 2);-
339 layout->addWidget(subTitleLabel, 4, 2);-
340 layout->addWidget(logoLabel, 1, 5, 5, 1);-
341}
never executed: end of block
0
342-
343#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
344bool QWizardHeader::vistaDisabled() const-
345{-
346 bool styleDisabled = false;-
347 QWizard *wiz = parentWidget() ? qobject_cast <QWizard *>(parentWidget()->parentWidget()) : 0;-
348 if (wiz) {-
349 // Designer dosen't support the Vista style for Wizards. This property is used to turn-
350 // off the Vista style.-
351 const QVariant v = wiz->property("_q_wizard_vista_off");-
352 styleDisabled = v.isValid() && v.toBool();-
353 }-
354 return styleDisabled;-
355}-
356#endif-
357-
358void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,-
359 const QString &subTitle, const QPixmap &logo, const QPixmap &banner,-
360 Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat)-
361{-
362 bool modern = ((info.wizStyle == QWizard::ModernStyle)-
363#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
364 || ((info.wizStyle == QWizard::AeroStyle-
365 && QVistaHelper::vistaState() == QVistaHelper::Classic) || vistaDisabled())-
366#endif-
367 );-
368-
369 layout->setRowMinimumHeight(0, modern ? ModernHeaderTopMargin : 0);-
370 layout->setRowMinimumHeight(1, modern ? info.topLevelMarginTop - ModernHeaderTopMargin - 1 : 0);-
371 layout->setRowMinimumHeight(6, (modern ? 3 : GapBetweenLogoAndRightEdge) + 2);-
372-
373 int minColumnWidth0 = modern ? info.topLevelMarginLeft + info.topLevelMarginRight : 0;
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
374 int minColumnWidth1 = modern ? info.topLevelMarginLeft + info.topLevelMarginRight + 1
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
375 : info.topLevelMarginLeft + ClassicHMargin;-
376 layout->setColumnMinimumWidth(0, minColumnWidth0);-
377 layout->setColumnMinimumWidth(1, minColumnWidth1);-
378-
379 titleLabel->setTextFormat(titleFormat);-
380 titleLabel->setText(title);-
381 logoLabel->setPixmap(logo);-
382-
383 subTitleLabel->setTextFormat(subTitleFormat);-
384 subTitleLabel->setText(QLatin1String("Pq\nPq"));-
385 int desiredSubTitleHeight = subTitleLabel->sizeHint().height();-
386 subTitleLabel->setText(subTitle);-
387-
388 if (modern) {
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
389 bannerPixmap = banner;-
390 } else {
never executed: end of block
0
391 bannerPixmap = QPixmap();-
392 }
never executed: end of block
0
393-
394 if (bannerPixmap.isNull()) {
bannerPixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
395 /*-
396 There is no widthForHeight() function, so we simulate it with a loop.-
397 */-
398 int candidateSubTitleWidth = qMin(512, 2 * QApplication::desktop()->width() / 3);-
399 int delta = candidateSubTitleWidth >> 1;-
400 while (delta > 0) {
delta > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
401 if (subTitleLabel->heightForWidth(candidateSubTitleWidth - delta)
subTitleLabel-...SubTitleHeightDescription
TRUEnever evaluated
FALSEnever evaluated
0
402 <= desiredSubTitleHeight)
subTitleLabel-...SubTitleHeightDescription
TRUEnever evaluated
FALSEnever evaluated
0
403 candidateSubTitleWidth -= delta;
never executed: candidateSubTitleWidth -= delta;
0
404 delta >>= 1;-
405 }
never executed: end of block
0
406-
407 subTitleLabel->setMinimumSize(candidateSubTitleWidth, desiredSubTitleHeight);-
408-
409 QSize size = layout->totalMinimumSize();-
410 setMinimumSize(size);-
411 setMaximumSize(QWIDGETSIZE_MAX, size.height());-
412 } else {
never executed: end of block
0
413 subTitleLabel->setMinimumSize(0, 0);-
414 setFixedSize(banner.size() + QSize(0, 2));-
415 }
never executed: end of block
0
416 updateGeometry();-
417}
never executed: end of block
0
418-
419void QWizardHeader::paintEvent(QPaintEvent * /* event */)-
420{-
421 QPainter painter(this);-
422 painter.drawPixmap(0, 0, bannerPixmap);-
423-
424 int x = width() - 2;-
425 int y = height() - 2;-
426 const QPalette &pal = palette();-
427 painter.setPen(pal.mid().color());-
428 painter.drawLine(0, y, x, y);-
429 painter.setPen(pal.base().color());-
430 painter.drawPoint(x + 1, y);-
431 painter.drawLine(0, y + 1, x + 1, y + 1);-
432}
never executed: end of block
0
433-
434// We save one vtable by basing QWizardRuler on QWizardHeader-
435class QWizardRuler : public QWizardHeader-
436{-
437public:-
438 inline QWizardRuler(QWidget *parent = 0)-
439 : QWizardHeader(Ruler, parent) {}
never executed: end of block
0
440};-
441-
442class QWatermarkLabel : public QLabel-
443{-
444public:-
445 QWatermarkLabel(QWidget *parent, QWidget *sideWidget) : QLabel(parent), m_sideWidget(sideWidget) {-
446 m_layout = new QVBoxLayout(this);-
447 if (m_sideWidget)
m_sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
448 m_layout->addWidget(m_sideWidget);
never executed: m_layout->addWidget(m_sideWidget);
0
449 }
never executed: end of block
0
450-
451 QSize minimumSizeHint() const Q_DECL_OVERRIDE {-
452 if (!pixmap() && !pixmap()->isNull())
!pixmap()Description
TRUEnever evaluated
FALSEnever evaluated
!pixmap()->isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
453 return pixmap()->size();
never executed: return pixmap()->size();
0
454 return QFrame::minimumSizeHint();
never executed: return QFrame::minimumSizeHint();
0
455 }-
456-
457 void setSideWidget(QWidget *widget) {-
458 if (m_sideWidget == widget)
m_sideWidget == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
459 return;
never executed: return;
0
460 if (m_sideWidget) {
m_sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
461 m_layout->removeWidget(m_sideWidget);-
462 m_sideWidget->hide();-
463 }
never executed: end of block
0
464 m_sideWidget = widget;-
465 if (m_sideWidget)
m_sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
466 m_layout->addWidget(m_sideWidget);
never executed: m_layout->addWidget(m_sideWidget);
0
467 }
never executed: end of block
0
468 QWidget *sideWidget() const {-
469 return m_sideWidget;
never executed: return m_sideWidget;
0
470 }-
471private:-
472 QVBoxLayout *m_layout;-
473 QWidget *m_sideWidget;-
474};-
475-
476class QWizardPagePrivate : public QWidgetPrivate-
477{-
478 Q_DECLARE_PUBLIC(QWizardPage)-
479-
480public:-
481 enum TriState { Tri_Unknown = -1, Tri_False, Tri_True };-
482-
483 inline QWizardPagePrivate()-
484 : wizard(0), completeState(Tri_Unknown), explicitlyFinal(false), commit(false) {}
never executed: end of block
0
485-
486 bool cachedIsComplete() const;-
487 void _q_maybeEmitCompleteChanged();-
488 void _q_updateCachedCompleteState();-
489-
490 QWizard *wizard;-
491 QString title;-
492 QString subTitle;-
493 QPixmap pixmaps[QWizard::NPixmaps];-
494 QVector<QWizardField> pendingFields;-
495 mutable TriState completeState;-
496 bool explicitlyFinal;-
497 bool commit;-
498 QMap<int, QString> buttonCustomTexts;-
499};-
500-
501bool QWizardPagePrivate::cachedIsComplete() const-
502{-
503 Q_Q(const QWizardPage);-
504 if (completeState == Tri_Unknown)
completeState == Tri_UnknownDescription
TRUEnever evaluated
FALSEnever evaluated
0
505 completeState = q->isComplete() ? Tri_True : Tri_False;
never executed: completeState = q->isComplete() ? Tri_True : Tri_False;
q->isComplete()Description
TRUEnever evaluated
FALSEnever evaluated
0
506 return completeState == Tri_True;
never executed: return completeState == Tri_True;
0
507}-
508-
509void QWizardPagePrivate::_q_maybeEmitCompleteChanged()-
510{-
511 Q_Q(QWizardPage);-
512 TriState newState = q->isComplete() ? Tri_True : Tri_False;
q->isComplete()Description
TRUEnever evaluated
FALSEnever evaluated
0
513 if (newState != completeState)
newState != completeStateDescription
TRUEnever evaluated
FALSEnever evaluated
0
514 emit q->completeChanged();
never executed: q->completeChanged();
0
515}
never executed: end of block
0
516-
517void QWizardPagePrivate::_q_updateCachedCompleteState()-
518{-
519 Q_Q(QWizardPage);-
520 completeState = q->isComplete() ? Tri_True : Tri_False;
q->isComplete()Description
TRUEnever evaluated
FALSEnever evaluated
0
521}
never executed: end of block
0
522-
523class QWizardAntiFlickerWidget : public QWidget-
524{-
525public:-
526#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
527 QWizardPrivate *wizardPrivate;-
528 QWizardAntiFlickerWidget(QWizard *wizard, QWizardPrivate *wizardPrivate)-
529 : QWidget(wizard)-
530 , wizardPrivate(wizardPrivate) {}-
531protected:-
532 void paintEvent(QPaintEvent *);-
533#else-
534 QWizardAntiFlickerWidget(QWizard *wizard, QWizardPrivate *)-
535 : QWidget(wizard)-
536 {}
never executed: end of block
0
537#endif-
538};-
539-
540class QWizardPrivate : public QDialogPrivate-
541{-
542 Q_DECLARE_PUBLIC(QWizard)-
543-
544public:-
545 typedef QMap<int, QWizardPage *> PageMap;-
546-
547 enum Direction {-
548 Backward,-
549 Forward-
550 };-
551-
552 inline QWizardPrivate()-
553 : start(-1)-
554 , startSetByUser(false)-
555 , current(-1)-
556 , canContinue(false)-
557 , canFinish(false)-
558 , disableUpdatesCount(0)-
559 , wizStyle(QWizard::ClassicStyle)-
560 , opts(0)-
561 , buttonsHaveCustomLayout(false)-
562 , titleFmt(Qt::AutoText)-
563 , subTitleFmt(Qt::AutoText)-
564 , placeholderWidget1(0)-
565 , placeholderWidget2(0)-
566 , headerWidget(0)-
567 , watermarkLabel(0)-
568 , sideWidget(0)-
569 , pageFrame(0)-
570 , titleLabel(0)-
571 , subTitleLabel(0)-
572 , bottomRuler(0)-
573#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
574 , vistaHelper(0)-
575 , vistaInitPending(false)-
576 , vistaState(QVistaHelper::Dirty)-
577 , vistaStateChanged(false)-
578 , inHandleAeroStyleChange(false)-
579#endif-
580 , minimumWidth(0)-
581 , minimumHeight(0)-
582 , maximumWidth(QWIDGETSIZE_MAX)-
583 , maximumHeight(QWIDGETSIZE_MAX)-
584 {-
585 std::fill(btns, btns + QWizard::NButtons, static_cast<QAbstractButton *>(0));-
586-
587#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
588 if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA-
589 && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))-
590 vistaInitPending = true;-
591#endif-
592 }
never executed: end of block
0
593-
594 void init();-
595 void reset();-
596 void cleanupPagesNotInHistory();-
597 void addField(const QWizardField &field);-
598 void removeFieldAt(int index);-
599 void switchToPage(int newId, Direction direction);-
600 QWizardLayoutInfo layoutInfoForCurrentPage();-
601 void recreateLayout(const QWizardLayoutInfo &info);-
602 void updateLayout();-
603 void updateMinMaxSizes(const QWizardLayoutInfo &info);-
604 void updateCurrentPage();-
605 bool ensureButton(QWizard::WizardButton which) const;-
606 void connectButton(QWizard::WizardButton which) const;-
607 void updateButtonTexts();-
608 void updateButtonLayout();-
609 void setButtonLayout(const QWizard::WizardButton *array, int size);-
610 bool buttonLayoutContains(QWizard::WizardButton which);-
611 void updatePixmap(QWizard::WizardPixmap which);-
612#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
613 bool vistaDisabled() const;-
614 bool isVistaThemeEnabled(QVistaHelper::VistaState state) const;-
615 bool handleAeroStyleChange();-
616#endif-
617 bool isVistaThemeEnabled() const;-
618 void disableUpdates();-
619 void enableUpdates();-
620 void _q_emitCustomButtonClicked();-
621 void _q_updateButtonStates();-
622 void _q_handleFieldObjectDestroyed(QObject *);-
623 void setStyle(QStyle *style);-
624#ifdef Q_OS_MACX-
625 static QPixmap findDefaultBackgroundPixmap();-
626#endif-
627-
628 PageMap pageMap;-
629 QVector<QWizardField> fields;-
630 QMap<QString, int> fieldIndexMap;-
631 QVector<QWizardDefaultProperty> defaultPropertyTable;-
632 QList<int> history;-
633 QSet<int> initialized; // ### remove and move bit to QWizardPage?-
634 int start;-
635 bool startSetByUser;-
636 int current;-
637 bool canContinue;-
638 bool canFinish;-
639 QWizardLayoutInfo layoutInfo;-
640 int disableUpdatesCount;-
641-
642 QWizard::WizardStyle wizStyle;-
643 QWizard::WizardOptions opts;-
644 QMap<int, QString> buttonCustomTexts;-
645 bool buttonsHaveCustomLayout;-
646 QList<QWizard::WizardButton> buttonsCustomLayout;-
647 Qt::TextFormat titleFmt;-
648 Qt::TextFormat subTitleFmt;-
649 mutable QPixmap defaultPixmaps[QWizard::NPixmaps];-
650-
651 union {-
652 // keep in sync with QWizard::WizardButton-
653 mutable struct {-
654 QAbstractButton *back;-
655 QAbstractButton *next;-
656 QAbstractButton *commit;-
657 QAbstractButton *finish;-
658 QAbstractButton *cancel;-
659 QAbstractButton *help;-
660 } btn;-
661 mutable QAbstractButton *btns[QWizard::NButtons];-
662 };-
663 QWizardAntiFlickerWidget *antiFlickerWidget;-
664 QWidget *placeholderWidget1;-
665 QWidget *placeholderWidget2;-
666 QWizardHeader *headerWidget;-
667 QWatermarkLabel *watermarkLabel;-
668 QWidget *sideWidget;-
669 QFrame *pageFrame;-
670 QLabel *titleLabel;-
671 QLabel *subTitleLabel;-
672 QWizardRuler *bottomRuler;-
673-
674 QVBoxLayout *pageVBoxLayout;-
675 QHBoxLayout *buttonLayout;-
676 QGridLayout *mainLayout;-
677-
678#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
679 QVistaHelper *vistaHelper;-
680 bool vistaInitPending;-
681 QVistaHelper::VistaState vistaState;-
682 bool vistaStateChanged;-
683 bool inHandleAeroStyleChange;-
684#endif-
685 int minimumWidth;-
686 int minimumHeight;-
687 int maximumWidth;-
688 int maximumHeight;-
689};-
690-
691static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)-
692{-
693#if defined(QT_NO_STYLE_WINDOWSVISTA)-
694 Q_UNUSED(wizardPrivate);-
695#endif-
696 const bool macStyle = (wstyle == QWizard::MacStyle);-
697 switch (which) {-
698 case QWizard::BackButton:
never executed: case QWizard::BackButton:
0
699 return macStyle ? QWizard::tr("Go Back") : QWizard::tr("< &Back");
never executed: return macStyle ? QWizard::tr("Go Back") : QWizard::tr("< &Back");
macStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
700 case QWizard::NextButton:
never executed: case QWizard::NextButton:
0
701 if (macStyle)
macStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
702 return QWizard::tr("Continue");
never executed: return QWizard::tr("Continue");
0
703 else-
704 return wizardPrivate->isVistaThemeEnabled()
never executed: return wizardPrivate->isVistaThemeEnabled() ? QWizard::tr("&Next") : QWizard::tr("&Next >");
wizardPrivate-...ThemeEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
705 ? QWizard::tr("&Next") : QWizard::tr("&Next >");
never executed: return wizardPrivate->isVistaThemeEnabled() ? QWizard::tr("&Next") : QWizard::tr("&Next >");
0
706 case QWizard::CommitButton:
never executed: case QWizard::CommitButton:
0
707 return QWizard::tr("Commit");
never executed: return QWizard::tr("Commit");
0
708 case QWizard::FinishButton:
never executed: case QWizard::FinishButton:
0
709 return macStyle ? QWizard::tr("Done") : QWizard::tr("&Finish");
never executed: return macStyle ? QWizard::tr("Done") : QWizard::tr("&Finish");
macStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
710 case QWizard::CancelButton:
never executed: case QWizard::CancelButton:
0
711 return QWizard::tr("Cancel");
never executed: return QWizard::tr("Cancel");
0
712 case QWizard::HelpButton:
never executed: case QWizard::HelpButton:
0
713 return macStyle ? QWizard::tr("Help") : QWizard::tr("&Help");
never executed: return macStyle ? QWizard::tr("Help") : QWizard::tr("&Help");
macStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
714 default:
never executed: default:
0
715 return QString();
never executed: return QString();
0
716 }-
717}-
718-
719void QWizardPrivate::init()-
720{-
721 Q_Q(QWizard);-
722-
723 antiFlickerWidget = new QWizardAntiFlickerWidget(q, this);-
724 wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q));-
725 if (wizStyle == QWizard::MacStyle) {
wizStyle == QWizard::MacStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
726 opts = (QWizard::NoDefaultButton | QWizard::NoCancelButton);-
727 } else if (wizStyle == QWizard::ModernStyle) {
never executed: end of block
wizStyle == QW...d::ModernStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
728 opts = QWizard::HelpButtonOnRight;-
729 }
never executed: end of block
0
730-
731#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
732 vistaHelper = new QVistaHelper(q);-
733#endif-
734-
735 // create these buttons right away; create the other buttons as necessary-
736 ensureButton(QWizard::BackButton);-
737 ensureButton(QWizard::NextButton);-
738 ensureButton(QWizard::CommitButton);-
739 ensureButton(QWizard::FinishButton);-
740-
741 pageFrame = new QFrame(antiFlickerWidget);-
742 pageFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);-
743-
744 pageVBoxLayout = new QVBoxLayout(pageFrame);-
745 pageVBoxLayout->setSpacing(0);-
746 pageVBoxLayout->addSpacing(0);-
747 QSpacerItem *spacerItem = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);-
748 pageVBoxLayout->addItem(spacerItem);-
749-
750 buttonLayout = new QHBoxLayout;-
751 mainLayout = new QGridLayout(antiFlickerWidget);-
752 mainLayout->setSizeConstraint(QLayout::SetNoConstraint);-
753-
754 updateButtonLayout();-
755-
756 defaultPropertyTable.reserve(NFallbackDefaultProperties);-
757 for (uint i = 0; i < NFallbackDefaultProperties; ++i)
i < NFallbackDefaultPropertiesDescription
TRUEnever evaluated
FALSEnever evaluated
0
758 defaultPropertyTable.append(QWizardDefaultProperty(fallbackProperties[i].className,
never executed: defaultPropertyTable.append(QWizardDefaultProperty(fallbackProperties[i].className, fallbackProperties[i].property, changed_signal(i)));
0
759 fallbackProperties[i].property,
never executed: defaultPropertyTable.append(QWizardDefaultProperty(fallbackProperties[i].className, fallbackProperties[i].property, changed_signal(i)));
0
760 changed_signal(i)));
never executed: defaultPropertyTable.append(QWizardDefaultProperty(fallbackProperties[i].className, fallbackProperties[i].property, changed_signal(i)));
0
761}
never executed: end of block
0
762-
763void QWizardPrivate::reset()-
764{-
765 Q_Q(QWizard);-
766 if (current != -1) {
current != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
767 q->currentPage()->hide();-
768 cleanupPagesNotInHistory();-
769 for (int i = history.count() - 1; i >= 0; --i)
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
770 q->cleanupPage(history.at(i));
never executed: q->cleanupPage(history.at(i));
0
771 history.clear();-
772 initialized.clear();-
773-
774 current = -1;-
775 emit q->currentIdChanged(-1);-
776 }
never executed: end of block
0
777}
never executed: end of block
0
778-
779void QWizardPrivate::cleanupPagesNotInHistory()-
780{-
781 Q_Q(QWizard);-
782-
783 const QSet<int> original = initialized;-
784 QSet<int>::const_iterator i = original.constBegin();-
785 QSet<int>::const_iterator end = original.constEnd();-
786-
787 for (; i != end; ++i) {
i != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
788 if (!history.contains(*i)) {
!history.contains(*i)Description
TRUEnever evaluated
FALSEnever evaluated
0
789 q->cleanupPage(*i);-
790 initialized.remove(*i);-
791 }
never executed: end of block
0
792 }
never executed: end of block
0
793}
never executed: end of block
0
794-
795void QWizardPrivate::addField(const QWizardField &field)-
796{-
797 Q_Q(QWizard);-
798-
799 QWizardField myField = field;-
800 myField.resolve(defaultPropertyTable);-
801-
802 if (fieldIndexMap.contains(myField.name)) {
fieldIndexMap....(myField.name)Description
TRUEnever evaluated
FALSEnever evaluated
0
803 qWarning("QWizardPage::addField: Duplicate field '%s'", qPrintable(myField.name));-
804 return;
never executed: return;
0
805 }-
806-
807 fieldIndexMap.insert(myField.name, fields.count());-
808 fields += myField;-
809 if (myField.mandatory && !myField.changedSignal.isEmpty())
myField.mandatoryDescription
TRUEnever evaluated
FALSEnever evaluated
!myField.chang...gnal.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
810 QObject::connect(myField.object, myField.changedSignal,
never executed: QObject::connect(myField.object, myField.changedSignal, myField.page, qFlagLocation("1""_q_maybeEmitCompleteChanged()" "\0" __FILE__ ":" "811"));
0
811 myField.page, SLOT(_q_maybeEmitCompleteChanged()));
never executed: QObject::connect(myField.object, myField.changedSignal, myField.page, qFlagLocation("1""_q_maybeEmitCompleteChanged()" "\0" __FILE__ ":" "811"));
0
812 QObject::connect(-
813 myField.object, SIGNAL(destroyed(QObject*)), q,-
814 SLOT(_q_handleFieldObjectDestroyed(QObject*)));-
815}
never executed: end of block
0
816-
817void QWizardPrivate::removeFieldAt(int index)-
818{-
819 Q_Q(QWizard);-
820-
821 const QWizardField &field = fields.at(index);-
822 fieldIndexMap.remove(field.name);-
823 if (field.mandatory && !field.changedSignal.isEmpty())
field.mandatoryDescription
TRUEnever evaluated
FALSEnever evaluated
!field.changedSignal.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
824 QObject::disconnect(field.object, field.changedSignal,
never executed: QObject::disconnect(field.object, field.changedSignal, field.page, qFlagLocation("1""_q_maybeEmitCompleteChanged()" "\0" __FILE__ ":" "825"));
0
825 field.page, SLOT(_q_maybeEmitCompleteChanged()));
never executed: QObject::disconnect(field.object, field.changedSignal, field.page, qFlagLocation("1""_q_maybeEmitCompleteChanged()" "\0" __FILE__ ":" "825"));
0
826 QObject::disconnect(-
827 field.object, SIGNAL(destroyed(QObject*)), q,-
828 SLOT(_q_handleFieldObjectDestroyed(QObject*)));-
829 fields.remove(index);-
830}
never executed: end of block
0
831-
832void QWizardPrivate::switchToPage(int newId, Direction direction)-
833{-
834 Q_Q(QWizard);-
835-
836 disableUpdates();-
837-
838 int oldId = current;-
839 if (QWizardPage *oldPage = q->currentPage()) {
QWizardPage *o...>currentPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
840 oldPage->hide();-
841-
842 if (direction == Backward) {
direction == BackwardDescription
TRUEnever evaluated
FALSEnever evaluated
0
843 if (!(opts & QWizard::IndependentPages)) {
!(opts & QWiza...ependentPages)Description
TRUEnever evaluated
FALSEnever evaluated
0
844 q->cleanupPage(oldId);-
845 initialized.remove(oldId);-
846 }
never executed: end of block
0
847 Q_ASSERT(history.last() == oldId);-
848 history.removeLast();-
849 Q_ASSERT(history.last() == newId);-
850 }
never executed: end of block
0
851 }
never executed: end of block
0
852-
853 current = newId;-
854-
855 QWizardPage *newPage = q->currentPage();-
856 if (newPage) {
newPageDescription
TRUEnever evaluated
FALSEnever evaluated
0
857 if (direction == Forward) {
direction == ForwardDescription
TRUEnever evaluated
FALSEnever evaluated
0
858 if (!initialized.contains(current)) {
!initialized.contains(current)Description
TRUEnever evaluated
FALSEnever evaluated
0
859 initialized.insert(current);-
860 q->initializePage(current);-
861 }
never executed: end of block
0
862 history.append(current);-
863 }
never executed: end of block
0
864 newPage->show();-
865 }
never executed: end of block
0
866-
867 canContinue = (q->nextId() != -1);-
868 canFinish = (newPage && newPage->isFinalPage());
newPageDescription
TRUEnever evaluated
FALSEnever evaluated
newPage->isFinalPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
869-
870 _q_updateButtonStates();-
871 updateButtonTexts();-
872-
873 const QWizard::WizardButton nextOrCommit =-
874 newPage && newPage->isCommitPage() ? QWizard::CommitButton : QWizard::NextButton;
newPageDescription
TRUEnever evaluated
FALSEnever evaluated
newPage->isCommitPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
875 QAbstractButton *nextOrFinishButton =-
876 btns[canContinue ? nextOrCommit : QWizard::FinishButton];-
877 QWidget *candidate = 0;-
878-
879 /*-
880 If there is no default button and the Next or Finish button-
881 is enabled, give focus directly to it as a convenience to the-
882 user. This is the normal case on OS X.-
883-
884 Otherwise, give the focus to the new page's first child that-
885 can handle it. If there is no such child, give the focus to-
886 Next or Finish.-
887 */-
888 if ((opts & QWizard::NoDefaultButton) && nextOrFinishButton->isEnabled()) {
(opts & QWizar...DefaultButton)Description
TRUEnever evaluated
FALSEnever evaluated
nextOrFinishBu...n->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
889 candidate = nextOrFinishButton;-
890 } else if (newPage) {
never executed: end of block
newPageDescription
TRUEnever evaluated
FALSEnever evaluated
0
891 candidate = iWantTheFocus(newPage);-
892 }
never executed: end of block
0
893 if (!candidate)
!candidateDescription
TRUEnever evaluated
FALSEnever evaluated
0
894 candidate = nextOrFinishButton;
never executed: candidate = nextOrFinishButton;
0
895 candidate->setFocus();-
896-
897 if (wizStyle == QWizard::MacStyle)
wizStyle == QWizard::MacStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
898 q->updateGeometry();
never executed: q->updateGeometry();
0
899-
900 enableUpdates();-
901 updateLayout();-
902-
903 emit q->currentIdChanged(current);-
904}
never executed: end of block
0
905-
906// keep in sync with QWizard::WizardButton-
907static const char * buttonSlots(QWizard::WizardButton which)-
908{-
909 switch (which) {-
910 case QWizard::BackButton:
never executed: case QWizard::BackButton:
0
911 return SLOT(back());
never executed: return qFlagLocation("1""back()" "\0" __FILE__ ":" "911");
0
912 case QWizard::NextButton:
never executed: case QWizard::NextButton:
0
913 case QWizard::CommitButton:
never executed: case QWizard::CommitButton:
0
914 return SLOT(next());
never executed: return qFlagLocation("1""next()" "\0" __FILE__ ":" "914");
0
915 case QWizard::FinishButton:
never executed: case QWizard::FinishButton:
0
916 return SLOT(accept());
never executed: return qFlagLocation("1""accept()" "\0" __FILE__ ":" "916");
0
917 case QWizard::CancelButton:
never executed: case QWizard::CancelButton:
0
918 return SLOT(reject());
never executed: return qFlagLocation("1""reject()" "\0" __FILE__ ":" "918");
0
919 case QWizard::HelpButton:
never executed: case QWizard::HelpButton:
0
920 return SIGNAL(helpRequested());
never executed: return qFlagLocation("2""helpRequested()" "\0" __FILE__ ":" "920");
0
921 case QWizard::CustomButton1:
never executed: case QWizard::CustomButton1:
0
922 case QWizard::CustomButton2:
never executed: case QWizard::CustomButton2:
0
923 case QWizard::CustomButton3:
never executed: case QWizard::CustomButton3:
0
924 case QWizard::Stretch:
never executed: case QWizard::Stretch:
0
925 case QWizard::NoButton:
never executed: case QWizard::NoButton:
0
926 Q_UNREACHABLE();-
927 };
never executed: end of block
0
928 return 0;
never executed: return 0;
0
929};-
930-
931QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()-
932{-
933 Q_Q(QWizard);-
934 QStyle *style = q->style();-
935-
936 QWizardLayoutInfo info;-
937-
938 const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);-
939 info.topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q);-
940 info.topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q);-
941 info.topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, q);-
942 info.topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q);-
943 info.childMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, titleLabel);-
944 info.childMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, titleLabel);-
945 info.childMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, titleLabel);-
946 info.childMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, titleLabel);-
947 info.hspacing = (layoutHorizontalSpacing == -1)
(layoutHorizon...Spacing == -1)Description
TRUEnever evaluated
FALSEnever evaluated
0
948 ? style->layoutSpacing(QSizePolicy::DefaultType, QSizePolicy::DefaultType, Qt::Horizontal)-
949 : layoutHorizontalSpacing;-
950 info.vspacing = style->pixelMetric(QStyle::PM_LayoutVerticalSpacing);-
951 info.buttonSpacing = (layoutHorizontalSpacing == -1)
(layoutHorizon...Spacing == -1)Description
TRUEnever evaluated
FALSEnever evaluated
0
952 ? style->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal)-
953 : layoutHorizontalSpacing;-
954-
955 if (wizStyle == QWizard::MacStyle)
wizStyle == QWizard::MacStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
956 info.buttonSpacing = 12;
never executed: info.buttonSpacing = 12;
0
957-
958 info.wizStyle = wizStyle;-
959 if (info.wizStyle == QWizard::AeroStyle
info.wizStyle ...ard::AeroStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
960#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
961 && (QVistaHelper::vistaState() == QVistaHelper::Classic || vistaDisabled())-
962#endif-
963 )-
964 info.wizStyle = QWizard::ModernStyle;
never executed: info.wizStyle = QWizard::ModernStyle;
0
965-
966 QString titleText;-
967 QString subTitleText;-
968 QPixmap backgroundPixmap;-
969 QPixmap watermarkPixmap;-
970-
971 if (QWizardPage *page = q->currentPage()) {
QWizardPage *p...>currentPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
972 titleText = page->title();-
973 subTitleText = page->subTitle();-
974 backgroundPixmap = page->pixmap(QWizard::BackgroundPixmap);-
975 watermarkPixmap = page->pixmap(QWizard::WatermarkPixmap);-
976 }
never executed: end of block
0
977-
978 info.header = (info.wizStyle == QWizard::ClassicStyle || info.wizStyle == QWizard::ModernStyle)
info.wizStyle ...::ClassicStyleDescription
TRUEnever evaluated
FALSEnever evaluated
info.wizStyle ...d::ModernStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
979 && !(opts & QWizard::IgnoreSubTitles) && !subTitleText.isEmpty();
!(opts & QWiza...noreSubTitles)Description
TRUEnever evaluated
FALSEnever evaluated
!subTitleText.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
980 info.sideWidget = sideWidget;-
981 info.watermark = (info.wizStyle != QWizard::MacStyle) && (info.wizStyle != QWizard::AeroStyle)
(info.wizStyle...ard::MacStyle)Description
TRUEnever evaluated
FALSEnever evaluated
(info.wizStyle...rd::AeroStyle)Description
TRUEnever evaluated
FALSEnever evaluated
0
982 && !watermarkPixmap.isNull();
!watermarkPixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
983 info.title = !info.header && !titleText.isEmpty();
!info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
!titleText.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
984 info.subTitle = !(opts & QWizard::IgnoreSubTitles) && !info.header && !subTitleText.isEmpty();
!(opts & QWiza...noreSubTitles)Description
TRUEnever evaluated
FALSEnever evaluated
!info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
!subTitleText.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
985 info.extension = (info.watermark || info.sideWidget) && (opts & QWizard::ExtendedWatermarkPixmap);
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
info.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
(opts & QWizar...termarkPixmap)Description
TRUEnever evaluated
FALSEnever evaluated
0
986-
987 return info;
never executed: return info;
0
988}-
989-
990void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info)-
991{-
992 Q_Q(QWizard);-
993-
994 /*-
995 Start by undoing the main layout.-
996 */-
997 for (int i = mainLayout->count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
998 QLayoutItem *item = mainLayout->takeAt(i);-
999 if (item->layout()) {
item->layout()Description
TRUEnever evaluated
FALSEnever evaluated
0
1000 item->layout()->setParent(0);-
1001 } else {
never executed: end of block
0
1002 delete item;-
1003 }
never executed: end of block
0
1004 }-
1005 for (int i = mainLayout->columnCount() - 1; i >= 0; --i)
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1006 mainLayout->setColumnMinimumWidth(i, 0);
never executed: mainLayout->setColumnMinimumWidth(i, 0);
0
1007 for (int i = mainLayout->rowCount() - 1; i >= 0; --i)
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1008 mainLayout->setRowMinimumHeight(i, 0);
never executed: mainLayout->setRowMinimumHeight(i, 0);
0
1009-
1010 /*-
1011 Now, recreate it.-
1012 */-
1013-
1014 bool mac = (info.wizStyle == QWizard::MacStyle);-
1015 bool classic = (info.wizStyle == QWizard::ClassicStyle);-
1016 bool modern = (info.wizStyle == QWizard::ModernStyle);-
1017 bool aero = (info.wizStyle == QWizard::AeroStyle);-
1018 int deltaMarginLeft = info.topLevelMarginLeft - info.childMarginLeft;-
1019 int deltaMarginRight = info.topLevelMarginRight - info.childMarginRight;-
1020 int deltaMarginTop = info.topLevelMarginTop - info.childMarginTop;-
1021 int deltaMarginBottom = info.topLevelMarginBottom - info.childMarginBottom;-
1022 int deltaVSpacing = info.topLevelMarginBottom - info.vspacing;-
1023-
1024 int row = 0;-
1025 int numColumns;-
1026 if (mac) {
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1027 numColumns = 3;-
1028 } else if (info.watermark || info.sideWidget) {
never executed: end of block
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
info.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1029 numColumns = 2;-
1030 } else {
never executed: end of block
0
1031 numColumns = 1;-
1032 }
never executed: end of block
0
1033 int pageColumn = qMin(1, numColumns - 1);-
1034-
1035 if (mac) {
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1036 mainLayout->setMargin(0);-
1037 mainLayout->setSpacing(0);-
1038 buttonLayout->setContentsMargins(MacLayoutLeftMargin, MacButtonTopMargin, MacLayoutRightMargin, MacLayoutBottomMargin);-
1039 pageVBoxLayout->setMargin(7);-
1040 } else {
never executed: end of block
0
1041 if (modern) {
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
1042 mainLayout->setMargin(0);-
1043 mainLayout->setSpacing(0);-
1044 pageVBoxLayout->setContentsMargins(deltaMarginLeft, deltaMarginTop,-
1045 deltaMarginRight, deltaMarginBottom);-
1046 buttonLayout->setContentsMargins(info.topLevelMarginLeft, info.topLevelMarginTop,-
1047 info.topLevelMarginRight, info.topLevelMarginBottom);-
1048 } else {
never executed: end of block
0
1049 mainLayout->setContentsMargins(info.topLevelMarginLeft, info.topLevelMarginTop,-
1050 info.topLevelMarginRight, info.topLevelMarginBottom);-
1051 mainLayout->setHorizontalSpacing(info.hspacing);-
1052 mainLayout->setVerticalSpacing(info.vspacing);-
1053 pageVBoxLayout->setContentsMargins(0, 0, 0, 0);-
1054 buttonLayout->setContentsMargins(0, 0, 0, 0);-
1055 }
never executed: end of block
0
1056 }-
1057 buttonLayout->setSpacing(info.buttonSpacing);-
1058-
1059 if (info.header) {
info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1060 if (!headerWidget)
!headerWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1061 headerWidget = new QWizardHeader(antiFlickerWidget);
never executed: headerWidget = new QWizardHeader(antiFlickerWidget);
0
1062 headerWidget->setAutoFillBackground(modern);-
1063 mainLayout->addWidget(headerWidget, row++, 0, 1, numColumns);-
1064 }
never executed: end of block
0
1065 if (headerWidget)
headerWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1066 headerWidget->setVisible(info.header);
never executed: headerWidget->setVisible(info.header);
0
1067-
1068 int watermarkStartRow = row;-
1069-
1070 if (mac)
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1071 mainLayout->setRowMinimumHeight(row++, 10);
never executed: mainLayout->setRowMinimumHeight(row++, 10);
0
1072-
1073 if (info.title) {
info.titleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1074 if (!titleLabel) {
!titleLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1075 titleLabel = new QLabel(antiFlickerWidget);-
1076 titleLabel->setBackgroundRole(QPalette::Base);-
1077 titleLabel->setWordWrap(true);-
1078 }
never executed: end of block
0
1079-
1080 QFont titleFont = q->font();-
1081 titleFont.setPointSize(titleFont.pointSize() + (mac ? 3 : 4));-
1082 titleFont.setBold(true);-
1083 titleLabel->setPalette(QPalette());-
1084-
1085 if (aero) {
aeroDescription
TRUEnever evaluated
FALSEnever evaluated
0
1086 // ### hardcoded for now:-
1087 titleFont = QFont(QLatin1String("Segoe UI"), 12);-
1088 QPalette pal(titleLabel->palette());-
1089 pal.setColor(QPalette::Text, "#003399");-
1090 titleLabel->setPalette(pal);-
1091 }
never executed: end of block
0
1092-
1093 titleLabel->setFont(titleFont);-
1094 const int aeroTitleIndent = 25; // ### hardcoded for now - should be calculated somehow-
1095 if (aero)
aeroDescription
TRUEnever evaluated
FALSEnever evaluated
0
1096 titleLabel->setIndent(aeroTitleIndent);
never executed: titleLabel->setIndent(aeroTitleIndent);
0
1097 else if (mac)
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1098 titleLabel->setIndent(2);
never executed: titleLabel->setIndent(2);
0
1099 else if (classic)
classicDescription
TRUEnever evaluated
FALSEnever evaluated
0
1100 titleLabel->setIndent(info.childMarginLeft);
never executed: titleLabel->setIndent(info.childMarginLeft);
0
1101 else-
1102 titleLabel->setIndent(info.topLevelMarginLeft);
never executed: titleLabel->setIndent(info.topLevelMarginLeft);
0
1103 if (modern) {
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
1104 if (!placeholderWidget1) {
!placeholderWidget1Description
TRUEnever evaluated
FALSEnever evaluated
0
1105 placeholderWidget1 = new QWidget(antiFlickerWidget);-
1106 placeholderWidget1->setBackgroundRole(QPalette::Base);-
1107 }
never executed: end of block
0
1108 placeholderWidget1->setFixedHeight(info.topLevelMarginLeft + 2);-
1109 mainLayout->addWidget(placeholderWidget1, row++, pageColumn);-
1110 }
never executed: end of block
0
1111 mainLayout->addWidget(titleLabel, row++, pageColumn);-
1112 if (modern) {
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
1113 if (!placeholderWidget2) {
!placeholderWidget2Description
TRUEnever evaluated
FALSEnever evaluated
0
1114 placeholderWidget2 = new QWidget(antiFlickerWidget);-
1115 placeholderWidget2->setBackgroundRole(QPalette::Base);-
1116 }
never executed: end of block
0
1117 placeholderWidget2->setFixedHeight(5);-
1118 mainLayout->addWidget(placeholderWidget2, row++, pageColumn);-
1119 }
never executed: end of block
0
1120 if (mac)
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1121 mainLayout->setRowMinimumHeight(row++, 7);
never executed: mainLayout->setRowMinimumHeight(row++, 7);
0
1122 }
never executed: end of block
0
1123 if (placeholderWidget1)
placeholderWidget1Description
TRUEnever evaluated
FALSEnever evaluated
0
1124 placeholderWidget1->setVisible(info.title && modern);
never executed: placeholderWidget1->setVisible(info.title && modern);
0
1125 if (placeholderWidget2)
placeholderWidget2Description
TRUEnever evaluated
FALSEnever evaluated
0
1126 placeholderWidget2->setVisible(info.title && modern);
never executed: placeholderWidget2->setVisible(info.title && modern);
0
1127-
1128 if (info.subTitle) {
info.subTitleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1129 if (!subTitleLabel) {
!subTitleLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1130 subTitleLabel = new QLabel(pageFrame);-
1131 subTitleLabel->setWordWrap(true);-
1132-
1133 subTitleLabel->setContentsMargins(info.childMarginLeft , 0,-
1134 info.childMarginRight , 0);-
1135-
1136 pageVBoxLayout->insertWidget(1, subTitleLabel);-
1137 }
never executed: end of block
0
1138 }
never executed: end of block
0
1139-
1140 // ### try to replace with margin.-
1141 changeSpacerSize(pageVBoxLayout, 0, 0, info.subTitle ? info.childMarginLeft : 0);-
1142-
1143 int hMargin = mac ? 1 : 0;
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1144 int vMargin = hMargin;-
1145-
1146 pageFrame->setFrameStyle(mac ? (QFrame::Box | QFrame::Raised) : QFrame::NoFrame);-
1147 pageFrame->setLineWidth(0);-
1148 pageFrame->setMidLineWidth(hMargin);-
1149-
1150 if (info.header) {
info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1151 if (modern) {
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
1152 hMargin = info.topLevelMarginLeft;-
1153 vMargin = deltaMarginBottom;-
1154 } else if (classic) {
never executed: end of block
classicDescription
TRUEnever evaluated
FALSEnever evaluated
0
1155 hMargin = deltaMarginLeft + ClassicHMargin;-
1156 vMargin = 0;-
1157 }
never executed: end of block
0
1158 }
never executed: end of block
0
1159-
1160 if (aero) {
aeroDescription
TRUEnever evaluated
FALSEnever evaluated
0
1161 int leftMargin = 18; // ### hardcoded for now - should be calculated somehow-
1162 int topMargin = vMargin;-
1163 int rightMargin = hMargin; // ### for now-
1164 int bottomMargin = vMargin;-
1165 pageFrame->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin);-
1166 } else {
never executed: end of block
0
1167 pageFrame->setContentsMargins(hMargin, vMargin, hMargin, vMargin);-
1168 }
never executed: end of block
0
1169-
1170 if ((info.watermark || info.sideWidget) && !watermarkLabel) {
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
info.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
!watermarkLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1171 watermarkLabel = new QWatermarkLabel(antiFlickerWidget, sideWidget);-
1172 watermarkLabel->setBackgroundRole(QPalette::Base);-
1173 watermarkLabel->setMinimumHeight(1);-
1174 watermarkLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);-
1175 watermarkLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);-
1176 }
never executed: end of block
0
1177-
1178 //bool wasSemiTransparent = pageFrame->testAttribute(Qt::WA_SetPalette);-
1179 const bool wasSemiTransparent =-
1180 pageFrame->palette().brush(QPalette::Window).color().alpha() < 255
pageFrame->pal....alpha() < 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1181 || pageFrame->palette().brush(QPalette::Base).color().alpha() < 255;
pageFrame->pal....alpha() < 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1182 if (mac) {
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1183 if (!wasSemiTransparent) {
!wasSemiTransparentDescription
TRUEnever evaluated
FALSEnever evaluated
0
1184 QPalette pal = pageFrame->palette();-
1185 pal.setBrush(QPalette::Window, QColor(255, 255, 255, 153));-
1186 // ### The next line is required to ensure visual semitransparency when-
1187 // ### switching from ModernStyle to MacStyle. See TAG1 below.-
1188 pal.setBrush(QPalette::Base, QColor(255, 255, 255, 153));-
1189 pageFrame->setPalette(pal);-
1190 pageFrame->setAutoFillBackground(true);-
1191 antiFlickerWidget->setAutoFillBackground(false);-
1192 }
never executed: end of block
0
1193 } else {
never executed: end of block
0
1194 if (wasSemiTransparent)
wasSemiTransparentDescription
TRUEnever evaluated
FALSEnever evaluated
0
1195 pageFrame->setPalette(QPalette());
never executed: pageFrame->setPalette(QPalette());
0
1196-
1197 bool baseBackground = (modern && !info.header); // ### TAG1
modernDescription
TRUEnever evaluated
FALSEnever evaluated
!info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1198 pageFrame->setBackgroundRole(baseBackground ? QPalette::Base : QPalette::Window);-
1199-
1200 if (titleLabel)
titleLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1201 titleLabel->setAutoFillBackground(baseBackground);
never executed: titleLabel->setAutoFillBackground(baseBackground);
0
1202 pageFrame->setAutoFillBackground(baseBackground);-
1203 if (watermarkLabel)
watermarkLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1204 watermarkLabel->setAutoFillBackground(baseBackground);
never executed: watermarkLabel->setAutoFillBackground(baseBackground);
0
1205 if (placeholderWidget1)
placeholderWidget1Description
TRUEnever evaluated
FALSEnever evaluated
0
1206 placeholderWidget1->setAutoFillBackground(baseBackground);
never executed: placeholderWidget1->setAutoFillBackground(baseBackground);
0
1207 if (placeholderWidget2)
placeholderWidget2Description
TRUEnever evaluated
FALSEnever evaluated
0
1208 placeholderWidget2->setAutoFillBackground(baseBackground);
never executed: placeholderWidget2->setAutoFillBackground(baseBackground);
0
1209-
1210 if (aero) {
aeroDescription
TRUEnever evaluated
FALSEnever evaluated
0
1211 QPalette pal = pageFrame->palette();-
1212 pal.setBrush(QPalette::Window, QColor(255, 255, 255));-
1213 pageFrame->setPalette(pal);-
1214 pageFrame->setAutoFillBackground(true);-
1215 pal = antiFlickerWidget->palette();-
1216 pal.setBrush(QPalette::Window, QColor(255, 255, 255));-
1217 antiFlickerWidget->setPalette(pal);-
1218 antiFlickerWidget->setAutoFillBackground(true);-
1219 }
never executed: end of block
0
1220 }
never executed: end of block
0
1221-
1222 mainLayout->addWidget(pageFrame, row++, pageColumn);-
1223-
1224 int watermarkEndRow = row;-
1225 if (classic)
classicDescription
TRUEnever evaluated
FALSEnever evaluated
0
1226 mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
never executed: mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
0
1227-
1228 if (aero) {
aeroDescription
TRUEnever evaluated
FALSEnever evaluated
0
1229 buttonLayout->setContentsMargins(9, 9, 9, 9);-
1230 mainLayout->setContentsMargins(0, 11, 0, 0);-
1231 }
never executed: end of block
0
1232-
1233 int buttonStartColumn = info.extension ? 1 : 0;
info.extensionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1234 int buttonNumColumns = info.extension ? 1 : numColumns;
info.extensionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1235-
1236 if (classic || modern) {
classicDescription
TRUEnever evaluated
FALSEnever evaluated
modernDescription
TRUEnever evaluated
FALSEnever evaluated
0
1237 if (!bottomRuler)
!bottomRulerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1238 bottomRuler = new QWizardRuler(antiFlickerWidget);
never executed: bottomRuler = new QWizardRuler(antiFlickerWidget);
0
1239 mainLayout->addWidget(bottomRuler, row++, buttonStartColumn, 1, buttonNumColumns);-
1240 }
never executed: end of block
0
1241-
1242 if (classic)
classicDescription
TRUEnever evaluated
FALSEnever evaluated
0
1243 mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
never executed: mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
0
1244-
1245 mainLayout->addLayout(buttonLayout, row++, buttonStartColumn, 1, buttonNumColumns);-
1246-
1247 if (info.watermark || info.sideWidget) {
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
info.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1248 if (info.extension)
info.extensionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1249 watermarkEndRow = row;
never executed: watermarkEndRow = row;
0
1250 mainLayout->addWidget(watermarkLabel, watermarkStartRow, 0,-
1251 watermarkEndRow - watermarkStartRow, 1);-
1252 }
never executed: end of block
0
1253-
1254 mainLayout->setColumnMinimumWidth(0, mac && !info.watermark ? 181 : 0);-
1255 if (mac)
macDescription
TRUEnever evaluated
FALSEnever evaluated
0
1256 mainLayout->setColumnMinimumWidth(2, 21);
never executed: mainLayout->setColumnMinimumWidth(2, 21);
0
1257-
1258 if (headerWidget)
headerWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1259 headerWidget->setVisible(info.header);
never executed: headerWidget->setVisible(info.header);
0
1260 if (titleLabel)
titleLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1261 titleLabel->setVisible(info.title);
never executed: titleLabel->setVisible(info.title);
0
1262 if (subTitleLabel)
subTitleLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1263 subTitleLabel->setVisible(info.subTitle);
never executed: subTitleLabel->setVisible(info.subTitle);
0
1264 if (bottomRuler)
bottomRulerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1265 bottomRuler->setVisible(classic || modern);
never executed: bottomRuler->setVisible(classic || modern);
0
1266 if (watermarkLabel)
watermarkLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1267 watermarkLabel->setVisible(info.watermark || info.sideWidget);
never executed: watermarkLabel->setVisible(info.watermark || info.sideWidget);
0
1268-
1269 layoutInfo = info;-
1270}
never executed: end of block
0
1271-
1272void QWizardPrivate::updateLayout()-
1273{-
1274 Q_Q(QWizard);-
1275-
1276 disableUpdates();-
1277-
1278 QWizardLayoutInfo info = layoutInfoForCurrentPage();-
1279 if (layoutInfo != info)
layoutInfo != infoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1280 recreateLayout(info);
never executed: recreateLayout(info);
0
1281 QWizardPage *page = q->currentPage();-
1282-
1283 // If the page can expand vertically, let it stretch "infinitely" more-
1284 // than the QSpacerItem at the bottom. Otherwise, let the QSpacerItem-
1285 // stretch "infinitely" more than the page. Change the bottom item's-
1286 // policy accordingly. The case that the page has no layout is basically-
1287 // for Designer, only.-
1288 if (page) {
pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
1289 bool expandPage = !page->layout();-
1290 if (!expandPage) {
!expandPageDescription
TRUEnever evaluated
FALSEnever evaluated
0
1291 const QLayoutItem *pageItem = pageVBoxLayout->itemAt(pageVBoxLayout->indexOf(page));-
1292 expandPage = pageItem->expandingDirections() & Qt::Vertical;-
1293 }
never executed: end of block
0
1294 QSpacerItem *bottomSpacer = pageVBoxLayout->itemAt(pageVBoxLayout->count() - 1)->spacerItem();-
1295 Q_ASSERT(bottomSpacer);-
1296 bottomSpacer->changeSize(0, 0, QSizePolicy::Ignored, expandPage ? QSizePolicy::Ignored : QSizePolicy::MinimumExpanding);-
1297 pageVBoxLayout->invalidate();-
1298 }
never executed: end of block
0
1299-
1300 if (info.header) {
info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1301 Q_ASSERT(page);-
1302 headerWidget->setup(info, page->title(), page->subTitle(),-
1303 page->pixmap(QWizard::LogoPixmap), page->pixmap(QWizard::BannerPixmap),-
1304 titleFmt, subTitleFmt);-
1305 }
never executed: end of block
0
1306-
1307 if (info.watermark || info.sideWidget) {
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
info.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1308 QPixmap pix;-
1309 if (info.watermark) {
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
0
1310 if (page)
pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
1311 pix = page->pixmap(QWizard::WatermarkPixmap);
never executed: pix = page->pixmap(QWizard::WatermarkPixmap);
0
1312 else-
1313 pix = q->pixmap(QWizard::WatermarkPixmap);
never executed: pix = q->pixmap(QWizard::WatermarkPixmap);
0
1314 }-
1315 watermarkLabel->setPixmap(pix); // in case there is no watermark and we show the side widget we need to clear the watermark-
1316 }
never executed: end of block
0
1317-
1318 if (info.title) {
info.titleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1319 Q_ASSERT(page);-
1320 titleLabel->setTextFormat(titleFmt);-
1321 titleLabel->setText(page->title());-
1322 }
never executed: end of block
0
1323 if (info.subTitle) {
info.subTitleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1324 Q_ASSERT(page);-
1325 subTitleLabel->setTextFormat(subTitleFmt);-
1326 subTitleLabel->setText(page->subTitle());-
1327 }
never executed: end of block
0
1328-
1329 enableUpdates();-
1330 updateMinMaxSizes(info);-
1331}
never executed: end of block
0
1332-
1333void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info)-
1334{-
1335 Q_Q(QWizard);-
1336-
1337 int extraHeight = 0;-
1338#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
1339 if (isVistaThemeEnabled())-
1340 extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset();-
1341#endif-
1342 QSize minimumSize = mainLayout->totalMinimumSize() + QSize(0, extraHeight);-
1343 QSize maximumSize = mainLayout->totalMaximumSize();-
1344 if (info.header && headerWidget->maximumWidth() != QWIDGETSIZE_MAX) {
info.headerDescription
TRUEnever evaluated
FALSEnever evaluated
headerWidget->...!= ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
0
1345 minimumSize.setWidth(headerWidget->maximumWidth());-
1346 maximumSize.setWidth(headerWidget->maximumWidth());-
1347 }
never executed: end of block
0
1348 if (info.watermark && !info.sideWidget) {
info.watermarkDescription
TRUEnever evaluated
FALSEnever evaluated
!info.sideWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1349 minimumSize.setHeight(mainLayout->totalSizeHint().height());-
1350 }
never executed: end of block
0
1351 if (q->minimumWidth() == minimumWidth) {
q->minimumWidt...= minimumWidthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1352 minimumWidth = minimumSize.width();-
1353 q->setMinimumWidth(minimumWidth);-
1354 }
never executed: end of block
0
1355 if (q->minimumHeight() == minimumHeight) {
q->minimumHeig... minimumHeightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1356 minimumHeight = minimumSize.height();-
1357 q->setMinimumHeight(minimumHeight);-
1358 }
never executed: end of block
0
1359 if (q->maximumWidth() == maximumWidth) {
q->maximumWidt...= maximumWidthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1360 maximumWidth = maximumSize.width();-
1361 q->setMaximumWidth(maximumWidth);-
1362 }
never executed: end of block
0
1363 if (q->maximumHeight() == maximumHeight) {
q->maximumHeig... maximumHeightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1364 maximumHeight = maximumSize.height();-
1365 q->setMaximumHeight(maximumHeight);-
1366 }
never executed: end of block
0
1367}
never executed: end of block
0
1368-
1369void QWizardPrivate::updateCurrentPage()-
1370{-
1371 Q_Q(QWizard);-
1372 if (q->currentPage()) {
q->currentPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
1373 canContinue = (q->nextId() != -1);-
1374 canFinish = q->currentPage()->isFinalPage();-
1375 } else {
never executed: end of block
0
1376 canContinue = false;-
1377 canFinish = false;-
1378 }
never executed: end of block
0
1379 _q_updateButtonStates();-
1380 updateButtonTexts();-
1381}
never executed: end of block
0
1382-
1383static QString object_name_for_button(QWizard::WizardButton which)-
1384{-
1385 switch (which) {-
1386 case QWizard::CommitButton:
never executed: case QWizard::CommitButton:
0
1387 return QLatin1String("qt_wizard_") + QLatin1String("commit");
never executed: return QLatin1String("qt_wizard_") + QLatin1String("commit");
0
1388 case QWizard::FinishButton:
never executed: case QWizard::FinishButton:
0
1389 return QLatin1String("qt_wizard_") + QLatin1String("finish");
never executed: return QLatin1String("qt_wizard_") + QLatin1String("finish");
0
1390 case QWizard::CancelButton:
never executed: case QWizard::CancelButton:
0
1391 return QLatin1String("qt_wizard_") + QLatin1String("cancel");
never executed: return QLatin1String("qt_wizard_") + QLatin1String("cancel");
0
1392 case QWizard::BackButton:
never executed: case QWizard::BackButton:
0
1393 case QWizard::NextButton:
never executed: case QWizard::NextButton:
0
1394 case QWizard::HelpButton:
never executed: case QWizard::HelpButton:
0
1395 case QWizard::CustomButton1:
never executed: case QWizard::CustomButton1:
0
1396 case QWizard::CustomButton2:
never executed: case QWizard::CustomButton2:
0
1397 case QWizard::CustomButton3:
never executed: case QWizard::CustomButton3:
0
1398 // Make navigation buttons detectable as passive interactor in designer-
1399 return QLatin1String("__qt__passive_wizardbutton") + QString::number(which);
never executed: return QLatin1String("__qt__passive_wizardbutton") + QString::number(which);
0
1400 case QWizard::Stretch:
never executed: case QWizard::Stretch:
0
1401 case QWizard::NoButton:
never executed: case QWizard::NoButton:
0
1402 //case QWizard::NStandardButtons:-
1403 //case QWizard::NButtons:-
1404 ;-
1405 }
never executed: end of block
0
1406 Q_UNREACHABLE();-
1407 return QString();
never executed: return QString();
0
1408}-
1409-
1410bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const-
1411{-
1412 Q_Q(const QWizard);-
1413 if (uint(which) >= QWizard::NButtons)
uint(which) >=...zard::NButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1414 return false;
never executed: return false;
0
1415-
1416 if (!btns[which]) {
!btns[which]Description
TRUEnever evaluated
FALSEnever evaluated
0
1417 QPushButton *pushButton = new QPushButton(antiFlickerWidget);-
1418 QStyle *style = q->style();-
1419 if (style != QApplication::style()) // Propagate style
style != QApplication::style()Description
TRUEnever evaluated
FALSEnever evaluated
0
1420 pushButton->setStyle(style);
never executed: pushButton->setStyle(style);
0
1421 pushButton->setObjectName(object_name_for_button(which));-
1422#ifdef Q_OS_MACX-
1423 pushButton->setAutoDefault(false);-
1424#endif-
1425 pushButton->hide();-
1426#ifdef Q_CC_HPACC-
1427 const_cast<QWizardPrivate *>(this)->btns[which] = pushButton;-
1428#else-
1429 btns[which] = pushButton;-
1430#endif-
1431 if (which < QWizard::NStandardButtons)
which < QWizar...tandardButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1432 pushButton->setText(buttonDefaultText(wizStyle, which, this));
never executed: pushButton->setText(buttonDefaultText(wizStyle, which, this));
0
1433-
1434 connectButton(which);-
1435 }
never executed: end of block
0
1436 return true;
never executed: return true;
0
1437}-
1438-
1439void QWizardPrivate::connectButton(QWizard::WizardButton which) const-
1440{-
1441 Q_Q(const QWizard);-
1442 if (which < QWizard::NStandardButtons) {
which < QWizar...tandardButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1443 QObject::connect(btns[which], SIGNAL(clicked()), q, buttonSlots(which));-
1444 } else {
never executed: end of block
0
1445 QObject::connect(btns[which], SIGNAL(clicked()), q, SLOT(_q_emitCustomButtonClicked()));-
1446 }
never executed: end of block
0
1447}-
1448-
1449void QWizardPrivate::updateButtonTexts()-
1450{-
1451 Q_Q(QWizard);-
1452 for (int i = 0; i < QWizard::NButtons; ++i) {
i < QWizard::NButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1453 if (btns[i]) {
btns[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
1454 if (q->currentPage() && (q->currentPage()->d_func()->buttonCustomTexts.contains(i)))
q->currentPage()Description
TRUEnever evaluated
FALSEnever evaluated
(q->currentPag...s.contains(i))Description
TRUEnever evaluated
FALSEnever evaluated
0
1455 btns[i]->setText(q->currentPage()->d_func()->buttonCustomTexts.value(i));
never executed: btns[i]->setText(q->currentPage()->d_func()->buttonCustomTexts.value(i));
0
1456 else if (buttonCustomTexts.contains(i))
buttonCustomTexts.contains(i)Description
TRUEnever evaluated
FALSEnever evaluated
0
1457 btns[i]->setText(buttonCustomTexts.value(i));
never executed: btns[i]->setText(buttonCustomTexts.value(i));
0
1458 else if (i < QWizard::NStandardButtons)
i < QWizard::NStandardButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1459 btns[i]->setText(buttonDefaultText(wizStyle, i, this));
never executed: btns[i]->setText(buttonDefaultText(wizStyle, i, this));
0
1460 }
never executed: end of block
0
1461 }
never executed: end of block
0
1462 // Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right-
1463 // even in RTL mode, so do the same, even if it might be counter-intuitive.-
1464 // The shortcut for 'back' is set in class QVistaBackButton.-
1465 if (btns[QWizard::NextButton])
btns[QWizard::NextButton]Description
TRUEnever evaluated
FALSEnever evaluated
0
1466 btns[QWizard::NextButton]->setShortcut(isVistaThemeEnabled() ? QKeySequence(Qt::ALT | Qt::Key_Right) : QKeySequence());
never executed: btns[QWizard::NextButton]->setShortcut(isVistaThemeEnabled() ? QKeySequence(Qt::ALT | Qt::Key_Right) : QKeySequence());
0
1467}
never executed: end of block
0
1468-
1469void QWizardPrivate::updateButtonLayout()-
1470{-
1471 if (buttonsHaveCustomLayout) {
buttonsHaveCustomLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
1472 QVarLengthArray<QWizard::WizardButton, QWizard::NButtons> array(buttonsCustomLayout.count());-
1473 for (int i = 0; i < buttonsCustomLayout.count(); ++i)
i < buttonsCus...Layout.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1474 array[i] = buttonsCustomLayout.at(i);
never executed: array[i] = buttonsCustomLayout.at(i);
0
1475 setButtonLayout(array.constData(), array.count());-
1476 } else {
never executed: end of block
0
1477 // Positions:-
1478 // Help Stretch Custom1 Custom2 Custom3 Cancel Back Next Commit Finish Cancel Help-
1479-
1480 const int ArraySize = 12;-
1481 QWizard::WizardButton array[ArraySize];-
1482 memset(array, -1, sizeof(array));-
1483 Q_ASSERT(array[0] == QWizard::NoButton);-
1484-
1485 if (opts & QWizard::HaveHelpButton) {
opts & QWizard::HaveHelpButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1486 int i = (opts & QWizard::HelpButtonOnRight) ? 11 : 0;
(opts & QWizar...ButtonOnRight)Description
TRUEnever evaluated
FALSEnever evaluated
0
1487 array[i] = QWizard::HelpButton;-
1488 }
never executed: end of block
0
1489 array[1] = QWizard::Stretch;-
1490 if (opts & QWizard::HaveCustomButton1)
opts & QWizard...eCustomButton1Description
TRUEnever evaluated
FALSEnever evaluated
0
1491 array[2] = QWizard::CustomButton1;
never executed: array[2] = QWizard::CustomButton1;
0
1492 if (opts & QWizard::HaveCustomButton2)
opts & QWizard...eCustomButton2Description
TRUEnever evaluated
FALSEnever evaluated
0
1493 array[3] = QWizard::CustomButton2;
never executed: array[3] = QWizard::CustomButton2;
0
1494 if (opts & QWizard::HaveCustomButton3)
opts & QWizard...eCustomButton3Description
TRUEnever evaluated
FALSEnever evaluated
0
1495 array[4] = QWizard::CustomButton3;
never executed: array[4] = QWizard::CustomButton3;
0
1496-
1497 if (!(opts & QWizard::NoCancelButton)) {
!(opts & QWiza...oCancelButton)Description
TRUEnever evaluated
FALSEnever evaluated
0
1498 int i = (opts & QWizard::CancelButtonOnLeft) ? 5 : 10;
(opts & QWizar...lButtonOnLeft)Description
TRUEnever evaluated
FALSEnever evaluated
0
1499 array[i] = QWizard::CancelButton;-
1500 }
never executed: end of block
0
1501 array[6] = QWizard::BackButton;-
1502 array[7] = QWizard::NextButton;-
1503 array[8] = QWizard::CommitButton;-
1504 array[9] = QWizard::FinishButton;-
1505-
1506 setButtonLayout(array, ArraySize);-
1507 }
never executed: end of block
0
1508}-
1509-
1510void QWizardPrivate::setButtonLayout(const QWizard::WizardButton *array, int size)-
1511{-
1512 QWidget *prev = pageFrame;-
1513-
1514 for (int i = buttonLayout->count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1515 QLayoutItem *item = buttonLayout->takeAt(i);-
1516 if (QWidget *widget = item->widget())
QWidget *widge...item->widget()Description
TRUEnever evaluated
FALSEnever evaluated
0
1517 widget->hide();
never executed: widget->hide();
0
1518 delete item;-
1519 }
never executed: end of block
0
1520-
1521 for (int i = 0; i < size; ++i) {
i < sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1522 QWizard::WizardButton which = array[i];-
1523 if (which == QWizard::Stretch) {
which == QWizard::StretchDescription
TRUEnever evaluated
FALSEnever evaluated
0
1524 buttonLayout->addStretch(1);-
1525 } else if (which != QWizard::NoButton) {
never executed: end of block
which != QWizard::NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1526 ensureButton(which);-
1527 buttonLayout->addWidget(btns[which]);-
1528-
1529 // Back, Next, Commit, and Finish are handled in _q_updateButtonStates()-
1530 if (which != QWizard::BackButton && which != QWizard::NextButton
which != QWizard::BackButtonDescription
TRUEnever evaluated
FALSEnever evaluated
which != QWizard::NextButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1531 && which != QWizard::CommitButton && which != QWizard::FinishButton)
which != QWizard::CommitButtonDescription
TRUEnever evaluated
FALSEnever evaluated
which != QWizard::FinishButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1532 btns[which]->show();
never executed: btns[which]->show();
0
1533-
1534 if (prev)
prevDescription
TRUEnever evaluated
FALSEnever evaluated
0
1535 QWidget::setTabOrder(prev, btns[which]);
never executed: QWidget::setTabOrder(prev, btns[which]);
0
1536 prev = btns[which];-
1537 }
never executed: end of block
0
1538 }
never executed: end of block
0
1539-
1540 _q_updateButtonStates();-
1541}
never executed: end of block
0
1542-
1543bool QWizardPrivate::buttonLayoutContains(QWizard::WizardButton which)-
1544{-
1545 return !buttonsHaveCustomLayout || buttonsCustomLayout.contains(which);
never executed: return !buttonsHaveCustomLayout || buttonsCustomLayout.contains(which);
!buttonsHaveCustomLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
buttonsCustomL...ontains(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
1546}-
1547-
1548void QWizardPrivate::updatePixmap(QWizard::WizardPixmap which)-
1549{-
1550 Q_Q(QWizard);-
1551 if (which == QWizard::BackgroundPixmap) {
which == QWiza...ckgroundPixmapDescription
TRUEnever evaluated
FALSEnever evaluated
0
1552 if (wizStyle == QWizard::MacStyle) {
wizStyle == QWizard::MacStyleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1553 q->update();-
1554 q->updateGeometry();-
1555 }
never executed: end of block
0
1556 } else {
never executed: end of block
0
1557 updateLayout();-
1558 }
never executed: end of block
0
1559}-
1560-
1561#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
1562bool QWizardPrivate::vistaDisabled() const-
1563{-
1564 Q_Q(const QWizard);-
1565 const QVariant v = q->property("_q_wizard_vista_off");-
1566 return v.isValid() && v.toBool();-
1567}-
1568-
1569bool QWizardPrivate::isVistaThemeEnabled(QVistaHelper::VistaState state) const-
1570{-
1571 return wizStyle == QWizard::AeroStyle-
1572 && QVistaHelper::vistaState() == state-
1573 && !vistaDisabled();-
1574}-
1575-
1576bool QWizardPrivate::handleAeroStyleChange()-
1577{-
1578 Q_Q(QWizard);-
1579-
1580 if (inHandleAeroStyleChange)-
1581 return false; // prevent recursion-
1582 // For top-level wizards, we need the platform window handle for the-
1583 // DWM changes. Delay aero initialization to the show event handling if-
1584 // it does not exist. If we are a child, skip DWM and just make room by-
1585 // moving the antiFlickerWidget.-
1586 const bool isWindow = q->isWindow();-
1587 if (isWindow && (!q->windowHandle() || !q->windowHandle()->handle()))-
1588 return false;-
1589 inHandleAeroStyleChange = true;-
1590-
1591 vistaHelper->disconnectBackButton();-
1592 q->removeEventFilter(vistaHelper);-
1593-
1594 bool vistaMargins = false;-
1595-
1596 if (isVistaThemeEnabled()) {-
1597 if (isVistaThemeEnabled(QVistaHelper::VistaAero)) {-
1598 if (isWindow) {-
1599 vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);-
1600 q->installEventFilter(vistaHelper);-
1601 }-
1602 q->setMouseTracking(true);-
1603 antiFlickerWidget->move(0, vistaHelper->titleBarSize() + vistaHelper->topOffset());-
1604 vistaHelper->backButton()->move(-
1605 0, vistaHelper->topOffset() // ### should ideally work without the '+ 1'-
1606 - qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1));-
1607 vistaMargins = true;-
1608 vistaHelper->backButton()->show();-
1609 } else {-
1610 if (isWindow)-
1611 vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);-
1612 q->setMouseTracking(true);-
1613 antiFlickerWidget->move(0, vistaHelper->topOffset());-
1614 vistaHelper->backButton()->move(0, -1); // ### should ideally work with (0, 0)-
1615 }-
1616 if (isWindow)-
1617 vistaHelper->setTitleBarIconAndCaptionVisible(false);-
1618 QObject::connect(-
1619 vistaHelper->backButton(), SIGNAL(clicked()), q, buttonSlots(QWizard::BackButton));-
1620 vistaHelper->backButton()->show();-
1621 } else {-
1622 q->setMouseTracking(true); // ### original value possibly different-
1623#ifndef QT_NO_CURSOR-
1624 q->unsetCursor(); // ### ditto-
1625#endif-
1626 antiFlickerWidget->move(0, 0);-
1627 vistaHelper->hideBackButton();-
1628 if (isWindow)-
1629 vistaHelper->setTitleBarIconAndCaptionVisible(true);-
1630 }-
1631-
1632 _q_updateButtonStates();-
1633-
1634 vistaHelper->updateCustomMargins(vistaMargins);-
1635-
1636 inHandleAeroStyleChange = false;-
1637 return true;-
1638}-
1639#endif-
1640-
1641bool QWizardPrivate::isVistaThemeEnabled() const-
1642{-
1643#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
1644 return isVistaThemeEnabled(QVistaHelper::VistaAero)-
1645 || isVistaThemeEnabled(QVistaHelper::VistaBasic);-
1646#else-
1647 return false;
never executed: return false;
0
1648#endif-
1649}-
1650-
1651void QWizardPrivate::disableUpdates()-
1652{-
1653 Q_Q(QWizard);-
1654 if (disableUpdatesCount++ == 0) {
disableUpdatesCount++ == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1655 q->setUpdatesEnabled(false);-
1656 antiFlickerWidget->hide();-
1657 }
never executed: end of block
0
1658}
never executed: end of block
0
1659-
1660void QWizardPrivate::enableUpdates()-
1661{-
1662 Q_Q(QWizard);-
1663 if (--disableUpdatesCount == 0) {
--disableUpdatesCount == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1664 antiFlickerWidget->show();-
1665 q->setUpdatesEnabled(true);-
1666 }
never executed: end of block
0
1667}
never executed: end of block
0
1668-
1669void QWizardPrivate::_q_emitCustomButtonClicked()-
1670{-
1671 Q_Q(QWizard);-
1672 QObject *button = q->sender();-
1673 for (int i = QWizard::NStandardButtons; i < QWizard::NButtons; ++i) {
i < QWizard::NButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1674 if (btns[i] == button) {
btns[i] == buttonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1675 emit q->customButtonClicked(QWizard::WizardButton(i));-
1676 break;
never executed: break;
0
1677 }-
1678 }
never executed: end of block
0
1679}
never executed: end of block
0
1680-
1681void QWizardPrivate::_q_updateButtonStates()-
1682{-
1683 Q_Q(QWizard);-
1684-
1685 disableUpdates();-
1686-
1687 const QWizardPage *page = q->currentPage();-
1688 bool complete = page && page->isComplete();
pageDescription
TRUEnever evaluated
FALSEnever evaluated
page->isComplete()Description
TRUEnever evaluated
FALSEnever evaluated
0
1689-
1690 btn.back->setEnabled(history.count() > 1-
1691 && !q->page(history.at(history.count() - 2))->isCommitPage()-
1692 && (!canFinish || !(opts & QWizard::DisabledBackButtonOnLastPage)));-
1693 btn.next->setEnabled(canContinue && complete);-
1694 btn.commit->setEnabled(canContinue && complete);-
1695 btn.finish->setEnabled(canFinish && complete);-
1696-
1697 const bool backButtonVisible = buttonLayoutContains(QWizard::BackButton)
buttonLayoutCo...d::BackButton)Description
TRUEnever evaluated
FALSEnever evaluated
0
1698 && (history.count() > 1 || !(opts & QWizard::NoBackButtonOnStartPage))
history.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
!(opts & QWiza...onOnStartPage)Description
TRUEnever evaluated
FALSEnever evaluated
0
1699 && (canContinue || !(opts & QWizard::NoBackButtonOnLastPage));
canContinueDescription
TRUEnever evaluated
FALSEnever evaluated
!(opts & QWiza...tonOnLastPage)Description
TRUEnever evaluated
FALSEnever evaluated
0
1700 bool commitPage = page && page->isCommitPage();
pageDescription
TRUEnever evaluated
FALSEnever evaluated
page->isCommitPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
1701 btn.back->setVisible(backButtonVisible);-
1702 btn.next->setVisible(buttonLayoutContains(QWizard::NextButton) && !commitPage-
1703 && (canContinue || (opts & QWizard::HaveNextButtonOnLastPage)));-
1704 btn.commit->setVisible(buttonLayoutContains(QWizard::CommitButton) && commitPage-
1705 && canContinue);-
1706 btn.finish->setVisible(buttonLayoutContains(QWizard::FinishButton)-
1707 && (canFinish || (opts & QWizard::HaveFinishButtonOnEarlyPages)));-
1708-
1709 if (!(opts & QWizard::NoCancelButton))
!(opts & QWiza...oCancelButton)Description
TRUEnever evaluated
FALSEnever evaluated
0
1710 btn.cancel->setVisible(buttonLayoutContains(QWizard::CancelButton)
never executed: btn.cancel->setVisible(buttonLayoutContains(QWizard::CancelButton) && (canContinue || !(opts & QWizard::NoCancelButtonOnLastPage)));
0
1711 && (canContinue || !(opts & QWizard::NoCancelButtonOnLastPage)));
never executed: btn.cancel->setVisible(buttonLayoutContains(QWizard::CancelButton) && (canContinue || !(opts & QWizard::NoCancelButtonOnLastPage)));
0
1712-
1713 bool useDefault = !(opts & QWizard::NoDefaultButton);-
1714 if (QPushButton *nextPush = qobject_cast<QPushButton *>(btn.next))
QPushButton *n...n *>(btn.next)Description
TRUEnever evaluated
FALSEnever evaluated
0
1715 nextPush->setDefault(canContinue && useDefault && !commitPage);
never executed: nextPush->setDefault(canContinue && useDefault && !commitPage);
0
1716 if (QPushButton *commitPush = qobject_cast<QPushButton *>(btn.commit))
QPushButton *c...*>(btn.commit)Description
TRUEnever evaluated
FALSEnever evaluated
0
1717 commitPush->setDefault(canContinue && useDefault && commitPage);
never executed: commitPush->setDefault(canContinue && useDefault && commitPage);
0
1718 if (QPushButton *finishPush = qobject_cast<QPushButton *>(btn.finish))
QPushButton *f...*>(btn.finish)Description
TRUEnever evaluated
FALSEnever evaluated
0
1719 finishPush->setDefault(!canContinue && useDefault);
never executed: finishPush->setDefault(!canContinue && useDefault);
0
1720-
1721#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
1722 if (isVistaThemeEnabled()) {-
1723 vistaHelper->backButton()->setEnabled(btn.back->isEnabled());-
1724 vistaHelper->backButton()->setVisible(backButtonVisible);-
1725 btn.back->setVisible(false);-
1726 }-
1727#endif-
1728-
1729 enableUpdates();-
1730}
never executed: end of block
0
1731-
1732void QWizardPrivate::_q_handleFieldObjectDestroyed(QObject *object)-
1733{-
1734 int destroyed_index = -1;-
1735 QVector<QWizardField>::iterator it = fields.begin();-
1736 while (it != fields.end()) {
it != fields.end()Description
TRUEnever evaluated
FALSEnever evaluated
0
1737 const QWizardField &field = *it;-
1738 if (field.object == object) {
field.object == objectDescription
TRUEnever evaluated
FALSEnever evaluated
0
1739 destroyed_index = fieldIndexMap.value(field.name, -1);-
1740 fieldIndexMap.remove(field.name);-
1741 it = fields.erase(it);-
1742 } else {
never executed: end of block
0
1743 ++it;-
1744 }
never executed: end of block
0
1745 }-
1746 if (destroyed_index != -1) {
destroyed_index != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1747 QMap<QString, int>::iterator it2 = fieldIndexMap.begin();-
1748 while (it2 != fieldIndexMap.end()) {
it2 != fieldIndexMap.end()Description
TRUEnever evaluated
FALSEnever evaluated
0
1749 int index = it2.value();-
1750 if (index > destroyed_index) {
index > destroyed_indexDescription
TRUEnever evaluated
FALSEnever evaluated
0
1751 QString field_name = it2.key();-
1752 fieldIndexMap.insert(field_name, index-1);-
1753 }
never executed: end of block
0
1754 ++it2;-
1755 }
never executed: end of block
0
1756 }
never executed: end of block
0
1757}
never executed: end of block
0
1758-
1759void QWizardPrivate::setStyle(QStyle *style)-
1760{-
1761 for (int i = 0; i < QWizard::NButtons; i++)
i < QWizard::NButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1762 if (btns[i])
btns[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
1763 btns[i]->setStyle(style);
never executed: btns[i]->setStyle(style);
0
1764 const PageMap::const_iterator pcend = pageMap.constEnd();-
1765 for (PageMap::const_iterator it = pageMap.constBegin(); it != pcend; ++it)
it != pcendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1766 it.value()->setStyle(style);
never executed: it.value()->setStyle(style);
0
1767}
never executed: end of block
0
1768-
1769#ifdef Q_OS_MACX-
1770-
1771QPixmap QWizardPrivate::findDefaultBackgroundPixmap()-
1772{-
1773 QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());-
1774 if (!app)-
1775 return QPixmap();-
1776 QPlatformNativeInterface *platformNativeInterface = app->platformNativeInterface();-
1777 int at = platformNativeInterface->metaObject()->indexOfMethod("defaultBackgroundPixmapForQWizard()");-
1778 if (at == -1)-
1779 return QPixmap();-
1780 QMetaMethod defaultBackgroundPixmapForQWizard = platformNativeInterface->metaObject()->method(at);-
1781 QPixmap result;-
1782 if (!defaultBackgroundPixmapForQWizard.invoke(platformNativeInterface, Q_RETURN_ARG(QPixmap, result)))-
1783 return QPixmap();-
1784 return result;-
1785}-
1786-
1787#endif-
1788-
1789#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
1790void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)-
1791{-
1792 if (wizardPrivate->isVistaThemeEnabled()) {-
1793 int leftMargin, topMargin, rightMargin, bottomMargin;-
1794 wizardPrivate->buttonLayout->getContentsMargins(-
1795 &leftMargin, &topMargin, &rightMargin, &bottomMargin);-
1796 const int buttonLayoutTop = wizardPrivate->buttonLayout->contentsRect().top() - topMargin;-
1797 QPainter painter(this);-
1798 const QBrush brush(QColor(240, 240, 240)); // ### hardcoded for now-
1799 painter.fillRect(0, buttonLayoutTop, width(), height() - buttonLayoutTop, brush);-
1800 painter.setPen(QPen(QBrush(QColor(223, 223, 223)), 0)); // ### hardcoded for now-
1801 painter.drawLine(0, buttonLayoutTop, width(), buttonLayoutTop);-
1802 if (wizardPrivate->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {-
1803 if (window()->isActiveWindow())-
1804 painter.setPen(QPen(QBrush(QColor(169, 191, 214)), 0)); // ### hardcoded for now-
1805 else-
1806 painter.setPen(QPen(QBrush(QColor(182, 193, 204)), 0)); // ### hardcoded for now-
1807 painter.drawLine(0, 0, width(), 0);-
1808 }-
1809 }-
1810}-
1811#endif-
1812-
1813/*!-
1814 \class QWizard-
1815 \since 4.3-
1816 \brief The QWizard class provides a framework for wizards.-
1817-
1818 \inmodule QtWidgets-
1819-
1820 A wizard (also called an assistant on \macos) is a special type-
1821 of input dialog that consists of a sequence of pages. A wizard's-
1822 purpose is to guide the user through a process step by step.-
1823 Wizards are useful for complex or infrequent tasks that users may-
1824 find difficult to learn.-
1825-
1826 QWizard inherits QDialog and represents a wizard. Each page is a-
1827 QWizardPage (a QWidget subclass). To create your own wizards, you-
1828 can use these classes directly, or you can subclass them for more-
1829 control.-
1830-
1831 Topics:-
1832-
1833 \tableofcontents-
1834-
1835 \section1 A Trivial Example-
1836-
1837 The following example illustrates how to create wizard pages and-
1838 add them to a wizard. For more advanced examples, see-
1839 \l{dialogs/classwizard}{Class Wizard} and \l{dialogs/licensewizard}{License-
1840 Wizard}.-
1841-
1842 \snippet dialogs/trivialwizard/trivialwizard.cpp 1-
1843 \snippet dialogs/trivialwizard/trivialwizard.cpp 3-
1844 \dots-
1845 \snippet dialogs/trivialwizard/trivialwizard.cpp 4-
1846 \codeline-
1847 \snippet dialogs/trivialwizard/trivialwizard.cpp 5-
1848 \snippet dialogs/trivialwizard/trivialwizard.cpp 7-
1849 \dots-
1850 \snippet dialogs/trivialwizard/trivialwizard.cpp 8-
1851 \codeline-
1852 \snippet dialogs/trivialwizard/trivialwizard.cpp 10-
1853-
1854 \section1 Wizard Look and Feel-
1855-
1856 QWizard supports four wizard looks:-
1857-
1858 \list-
1859 \li ClassicStyle-
1860 \li ModernStyle-
1861 \li MacStyle-
1862 \li AeroStyle-
1863 \endlist-
1864-
1865 You can explicitly set the look to use using setWizardStyle()-
1866 (e.g., if you want the same look on all platforms).-
1867-
1868 \table-
1869 \header \li ClassicStyle-
1870 \li ModernStyle-
1871 \li MacStyle-
1872 \li AeroStyle-
1873 \row \li \inlineimage qtwizard-classic1.png-
1874 \li \inlineimage qtwizard-modern1.png-
1875 \li \inlineimage qtwizard-mac1.png-
1876 \li \inlineimage qtwizard-aero1.png-
1877 \row \li \inlineimage qtwizard-classic2.png-
1878 \li \inlineimage qtwizard-modern2.png-
1879 \li \inlineimage qtwizard-mac2.png-
1880 \li \inlineimage qtwizard-aero2.png-
1881 \endtable-
1882-
1883 Note: AeroStyle has effect only on a Windows Vista system with alpha compositing enabled.-
1884 ModernStyle is used as a fallback when this condition is not met.-
1885-
1886 In addition to the wizard style, there are several options that-
1887 control the look and feel of the wizard. These can be set using-
1888 setOption() or setOptions(). For example, HaveHelpButton makes-
1889 QWizard show a \uicontrol Help button along with the other wizard-
1890 buttons.-
1891-
1892 You can even change the order of the wizard buttons to any-
1893 arbitrary order using setButtonLayout(), and you can add up to-
1894 three custom buttons (e.g., a \uicontrol Print button) to the button-
1895 row. This is achieved by calling setButton() or setButtonText()-
1896 with CustomButton1, CustomButton2, or CustomButton3 to set up the-
1897 button, and by enabling the HaveCustomButton1, HaveCustomButton2,-
1898 or HaveCustomButton3 options. Whenever the user clicks a custom-
1899 button, customButtonClicked() is emitted. For example:-
1900-
1901 \snippet dialogs/licensewizard/licensewizard.cpp 29-
1902-
1903 \section1 Elements of a Wizard Page-
1904-
1905 Wizards consist of a sequence of \l{QWizardPage}s. At any time,-
1906 only one page is shown. A page has the following attributes:-
1907-
1908 \list-
1909 \li A \l{QWizardPage::}{title}.-
1910 \li A \l{QWizardPage::}{subTitle}.-
1911 \li A set of pixmaps, which may or may not be honored, depending-
1912 on the wizard's style:-
1913 \list-
1914 \li WatermarkPixmap (used by ClassicStyle and ModernStyle)-
1915 \li BannerPixmap (used by ModernStyle)-
1916 \li LogoPixmap (used by ClassicStyle and ModernStyle)-
1917 \li BackgroundPixmap (used by MacStyle)-
1918 \endlist-
1919 \endlist-
1920-
1921 The diagram belows shows how QWizard renders these attributes,-
1922 assuming they are all present and ModernStyle is used:-
1923-
1924 \image qtwizard-nonmacpage.png-
1925-
1926 When a \l{QWizardPage::}{subTitle} is set, QWizard displays it-
1927 in a header, in which case it also uses the BannerPixmap and the-
1928 LogoPixmap to decorate the header. The WatermarkPixmap is-
1929 displayed on the left side, below the header. At the bottom,-
1930 there is a row of buttons allowing the user to navigate through-
1931 the pages.-
1932-
1933 The page itself (the \l{QWizardPage} widget) occupies the area-
1934 between the header, the watermark, and the button row. Typically,-
1935 the page is a QWizardPage on which a QGridLayout is installed,-
1936 with standard child widgets (\l{QLabel}s, \l{QLineEdit}s, etc.).-
1937-
1938 If the wizard's style is MacStyle, the page looks radically-
1939 different:-
1940-
1941 \image qtwizard-macpage.png-
1942-
1943 The watermark, banner, and logo pixmaps are ignored by the-
1944 MacStyle. If the BackgroundPixmap is set, it is used as the-
1945 background for the wizard; otherwise, a default "assistant" image-
1946 is used.-
1947-
1948 The title and subtitle are set by calling-
1949 QWizardPage::setTitle() and QWizardPage::setSubTitle() on the-
1950 individual pages. They may be plain text or HTML (see titleFormat-
1951 and subTitleFormat). The pixmaps can be set globally for the-
1952 entire wizard using setPixmap(), or on a per-page basis using-
1953 QWizardPage::setPixmap().-
1954-
1955 \target field mechanism-
1956 \section1 Registering and Using Fields-
1957-
1958 In many wizards, the contents of a page may affect the default-
1959 values of the fields of a later page. To make it easy to-
1960 communicate between pages, QWizard supports a "field" mechanism-
1961 that allows you to register a field (e.g., a QLineEdit) on a page-
1962 and to access its value from any page. It is also possible to-
1963 specify mandatory fields (i.e., fields that must be filled before-
1964 the user can advance to the next page).-
1965-
1966 To register a field, call QWizardPage::registerField() field.-
1967 For example:-
1968-
1969 \snippet dialogs/classwizard/classwizard.cpp 8-
1970 \dots-
1971 \snippet dialogs/classwizard/classwizard.cpp 10-
1972 \snippet dialogs/classwizard/classwizard.cpp 11-
1973 \dots-
1974 \snippet dialogs/classwizard/classwizard.cpp 13-
1975-
1976 The above code registers three fields, \c className, \c-
1977 baseClass, and \c qobjectMacro, which are associated with three-
1978 child widgets. The asterisk (\c *) next to \c className denotes a-
1979 mandatory field.-
1980-
1981 \target initialize page-
1982 The fields of any page are accessible from any other page. For-
1983 example:-
1984-
1985 \snippet dialogs/classwizard/classwizard.cpp 17-
1986-
1987 Here, we call QWizardPage::field() to access the contents of the-
1988 \c className field (which was defined in the \c ClassInfoPage)-
1989 and use it to initialize the \c OutputFilePage. The field's-
1990 contents is returned as a QVariant.-
1991-
1992 When we create a field using QWizardPage::registerField(), we-
1993 pass a unique field name and a widget. We can also provide a Qt-
1994 property name and a "changed" signal (a signal that is emitted-
1995 when the property changes) as third and fourth arguments;-
1996 however, this is not necessary for the most common Qt widgets,-
1997 such as QLineEdit, QCheckBox, and QComboBox, because QWizard-
1998 knows which properties to look for.-
1999-
2000 \target mandatory fields-
2001-
2002 If an asterisk (\c *) is appended to the name when the property-
2003 is registered, the field is a \e{mandatory field}. When a page has-
2004 mandatory fields, the \uicontrol Next and/or \uicontrol Finish buttons are-
2005 enabled only when all mandatory fields are filled.-
2006-
2007 To consider a field "filled", QWizard simply checks that the-
2008 field's current value doesn't equal the original value (the value-
2009 it had when initializePage() was called). For QLineEdit and-
2010 QAbstractSpinBox subclasses, QWizard also checks that-
2011 \l{QLineEdit::hasAcceptableInput()}{hasAcceptableInput()} returns-
2012 true, to honor any validator or mask.-
2013-
2014 QWizard's mandatory field mechanism is provided for convenience.-
2015 A more powerful (but also more cumbersome) alternative is to-
2016 reimplement QWizardPage::isComplete() and to emit the-
2017 QWizardPage::completeChanged() signal whenever the page becomes-
2018 complete or incomplete.-
2019-
2020 The enabled/disabled state of the \uicontrol Next and/or \uicontrol Finish-
2021 buttons is one way to perform validation on the user input.-
2022 Another way is to reimplement validateCurrentPage() (or-
2023 QWizardPage::validatePage()) to perform some last-minute-
2024 validation (and show an error message if the user has entered-
2025 incomplete or invalid information). If the function returns \c true,-
2026 the next page is shown (or the wizard finishes); otherwise, the-
2027 current page stays up.-
2028-
2029 \section1 Creating Linear Wizards-
2030-
2031 Most wizards have a linear structure, with page 1 followed by-
2032 page 2 and so on until the last page. The \l{dialogs/classwizard}{Class-
2033 Wizard} example is such a wizard. With QWizard, linear wizards-
2034 are created by instantiating the \l{QWizardPage}s and inserting-
2035 them using addPage(). By default, the pages are shown in the-
2036 order in which they were added. For example:-
2037-
2038 \snippet dialogs/classwizard/classwizard.cpp 0-
2039 \dots-
2040 \snippet dialogs/classwizard/classwizard.cpp 2-
2041-
2042 When a page is about to be shown, QWizard calls initializePage()-
2043 (which in turn calls QWizardPage::initializePage()) to fill the-
2044 page with default values. By default, this function does nothing,-
2045 but it can be reimplemented to initialize the page's contents-
2046 based on other pages' fields (see the \l{initialize page}{example-
2047 above}).-
2048-
2049 If the user presses \uicontrol Back, cleanupPage() is called (which in-
2050 turn calls QWizardPage::cleanupPage()). The default-
2051 implementation resets the page's fields to their original values-
2052 (the values they had before initializePage() was called). If you-
2053 want the \uicontrol Back button to be non-destructive and keep the-
2054 values entered by the user, simply enable the IndependentPages-
2055 option.-
2056-
2057 \section1 Creating Non-Linear Wizards-
2058-
2059 Some wizards are more complex in that they allow different-
2060 traversal paths based on the information provided by the user.-
2061 The \l{dialogs/licensewizard}{License Wizard} example illustrates this.-
2062 It provides five wizard pages; depending on which options are-
2063 selected, the user can reach different pages.-
2064-
2065 \image licensewizard-flow.png-
2066-
2067 In complex wizards, pages are identified by IDs. These IDs are-
2068 typically defined using an enum. For example:-
2069-
2070 \snippet dialogs/licensewizard/licensewizard.h 0-
2071 \dots-
2072 \snippet dialogs/licensewizard/licensewizard.h 2-
2073 \dots-
2074 \snippet dialogs/licensewizard/licensewizard.h 3-
2075-
2076 The pages are inserted using setPage(), which takes an ID and an-
2077 instance of QWizardPage (or of a subclass):-
2078-
2079 \snippet dialogs/licensewizard/licensewizard.cpp 1-
2080 \dots-
2081 \snippet dialogs/licensewizard/licensewizard.cpp 8-
2082-
2083 By default, the pages are shown in increasing ID order. To-
2084 provide a dynamic order that depends on the options chosen by the-
2085 user, we must reimplement QWizardPage::nextId(). For example:-
2086-
2087 \snippet dialogs/licensewizard/licensewizard.cpp 18-
2088 \codeline-
2089 \snippet dialogs/licensewizard/licensewizard.cpp 23-
2090 \codeline-
2091 \snippet dialogs/licensewizard/licensewizard.cpp 24-
2092 \codeline-
2093 \snippet dialogs/licensewizard/licensewizard.cpp 25-
2094 \codeline-
2095 \snippet dialogs/licensewizard/licensewizard.cpp 26-
2096-
2097 It would also be possible to put all the logic in one place, in a-
2098 QWizard::nextId() reimplementation. For example:-
2099-
2100 \snippet code/src_gui_dialogs_qwizard.cpp 0-
2101-
2102 To start at another page than the page with the lowest ID, call-
2103 setStartId().-
2104-
2105 To test whether a page has been visited or not, call-
2106 hasVisitedPage(). For example:-
2107-
2108 \snippet dialogs/licensewizard/licensewizard.cpp 27-
2109-
2110 \sa QWizardPage, {Class Wizard Example}, {License Wizard Example}-
2111*/-
2112-
2113/*!-
2114 \enum QWizard::WizardButton-
2115-
2116 This enum specifies the buttons in a wizard.-
2117-
2118 \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on \macos)-
2119 \value NextButton The \uicontrol Next button (\uicontrol Continue on \macos)-
2120 \value CommitButton The \uicontrol Commit button-
2121 \value FinishButton The \uicontrol Finish button (\uicontrol Done on \macos)-
2122 \value CancelButton The \uicontrol Cancel button (see also NoCancelButton)-
2123 \value HelpButton The \uicontrol Help button (see also HaveHelpButton)-
2124 \value CustomButton1 The first user-defined button (see also HaveCustomButton1)-
2125 \value CustomButton2 The second user-defined button (see also HaveCustomButton2)-
2126 \value CustomButton3 The third user-defined button (see also HaveCustomButton3)-
2127-
2128 The following value is only useful when calling setButtonLayout():-
2129-
2130 \value Stretch A horizontal stretch in the button layout-
2131-
2132 \omitvalue NoButton-
2133 \omitvalue NStandardButtons-
2134 \omitvalue NButtons-
2135-
2136 \sa setButton(), setButtonText(), setButtonLayout(), customButtonClicked()-
2137*/-
2138-
2139/*!-
2140 \enum QWizard::WizardPixmap-
2141-
2142 This enum specifies the pixmaps that can be associated with a page.-
2143-
2144 \value WatermarkPixmap The tall pixmap on the left side of a ClassicStyle or ModernStyle page-
2145 \value LogoPixmap The small pixmap on the right side of a ClassicStyle or ModernStyle page header-
2146 \value BannerPixmap The pixmap that occupies the background of a ModernStyle page header-
2147 \value BackgroundPixmap The pixmap that occupies the background of a MacStyle wizard-
2148-
2149 \omitvalue NPixmaps-
2150-
2151 \sa setPixmap(), QWizardPage::setPixmap(), {Elements of a Wizard Page}-
2152*/-
2153-
2154/*!-
2155 \enum QWizard::WizardStyle-
2156-
2157 This enum specifies the different looks supported by QWizard.-
2158-
2159 \value ClassicStyle Classic Windows look-
2160 \value ModernStyle Modern Windows look-
2161 \value MacStyle \macos look-
2162 \value AeroStyle Windows Aero look-
2163-
2164 \omitvalue NStyles-
2165-
2166 \sa setWizardStyle(), WizardOption, {Wizard Look and Feel}-
2167*/-
2168-
2169/*!-
2170 \enum QWizard::WizardOption-
2171-
2172 This enum specifies various options that affect the look and feel-
2173 of a wizard.-
2174-
2175 \value IndependentPages The pages are independent of each other-
2176 (i.e., they don't derive values from each-
2177 other).-
2178 \value IgnoreSubTitles Don't show any subtitles, even if they are set.-
2179 \value ExtendedWatermarkPixmap Extend any WatermarkPixmap all the-
2180 way down to the window's edge.-
2181 \value NoDefaultButton Don't make the \uicontrol Next or \uicontrol Finish button the-
2182 dialog's \l{QPushButton::setDefault()}{default button}.-
2183 \value NoBackButtonOnStartPage Don't show the \uicontrol Back button on the start page.-
2184 \value NoBackButtonOnLastPage Don't show the \uicontrol Back button on the last page.-
2185 \value DisabledBackButtonOnLastPage Disable the \uicontrol Back button on the last page.-
2186 \value HaveNextButtonOnLastPage Show the (disabled) \uicontrol Next button on the last page.-
2187 \value HaveFinishButtonOnEarlyPages Show the (disabled) \uicontrol Finish button on non-final pages.-
2188 \value NoCancelButton Don't show the \uicontrol Cancel button.-
2189 \value CancelButtonOnLeft Put the \uicontrol Cancel button on the left of \uicontrol Back (rather than on-
2190 the right of \uicontrol Finish or \uicontrol Next).-
2191 \value HaveHelpButton Show the \uicontrol Help button.-
2192 \value HelpButtonOnRight Put the \uicontrol Help button on the far right of the button layout-
2193 (rather than on the far left).-
2194 \value HaveCustomButton1 Show the first user-defined button (CustomButton1).-
2195 \value HaveCustomButton2 Show the second user-defined button (CustomButton2).-
2196 \value HaveCustomButton3 Show the third user-defined button (CustomButton3).-
2197 \value NoCancelButtonOnLastPage Don't show the \uicontrol Cancel button on the last page.-
2198-
2199 \sa setOptions(), setOption(), testOption()-
2200*/-
2201-
2202/*!-
2203 Constructs a wizard with the given \a parent and window \a flags.-
2204-
2205 \sa parent(), windowFlags()-
2206*/-
2207QWizard::QWizard(QWidget *parent, Qt::WindowFlags flags)-
2208 : QDialog(*new QWizardPrivate, parent, flags)-
2209{-
2210 Q_D(QWizard);-
2211 d->init();-
2212#ifdef Q_OS_WINCE-
2213 if (!qt_wince_is_mobile())-
2214 setWindowFlags(windowFlags() & ~Qt::WindowOkButtonHint);-
2215#endif-
2216}
never executed: end of block
0
2217-
2218/*!-
2219 Destroys the wizard and its pages, releasing any allocated resources.-
2220*/-
2221QWizard::~QWizard()-
2222{-
2223 Q_D(QWizard);-
2224 delete d->buttonLayout;-
2225}
never executed: end of block
0
2226-
2227/*!-
2228 Adds the given \a page to the wizard, and returns the page's ID.-
2229-
2230 The ID is guaranteed to be larger than any other ID in the-
2231 QWizard so far.-
2232-
2233 \sa setPage(), page(), pageAdded()-
2234*/-
2235int QWizard::addPage(QWizardPage *page)-
2236{-
2237 Q_D(QWizard);-
2238 int theid = 0;-
2239 if (!d->pageMap.isEmpty())
!d->pageMap.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2240 theid = (d->pageMap.constEnd() - 1).key() + 1;
never executed: theid = (d->pageMap.constEnd() - 1).key() + 1;
0
2241 setPage(theid, page);-
2242 return theid;
never executed: return theid;
0
2243}-
2244-
2245/*!-
2246 \fn void QWizard::setPage(int id, QWizardPage *page)-
2247-
2248 Adds the given \a page to the wizard with the given \a id.-
2249-
2250 \note Adding a page may influence the value of the startId property-
2251 in case it was not set explicitly.-
2252-
2253 \sa addPage(), page(), pageAdded()-
2254*/-
2255void QWizard::setPage(int theid, QWizardPage *page)-
2256{-
2257 Q_D(QWizard);-
2258-
2259 if (!page) {
!pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
2260 qWarning("QWizard::setPage: Cannot insert null page");-
2261 return;
never executed: return;
0
2262 }-
2263-
2264 if (theid == -1) {
theid == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2265 qWarning("QWizard::setPage: Cannot insert page with ID -1");-
2266 return;
never executed: return;
0
2267 }-
2268-
2269 if (d->pageMap.contains(theid)) {
d->pageMap.contains(theid)Description
TRUEnever evaluated
FALSEnever evaluated
0
2270 qWarning("QWizard::setPage: Page with duplicate ID %d ignored", theid);-
2271 return;
never executed: return;
0
2272 }-
2273-
2274 page->setParent(d->pageFrame);-
2275-
2276 QVector<QWizardField> &pendingFields = page->d_func()->pendingFields;-
2277 for (int i = 0; i < pendingFields.count(); ++i)
i < pendingFields.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2278 d->addField(pendingFields.at(i));
never executed: d->addField(pendingFields.at(i));
0
2279 pendingFields.clear();-
2280-
2281 connect(page, SIGNAL(completeChanged()), this, SLOT(_q_updateButtonStates()));-
2282-
2283 d->pageMap.insert(theid, page);-
2284 page->d_func()->wizard = this;-
2285-
2286 int n = d->pageVBoxLayout->count();-
2287-
2288 // disable layout to prevent layout updates while adding-
2289 bool pageVBoxLayoutEnabled = d->pageVBoxLayout->isEnabled();-
2290 d->pageVBoxLayout->setEnabled(false);-
2291-
2292 d->pageVBoxLayout->insertWidget(n - 1, page);-
2293-
2294 // hide new page and reset layout to old status-
2295 page->hide();-
2296 d->pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled);-
2297-
2298 if (!d->startSetByUser && d->pageMap.constBegin().key() == theid)
!d->startSetByUserDescription
TRUEnever evaluated
FALSEnever evaluated
d->pageMap.con...key() == theidDescription
TRUEnever evaluated
FALSEnever evaluated
0
2299 d->start = theid;
never executed: d->start = theid;
0
2300 emit pageAdded(theid);-
2301}
never executed: end of block
0
2302-
2303/*!-
2304 Removes the page with the given \a id. cleanupPage() will be called if necessary.-
2305-
2306 \note Removing a page may influence the value of the startId property.-
2307-
2308 \since 4.5-
2309 \sa addPage(), setPage(), pageRemoved(), startId()-
2310*/-
2311void QWizard::removePage(int id)-
2312{-
2313 Q_D(QWizard);-
2314-
2315 QWizardPage *removedPage = 0;-
2316-
2317 // update startItem accordingly-
2318 if (d->pageMap.count() > 0) { // only if we have any pages
d->pageMap.count() > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2319 if (d->start == id) {
d->start == idDescription
TRUEnever evaluated
FALSEnever evaluated
0
2320 const int firstId = d->pageMap.constBegin().key();-
2321 if (firstId == id) {
firstId == idDescription
TRUEnever evaluated
FALSEnever evaluated
0
2322 if (d->pageMap.count() > 1)
d->pageMap.count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
2323 d->start = (++d->pageMap.constBegin()).key(); // secondId
never executed: d->start = (++d->pageMap.constBegin()).key();
0
2324 else-
2325 d->start = -1; // removing the last page
never executed: d->start = -1;
0
2326 } else { // startSetByUser has to be "true" here-
2327 d->start = firstId;-
2328 }
never executed: end of block
0
2329 d->startSetByUser = false;-
2330 }
never executed: end of block
0
2331 }
never executed: end of block
0
2332-
2333 if (d->pageMap.contains(id))
d->pageMap.contains(id)Description
TRUEnever evaluated
FALSEnever evaluated
0
2334 emit pageRemoved(id);
never executed: pageRemoved(id);
0
2335-
2336 if (!d->history.contains(id)) {
!d->history.contains(id)Description
TRUEnever evaluated
FALSEnever evaluated
0
2337 // Case 1: removing a page not in the history-
2338 removedPage = d->pageMap.take(id);-
2339 d->updateCurrentPage();-
2340 } else if (id != d->current) {
never executed: end of block
id != d->currentDescription
TRUEnever evaluated
FALSEnever evaluated
0
2341 // Case 2: removing a page in the history before the current page-
2342 removedPage = d->pageMap.take(id);-
2343 d->history.removeOne(id);-
2344 d->_q_updateButtonStates();-
2345 } else if (d->history.count() == 1) {
never executed: end of block
d->history.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
2346 // Case 3: removing the current page which is the first (and only) one in the history-
2347 d->reset();-
2348 removedPage = d->pageMap.take(id);-
2349 if (d->pageMap.isEmpty())
d->pageMap.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2350 d->updateCurrentPage();
never executed: d->updateCurrentPage();
0
2351 else-
2352 restart();
never executed: restart();
0
2353 } else {-
2354 // Case 4: removing the current page which is not the first one in the history-
2355 back();-
2356 removedPage = d->pageMap.take(id);-
2357 d->updateCurrentPage();-
2358 }
never executed: end of block
0
2359-
2360 if (removedPage) {
removedPageDescription
TRUEnever evaluated
FALSEnever evaluated
0
2361 if (d->initialized.contains(id)) {
d->initialized.contains(id)Description
TRUEnever evaluated
FALSEnever evaluated
0
2362 cleanupPage(id);-
2363 d->initialized.remove(id);-
2364 }
never executed: end of block
0
2365-
2366 d->pageVBoxLayout->removeWidget(removedPage);-
2367-
2368 for (int i = d->fields.count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2369 if (d->fields.at(i).page == removedPage) {
d->fields.at(i...== removedPageDescription
TRUEnever evaluated
FALSEnever evaluated
0
2370 removedPage->d_func()->pendingFields += d->fields.at(i);-
2371 d->removeFieldAt(i);-
2372 }
never executed: end of block
0
2373 }
never executed: end of block
0
2374 }
never executed: end of block
0
2375}
never executed: end of block
0
2376-
2377/*!-
2378 \fn QWizardPage *QWizard::page(int id) const-
2379-
2380 Returns the page with the given \a id, or 0 if there is no such-
2381 page.-
2382-
2383 \sa addPage(), setPage()-
2384*/-
2385QWizardPage *QWizard::page(int theid) const-
2386{-
2387 Q_D(const QWizard);-
2388 return d->pageMap.value(theid);
never executed: return d->pageMap.value(theid);
0
2389}-
2390-
2391/*!-
2392 \fn bool QWizard::hasVisitedPage(int id) const-
2393-
2394 Returns \c true if the page history contains page \a id; otherwise,-
2395 returns \c false.-
2396-
2397 Pressing \uicontrol Back marks the current page as "unvisited" again.-
2398-
2399 \sa visitedPages()-
2400*/-
2401bool QWizard::hasVisitedPage(int theid) const-
2402{-
2403 Q_D(const QWizard);-
2404 return d->history.contains(theid);
never executed: return d->history.contains(theid);
0
2405}-
2406-
2407/*!-
2408 Returns the list of IDs of visited pages, in the order in which the pages-
2409 were visited.-
2410-
2411 Pressing \uicontrol Back marks the current page as "unvisited" again.-
2412-
2413 \sa hasVisitedPage()-
2414*/-
2415QList<int> QWizard::visitedPages() const-
2416{-
2417 Q_D(const QWizard);-
2418 return d->history;
never executed: return d->history;
0
2419}-
2420-
2421/*!-
2422 Returns the list of page IDs.-
2423 \since 4.5-
2424*/-
2425QList<int> QWizard::pageIds() const-
2426{-
2427 Q_D(const QWizard);-
2428 return d->pageMap.keys();
never executed: return d->pageMap.keys();
0
2429}-
2430-
2431/*!-
2432 \property QWizard::startId-
2433 \brief the ID of the first page-
2434-
2435 If this property isn't explicitly set, this property defaults to-
2436 the lowest page ID in this wizard, or -1 if no page has been-
2437 inserted yet.-
2438-
2439 \sa restart(), nextId()-
2440*/-
2441void QWizard::setStartId(int theid)-
2442{-
2443 Q_D(QWizard);-
2444 int newStart = theid;-
2445 if (theid == -1)
theid == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2446 newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1;
never executed: newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1;
d->pageMap.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2447-
2448 if (d->start == newStart) {
d->start == newStartDescription
TRUEnever evaluated
FALSEnever evaluated
0
2449 d->startSetByUser = theid != -1;-
2450 return;
never executed: return;
0
2451 }-
2452-
2453 if (!d->pageMap.contains(newStart)) {
!d->pageMap.contains(newStart)Description
TRUEnever evaluated
FALSEnever evaluated
0
2454 qWarning("QWizard::setStartId: Invalid page ID %d", newStart);-
2455 return;
never executed: return;
0
2456 }-
2457 d->start = newStart;-
2458 d->startSetByUser = theid != -1;-
2459}
never executed: end of block
0
2460-
2461int QWizard::startId() const-
2462{-
2463 Q_D(const QWizard);-
2464 return d->start;
never executed: return d->start;
0
2465}-
2466-
2467/*!-
2468 Returns a pointer to the current page, or 0 if there is no current-
2469 page (e.g., before the wizard is shown).-
2470-
2471 This is equivalent to calling page(currentId()).-
2472-
2473 \sa page(), currentId(), restart()-
2474*/-
2475QWizardPage *QWizard::currentPage() const-
2476{-
2477 Q_D(const QWizard);-
2478 return page(d->current);
never executed: return page(d->current);
0
2479}-
2480-
2481/*!-
2482 \property QWizard::currentId-
2483 \brief the ID of the current page-
2484-
2485 This property cannot be set directly. To change the current page,-
2486 call next(), back(), or restart().-
2487-
2488 By default, this property has a value of -1, indicating that no page is-
2489 currently shown.-
2490-
2491 \sa currentPage()-
2492*/-
2493int QWizard::currentId() const-
2494{-
2495 Q_D(const QWizard);-
2496 return d->current;
never executed: return d->current;
0
2497}-
2498-
2499/*!-
2500 Sets the value of the field called \a name to \a value.-
2501-
2502 This function can be used to set fields on any page of the wizard.-
2503-
2504 \sa QWizardPage::registerField(), QWizardPage::setField(), field()-
2505*/-
2506void QWizard::setField(const QString &name, const QVariant &value)-
2507{-
2508 Q_D(QWizard);-
2509-
2510 int index = d->fieldIndexMap.value(name, -1);-
2511 if (index != -1) {
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2512 const QWizardField &field = d->fields.at(index);-
2513 if (!field.object->setProperty(field.property, value))
!field.object-...operty, value)Description
TRUEnever evaluated
FALSEnever evaluated
0
2514 qWarning("QWizard::setField: Couldn't write to property '%s'",
never executed: QMessageLogger(__FILE__, 2514, __PRETTY_FUNCTION__).warning("QWizard::setField: Couldn't write to property '%s'", field.property.constData());
0
2515 field.property.constData());
never executed: QMessageLogger(__FILE__, 2514, __PRETTY_FUNCTION__).warning("QWizard::setField: Couldn't write to property '%s'", field.property.constData());
0
2516 return;
never executed: return;
0
2517 }-
2518-
2519 qWarning("QWizard::setField: No such field '%s'", qPrintable(name));-
2520}
never executed: end of block
0
2521-
2522/*!-
2523 Returns the value of the field called \a name.-
2524-
2525 This function can be used to access fields on any page of the wizard.-
2526-
2527 \sa QWizardPage::registerField(), QWizardPage::field(), setField()-
2528*/-
2529QVariant QWizard::field(const QString &name) const-
2530{-
2531 Q_D(const QWizard);-
2532-
2533 int index = d->fieldIndexMap.value(name, -1);-
2534 if (index != -1) {
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2535 const QWizardField &field = d->fields.at(index);-
2536 return field.object->property(field.property);
never executed: return field.object->property(field.property);
0
2537 }-
2538-
2539 qWarning("QWizard::field: No such field '%s'", qPrintable(name));-
2540 return QVariant();
never executed: return QVariant();
0
2541}-
2542-
2543/*!-
2544 \property QWizard::wizardStyle-
2545 \brief the look and feel of the wizard-
2546-
2547 By default, QWizard uses the AeroStyle on a Windows Vista system with alpha compositing-
2548 enabled, regardless of the current widget style. If this is not the case, the default-
2549 wizard style depends on the current widget style as follows: MacStyle is the default if-
2550 the current widget style is QMacStyle, ModernStyle is the default if the current widget-
2551 style is QWindowsStyle, and ClassicStyle is the default in all other cases.-
2552-
2553 \sa {Wizard Look and Feel}, options-
2554*/-
2555void QWizard::setWizardStyle(WizardStyle style)-
2556{-
2557 Q_D(QWizard);-
2558-
2559 const bool styleChange = style != d->wizStyle;-
2560-
2561#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
2562 const bool aeroStyleChange =-
2563 d->vistaInitPending || d->vistaStateChanged || (styleChange && (style == AeroStyle || d->wizStyle == AeroStyle));-
2564 d->vistaStateChanged = false;-
2565 d->vistaInitPending = false;-
2566#endif-
2567-
2568 if (styleChange
styleChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2569#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
2570 || aeroStyleChange-
2571#endif-
2572 ) {-
2573 d->disableUpdates();-
2574 d->wizStyle = style;-
2575 d->updateButtonTexts();-
2576#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
2577 if (aeroStyleChange) {-
2578 //Send a resizeevent since the antiflicker widget probably needs a new size-
2579 //because of the backbutton in the window title-
2580 QResizeEvent ev(geometry().size(), geometry().size());-
2581 QApplication::sendEvent(this, &ev);-
2582 }-
2583#endif-
2584 d->updateLayout();-
2585 updateGeometry();-
2586 d->enableUpdates();-
2587#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
2588 // Delay initialization when activating Aero style fails due to missing native window.-
2589 if (aeroStyleChange && !d->handleAeroStyleChange() && d->wizStyle == AeroStyle)-
2590 d->vistaInitPending = true;-
2591#endif-
2592 }
never executed: end of block
0
2593}
never executed: end of block
0
2594-
2595QWizard::WizardStyle QWizard::wizardStyle() const-
2596{-
2597 Q_D(const QWizard);-
2598 return d->wizStyle;
never executed: return d->wizStyle;
0
2599}-
2600-
2601/*!-
2602 Sets the given \a option to be enabled if \a on is true;-
2603 otherwise, clears the given \a option.-
2604-
2605 \sa options, testOption(), setWizardStyle()-
2606*/-
2607void QWizard::setOption(WizardOption option, bool on)-
2608{-
2609 Q_D(QWizard);-
2610 if (!(d->opts & option) != !on)
!(d->opts & option) != !onDescription
TRUEnever evaluated
FALSEnever evaluated
0
2611 setOptions(d->opts ^ option);
never executed: setOptions(d->opts ^ option);
0
2612}
never executed: end of block
0
2613-
2614/*!-
2615 Returns \c true if the given \a option is enabled; otherwise, returns-
2616 false.-
2617-
2618 \sa options, setOption(), setWizardStyle()-
2619*/-
2620bool QWizard::testOption(WizardOption option) const-
2621{-
2622 Q_D(const QWizard);-
2623 return (d->opts & option) != 0;
never executed: return (d->opts & option) != 0;
0
2624}-
2625-
2626/*!-
2627 \property QWizard::options-
2628 \brief the various options that affect the look and feel of the wizard-
2629-
2630 By default, the following options are set (depending on the platform):-
2631-
2632 \list-
2633 \li Windows: HelpButtonOnRight.-
2634 \li \macos: NoDefaultButton and NoCancelButton.-
2635 \li X11 and QWS (Qt for Embedded Linux): none.-
2636 \endlist-
2637-
2638 \sa wizardStyle-
2639*/-
2640void QWizard::setOptions(WizardOptions options)-
2641{-
2642 Q_D(QWizard);-
2643-
2644 WizardOptions changed = (options ^ d->opts);-
2645 if (!changed)
!changedDescription
TRUEnever evaluated
FALSEnever evaluated
0
2646 return;
never executed: return;
0
2647-
2648 d->disableUpdates();-
2649-
2650 d->opts = options;-
2651 if ((changed & IndependentPages) && !(d->opts & IndependentPages))
(changed & IndependentPages)Description
TRUEnever evaluated
FALSEnever evaluated
!(d->opts & IndependentPages)Description
TRUEnever evaluated
FALSEnever evaluated
0
2652 d->cleanupPagesNotInHistory();
never executed: d->cleanupPagesNotInHistory();
0
2653-
2654 if (changed & (NoDefaultButton | HaveHelpButton | HelpButtonOnRight | NoCancelButton
changed & (NoD...CustomButton3)Description
TRUEnever evaluated
FALSEnever evaluated
0
2655 | CancelButtonOnLeft | HaveCustomButton1 | HaveCustomButton2
changed & (NoD...CustomButton3)Description
TRUEnever evaluated
FALSEnever evaluated
0
2656 | HaveCustomButton3)) {
changed & (NoD...CustomButton3)Description
TRUEnever evaluated
FALSEnever evaluated
0
2657 d->updateButtonLayout();-
2658 } else if (changed & (NoBackButtonOnStartPage | NoBackButtonOnLastPage
never executed: end of block
changed & (NoB...tonOnLastPage)Description
TRUEnever evaluated
FALSEnever evaluated
0
2659 | HaveNextButtonOnLastPage | HaveFinishButtonOnEarlyPages
changed & (NoB...tonOnLastPage)Description
TRUEnever evaluated
FALSEnever evaluated
0
2660 | DisabledBackButtonOnLastPage | NoCancelButtonOnLastPage)) {
changed & (NoB...tonOnLastPage)Description
TRUEnever evaluated
FALSEnever evaluated
0
2661 d->_q_updateButtonStates();-
2662 }
never executed: end of block
0
2663-
2664 d->enableUpdates();-
2665 d->updateLayout();-
2666}
never executed: end of block
0
2667-
2668QWizard::WizardOptions QWizard::options() const-
2669{-
2670 Q_D(const QWizard);-
2671 return d->opts;
never executed: return d->opts;
0
2672}-
2673-
2674/*!-
2675 Sets the text on button \a which to be \a text.-
2676-
2677 By default, the text on buttons depends on the wizardStyle. For-
2678 example, on \macos, the \uicontrol Next button is called \uicontrol-
2679 Continue.-
2680-
2681 To add extra buttons to the wizard (e.g., a \uicontrol Print button),-
2682 one way is to call setButtonText() with CustomButton1,-
2683 CustomButton2, or CustomButton3 to set their text, and make the-
2684 buttons visible using the HaveCustomButton1, HaveCustomButton2,-
2685 and/or HaveCustomButton3 options.-
2686-
2687 Button texts may also be set on a per-page basis using QWizardPage::setButtonText().-
2688-
2689 \sa setButton(), button(), setButtonLayout(), setOptions(), QWizardPage::setButtonText()-
2690*/-
2691void QWizard::setButtonText(WizardButton which, const QString &text)-
2692{-
2693 Q_D(QWizard);-
2694-
2695 if (!d->ensureButton(which))
!d->ensureButton(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
2696 return;
never executed: return;
0
2697-
2698 d->buttonCustomTexts.insert(which, text);-
2699-
2700 if (!currentPage() || !currentPage()->d_func()->buttonCustomTexts.contains(which))
!currentPage()Description
TRUEnever evaluated
FALSEnever evaluated
!currentPage()...ontains(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
2701 d->btns[which]->setText(text);
never executed: d->btns[which]->setText(text);
0
2702}
never executed: end of block
0
2703-
2704/*!-
2705 Returns the text on button \a which.-
2706-
2707 If a text has ben set using setButtonText(), this text is returned.-
2708-
2709 By default, the text on buttons depends on the wizardStyle. For-
2710 example, on \macos, the \uicontrol Next button is called \uicontrol-
2711 Continue.-
2712-
2713 \sa button(), setButton(), setButtonText(), QWizardPage::buttonText(),-
2714 QWizardPage::setButtonText()-
2715*/-
2716QString QWizard::buttonText(WizardButton which) const-
2717{-
2718 Q_D(const QWizard);-
2719-
2720 if (!d->ensureButton(which))
!d->ensureButton(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
2721 return QString();
never executed: return QString();
0
2722-
2723 if (d->buttonCustomTexts.contains(which))
d->buttonCusto...ontains(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
2724 return d->buttonCustomTexts.value(which);
never executed: return d->buttonCustomTexts.value(which);
0
2725-
2726 const QString defText = buttonDefaultText(d->wizStyle, which, d);-
2727 if(!defText.isNull())
!defText.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
2728 return defText;
never executed: return defText;
0
2729-
2730 return d->btns[which]->text();
never executed: return d->btns[which]->text();
0
2731}-
2732-
2733/*!-
2734 Sets the order in which buttons are displayed to \a layout, where-
2735 \a layout is a list of \l{WizardButton}s.-
2736-
2737 The default layout depends on the options (e.g., whether-
2738 HelpButtonOnRight) that are set. You can call this function if-
2739 you need more control over the buttons' layout than what \l-
2740 options already provides.-
2741-
2742 You can specify horizontal stretches in the layout using \l-
2743 Stretch.-
2744-
2745 Example:-
2746-
2747 \snippet code/src_gui_dialogs_qwizard.cpp 1-
2748-
2749 \sa setButton(), setButtonText(), setOptions()-
2750*/-
2751void QWizard::setButtonLayout(const QList<WizardButton> &layout)-
2752{-
2753 Q_D(QWizard);-
2754-
2755 for (int i = 0; i < layout.count(); ++i) {
i < layout.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2756 WizardButton button1 = layout.at(i);-
2757-
2758 if (button1 == NoButton || button1 == Stretch)
button1 == NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
button1 == StretchDescription
TRUEnever evaluated
FALSEnever evaluated
0
2759 continue;
never executed: continue;
0
2760 if (!d->ensureButton(button1))
!d->ensureButton(button1)Description
TRUEnever evaluated
FALSEnever evaluated
0
2761 return;
never executed: return;
0
2762-
2763 // O(n^2), but n is very small-
2764 for (int j = 0; j < i; ++j) {
j < iDescription
TRUEnever evaluated
FALSEnever evaluated
0
2765 WizardButton button2 = layout.at(j);-
2766 if (button2 == button1) {
button2 == button1Description
TRUEnever evaluated
FALSEnever evaluated
0
2767 qWarning("QWizard::setButtonLayout: Duplicate button in layout");-
2768 return;
never executed: return;
0
2769 }-
2770 }
never executed: end of block
0
2771 }
never executed: end of block
0
2772-
2773 d->buttonsHaveCustomLayout = true;-
2774 d->buttonsCustomLayout = layout;-
2775 d->updateButtonLayout();-
2776}
never executed: end of block
0
2777-
2778/*!-
2779 Sets the button corresponding to role \a which to \a button.-
2780-
2781 To add extra buttons to the wizard (e.g., a \uicontrol Print button),-
2782 one way is to call setButton() with CustomButton1 to-
2783 CustomButton3, and make the buttons visible using the-
2784 HaveCustomButton1 to HaveCustomButton3 options.-
2785-
2786 \sa setButtonText(), setButtonLayout(), options-
2787*/-
2788void QWizard::setButton(WizardButton which, QAbstractButton *button)-
2789{-
2790 Q_D(QWizard);-
2791-
2792 if (uint(which) >= NButtons || d->btns[which] == button)
uint(which) >= NButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
d->btns[which] == buttonDescription
TRUEnever evaluated
FALSEnever evaluated
0
2793 return;
never executed: return;
0
2794-
2795 if (QAbstractButton *oldButton = d->btns[which]) {
QAbstractButto...d->btns[which]Description
TRUEnever evaluated
FALSEnever evaluated
0
2796 d->buttonLayout->removeWidget(oldButton);-
2797 delete oldButton;-
2798 }
never executed: end of block
0
2799-
2800 d->btns[which] = button;-
2801 if (button) {
buttonDescription
TRUEnever evaluated
FALSEnever evaluated
0
2802 button->setParent(d->antiFlickerWidget);-
2803 d->buttonCustomTexts.insert(which, button->text());-
2804 d->connectButton(which);-
2805 } else {
never executed: end of block
0
2806 d->buttonCustomTexts.remove(which); // ### what about page-specific texts set for 'which'-
2807 d->ensureButton(which); // (QWizardPage::setButtonText())? Clear them as well?-
2808 }
never executed: end of block
0
2809-
2810 d->updateButtonLayout();-
2811}
never executed: end of block
0
2812-
2813/*!-
2814 Returns the button corresponding to role \a which.-
2815-
2816 \sa setButton(), setButtonText()-
2817*/-
2818QAbstractButton *QWizard::button(WizardButton which) const-
2819{-
2820 Q_D(const QWizard);-
2821#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
2822 if (d->wizStyle == AeroStyle && which == BackButton)-
2823 return d->vistaHelper->backButton();-
2824#endif-
2825 if (!d->ensureButton(which))
!d->ensureButton(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
2826 return 0;
never executed: return 0;
0
2827 return d->btns[which];
never executed: return d->btns[which];
0
2828}-
2829-
2830/*!-
2831 \property QWizard::titleFormat-
2832 \brief the text format used by page titles-
2833-
2834 The default format is Qt::AutoText.-
2835-
2836 \sa QWizardPage::title, subTitleFormat-
2837*/-
2838void QWizard::setTitleFormat(Qt::TextFormat format)-
2839{-
2840 Q_D(QWizard);-
2841 d->titleFmt = format;-
2842 d->updateLayout();-
2843}
never executed: end of block
0
2844-
2845Qt::TextFormat QWizard::titleFormat() const-
2846{-
2847 Q_D(const QWizard);-
2848 return d->titleFmt;
never executed: return d->titleFmt;
0
2849}-
2850-
2851/*!-
2852 \property QWizard::subTitleFormat-
2853 \brief the text format used by page subtitles-
2854-
2855 The default format is Qt::AutoText.-
2856-
2857 \sa QWizardPage::title, titleFormat-
2858*/-
2859void QWizard::setSubTitleFormat(Qt::TextFormat format)-
2860{-
2861 Q_D(QWizard);-
2862 d->subTitleFmt = format;-
2863 d->updateLayout();-
2864}
never executed: end of block
0
2865-
2866Qt::TextFormat QWizard::subTitleFormat() const-
2867{-
2868 Q_D(const QWizard);-
2869 return d->subTitleFmt;
never executed: return d->subTitleFmt;
0
2870}-
2871-
2872/*!-
2873 Sets the pixmap for role \a which to \a pixmap.-
2874-
2875 The pixmaps are used by QWizard when displaying a page. Which-
2876 pixmaps are actually used depend on the \l{Wizard Look and-
2877 Feel}{wizard style}.-
2878-
2879 Pixmaps can also be set for a specific page using-
2880 QWizardPage::setPixmap().-
2881-
2882 \sa QWizardPage::setPixmap(), {Elements of a Wizard Page}-
2883*/-
2884void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap)-
2885{-
2886 Q_D(QWizard);-
2887 Q_ASSERT(uint(which) < NPixmaps);-
2888 d->defaultPixmaps[which] = pixmap;-
2889 d->updatePixmap(which);-
2890}
never executed: end of block
0
2891-
2892/*!-
2893 Returns the pixmap set for role \a which.-
2894-
2895 By default, the only pixmap that is set is the BackgroundPixmap on-
2896 \macos.-
2897-
2898 \sa QWizardPage::pixmap(), {Elements of a Wizard Page}-
2899*/-
2900QPixmap QWizard::pixmap(WizardPixmap which) const-
2901{-
2902 Q_D(const QWizard);-
2903 Q_ASSERT(uint(which) < NPixmaps);-
2904#ifdef Q_OS_MACX-
2905 if (which == BackgroundPixmap && d->defaultPixmaps[BackgroundPixmap].isNull())-
2906 d->defaultPixmaps[BackgroundPixmap] = d->findDefaultBackgroundPixmap();-
2907#endif-
2908 return d->defaultPixmaps[which];
never executed: return d->defaultPixmaps[which];
0
2909}-
2910-
2911/*!-
2912 Sets the default property for \a className to be \a property,-
2913 and the associated change signal to be \a changedSignal.-
2914-
2915 The default property is used when an instance of \a className (or-
2916 of one of its subclasses) is passed to-
2917 QWizardPage::registerField() and no property is specified.-
2918-
2919 QWizard knows the most common Qt widgets. For these (or their-
2920 subclasses), you don't need to specify a \a property or a \a-
2921 changedSignal. The table below lists these widgets:-
2922-
2923 \table-
2924 \header \li Widget \li Property \li Change Notification Signal-
2925 \row \li QAbstractButton \li bool \l{QAbstractButton::}{checked} \li \l{QAbstractButton::}{toggled()}-
2926 \row \li QAbstractSlider \li int \l{QAbstractSlider::}{value} \li \l{QAbstractSlider::}{valueChanged()}-
2927 \row \li QComboBox \li int \l{QComboBox::}{currentIndex} \li \l{QComboBox::}{currentIndexChanged()}-
2928 \row \li QDateTimeEdit \li QDateTime \l{QDateTimeEdit::}{dateTime} \li \l{QDateTimeEdit::}{dateTimeChanged()}-
2929 \row \li QLineEdit \li QString \l{QLineEdit::}{text} \li \l{QLineEdit::}{textChanged()}-
2930 \row \li QListWidget \li int \l{QListWidget::}{currentRow} \li \l{QListWidget::}{currentRowChanged()}-
2931 \row \li QSpinBox \li int \l{QSpinBox::}{value} \li \l{QSpinBox::}{valueChanged()}-
2932 \endtable-
2933-
2934 \sa QWizardPage::registerField()-
2935*/-
2936void QWizard::setDefaultProperty(const char *className, const char *property,-
2937 const char *changedSignal)-
2938{-
2939 Q_D(QWizard);-
2940 for (int i = d->defaultPropertyTable.count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2941 if (qstrcmp(d->defaultPropertyTable.at(i).className, className) == 0) {
qstrcmp(d->def...lassName) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2942 d->defaultPropertyTable.remove(i);-
2943 break;
never executed: break;
0
2944 }-
2945 }
never executed: end of block
0
2946 d->defaultPropertyTable.append(QWizardDefaultProperty(className, property, changedSignal));-
2947}
never executed: end of block
0
2948-
2949/*!-
2950 \since 4.7-
2951-
2952 Sets the given \a widget to be shown on the left side of the wizard.-
2953 For styles which use the WatermarkPixmap (ClassicStyle and ModernStyle)-
2954 the side widget is displayed on top of the watermark, for other styles-
2955 or when the watermark is not provided the side widget is displayed-
2956 on the left side of the wizard.-
2957-
2958 Passing 0 shows no side widget.-
2959-
2960 When the \a widget is not 0 the wizard reparents it.-
2961-
2962 Any previous side widget is hidden.-
2963-
2964 You may call setSideWidget() with the same widget at different-
2965 times.-
2966-
2967 All widgets set here will be deleted by the wizard when it is-
2968 destroyed unless you separately reparent the widget after setting-
2969 some other side widget (or 0).-
2970-
2971 By default, no side widget is present.-
2972*/-
2973void QWizard::setSideWidget(QWidget *widget)-
2974{-
2975 Q_D(QWizard);-
2976-
2977 d->sideWidget = widget;-
2978 if (d->watermarkLabel) {
d->watermarkLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
2979 d->watermarkLabel->setSideWidget(widget);-
2980 d->updateLayout();-
2981 }
never executed: end of block
0
2982}
never executed: end of block
0
2983-
2984/*!-
2985 \since 4.7-
2986-
2987 Returns the widget on the left side of the wizard or 0.-
2988-
2989 By default, no side widget is present.-
2990*/-
2991QWidget *QWizard::sideWidget() const-
2992{-
2993 Q_D(const QWizard);-
2994-
2995 return d->sideWidget;
never executed: return d->sideWidget;
0
2996}-
2997-
2998/*!-
2999 \reimp-
3000*/-
3001void QWizard::setVisible(bool visible)-
3002{-
3003 Q_D(QWizard);-
3004 if (visible) {
visibleDescription
TRUEnever evaluated
FALSEnever evaluated
0
3005 if (d->current == -1)
d->current == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
3006 restart();
never executed: restart();
0
3007 }
never executed: end of block
0
3008 QDialog::setVisible(visible);-
3009}
never executed: end of block
0
3010-
3011/*!-
3012 \reimp-
3013*/-
3014QSize QWizard::sizeHint() const-
3015{-
3016 Q_D(const QWizard);-
3017 QSize result = d->mainLayout->totalSizeHint();-
3018 QSize extra(500, 360);-
3019 if (d->wizStyle == MacStyle && d->current != -1) {
d->wizStyle == MacStyleDescription
TRUEnever evaluated
FALSEnever evaluated
d->current != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
3020 QSize pixmap(currentPage()->pixmap(BackgroundPixmap).size());-
3021 extra.setWidth(616);-
3022 if (!pixmap.isNull()) {
!pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
3023 extra.setHeight(pixmap.height());-
3024-
3025 /*-
3026 The width isn't always reliable as a size hint, as-
3027 some wizard backgrounds just cover the leftmost area.-
3028 Use a rule of thumb to determine if the width is-
3029 reliable or not.-
3030 */-
3031 if (pixmap.width() >= pixmap.height())
pixmap.width()...ixmap.height()Description
TRUEnever evaluated
FALSEnever evaluated
0
3032 extra.setWidth(pixmap.width());
never executed: extra.setWidth(pixmap.width());
0
3033 }
never executed: end of block
0
3034 }
never executed: end of block
0
3035 return result.expandedTo(extra);
never executed: return result.expandedTo(extra);
0
3036}-
3037-
3038/*!-
3039 \fn void QWizard::currentIdChanged(int id)-
3040-
3041 This signal is emitted when the current page changes, with the new-
3042 current \a id.-
3043-
3044 \sa currentId(), currentPage()-
3045*/-
3046-
3047/*!-
3048 \fn void QWizard::pageAdded(int id)-
3049-
3050 \since 4.7-
3051-
3052 This signal is emitted whenever a page is added to the-
3053 wizard. The page's \a id is passed as parameter.-
3054-
3055 \sa addPage(), setPage(), startId()-
3056*/-
3057-
3058/*!-
3059 \fn void QWizard::pageRemoved(int id)-
3060-
3061 \since 4.7-
3062-
3063 This signal is emitted whenever a page is removed from the-
3064 wizard. The page's \a id is passed as parameter.-
3065-
3066 \sa removePage(), startId()-
3067*/-
3068-
3069/*!-
3070 \fn void QWizard::helpRequested()-
3071-
3072 This signal is emitted when the user clicks the \uicontrol Help button.-
3073-
3074 By default, no \uicontrol Help button is shown. Call-
3075 setOption(HaveHelpButton, true) to have one.-
3076-
3077 Example:-
3078-
3079 \snippet dialogs/licensewizard/licensewizard.cpp 0-
3080 \dots-
3081 \snippet dialogs/licensewizard/licensewizard.cpp 5-
3082 \snippet dialogs/licensewizard/licensewizard.cpp 7-
3083 \dots-
3084 \snippet dialogs/licensewizard/licensewizard.cpp 8-
3085 \codeline-
3086 \snippet dialogs/licensewizard/licensewizard.cpp 10-
3087 \dots-
3088 \snippet dialogs/licensewizard/licensewizard.cpp 12-
3089 \codeline-
3090 \snippet dialogs/licensewizard/licensewizard.cpp 14-
3091 \codeline-
3092 \snippet dialogs/licensewizard/licensewizard.cpp 15-
3093-
3094 \sa customButtonClicked()-
3095*/-
3096-
3097/*!-
3098 \fn void QWizard::customButtonClicked(int which)-
3099-
3100 This signal is emitted when the user clicks a custom button. \a-
3101 which can be CustomButton1, CustomButton2, or CustomButton3.-
3102-
3103 By default, no custom button is shown. Call setOption() with-
3104 HaveCustomButton1, HaveCustomButton2, or HaveCustomButton3 to have-
3105 one, and use setButtonText() or setButton() to configure it.-
3106-
3107 \sa helpRequested()-
3108*/-
3109-
3110/*!-
3111 Goes back to the previous page.-
3112-
3113 This is equivalent to pressing the \uicontrol Back button.-
3114-
3115 \sa next(), accept(), reject(), restart()-
3116*/-
3117void QWizard::back()-
3118{-
3119 Q_D(QWizard);-
3120 int n = d->history.count() - 2;-
3121 if (n < 0)
n < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3122 return;
never executed: return;
0
3123 d->switchToPage(d->history.at(n), QWizardPrivate::Backward);-
3124}
never executed: end of block
0
3125-
3126/*!-
3127 Advances to the next page.-
3128-
3129 This is equivalent to pressing the \uicontrol Next or \uicontrol Commit button.-
3130-
3131 \sa nextId(), back(), accept(), reject(), restart()-
3132*/-
3133void QWizard::next()-
3134{-
3135 Q_D(QWizard);-
3136-
3137 if (d->current == -1)
d->current == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
3138 return;
never executed: return;
0
3139-
3140 if (validateCurrentPage()) {
validateCurrentPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
3141 int next = nextId();-
3142 if (next != -1) {
next != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
3143 if (d->history.contains(next)) {
d->history.contains(next)Description
TRUEnever evaluated
FALSEnever evaluated
0
3144 qWarning("QWizard::next: Page %d already met", next);-
3145 return;
never executed: return;
0
3146 }-
3147 if (!d->pageMap.contains(next)) {
!d->pageMap.contains(next)Description
TRUEnever evaluated
FALSEnever evaluated
0
3148 qWarning("QWizard::next: No such page %d", next);-
3149 return;
never executed: return;
0
3150 }-
3151 d->switchToPage(next, QWizardPrivate::Forward);-
3152 }
never executed: end of block
0
3153 }
never executed: end of block
0
3154}
never executed: end of block
0
3155-
3156/*!-
3157 Restarts the wizard at the start page. This function is called automatically when the-
3158 wizard is shown.-
3159-
3160 \sa startId()-
3161*/-
3162void QWizard::restart()-
3163{-
3164 Q_D(QWizard);-
3165 d->disableUpdates();-
3166 d->reset();-
3167 d->switchToPage(startId(), QWizardPrivate::Forward);-
3168 d->enableUpdates();-
3169}
never executed: end of block
0
3170-
3171/*!-
3172 \reimp-
3173*/-
3174bool QWizard::event(QEvent *event)-
3175{-
3176 Q_D(QWizard);-
3177 if (event->type() == QEvent::StyleChange) { // Propagate style
event->type() ...t::StyleChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
3178 d->setStyle(style());-
3179 d->updateLayout();-
3180 }
never executed: end of block
0
3181#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
3182 else if (event->type() == QEvent::Show && d->vistaInitPending) {-
3183 d->vistaInitPending = false;-
3184 // Do not force AeroStyle when in Classic theme.-
3185 // Note that d->handleAeroStyleChange() needs to be called in any case as it does some-
3186 // necessary initialization, like ensures that the Aero specific back button is hidden if-
3187 // Aero theme isn't active.-
3188 if (QVistaHelper::vistaState() != QVistaHelper::Classic)-
3189 d->wizStyle = AeroStyle;-
3190 d->handleAeroStyleChange();-
3191 }-
3192 else if (d->isVistaThemeEnabled()) {-
3193 if (event->type() == QEvent::Resize-
3194 || event->type() == QEvent::LayoutDirectionChange) {-
3195 const int buttonLeft = (layoutDirection() == Qt::RightToLeft-
3196 ? width() - d->vistaHelper->backButton()->sizeHint().width()-
3197 : 0);-
3198-
3199 d->vistaHelper->backButton()->move(buttonLeft,-
3200 d->vistaHelper->backButton()->y());-
3201 }-
3202-
3203 d->vistaHelper->mouseEvent(event);-
3204 }-
3205#endif-
3206 return QDialog::event(event);
never executed: return QDialog::event(event);
0
3207}-
3208-
3209/*!-
3210 \reimp-
3211*/-
3212void QWizard::resizeEvent(QResizeEvent *event)-
3213{-
3214 Q_D(QWizard);-
3215 int heightOffset = 0;-
3216#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
3217 if (d->isVistaThemeEnabled()) {-
3218 heightOffset = d->vistaHelper->topOffset();-
3219 if (d->isVistaThemeEnabled(QVistaHelper::VistaAero))-
3220 heightOffset += d->vistaHelper->titleBarSize();-
3221 }-
3222#endif-
3223 d->antiFlickerWidget->resize(event->size().width(), event->size().height() - heightOffset);-
3224#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
3225 if (d->isVistaThemeEnabled())-
3226 d->vistaHelper->resizeEvent(event);-
3227#endif-
3228 QDialog::resizeEvent(event);-
3229}
never executed: end of block
0
3230-
3231/*!-
3232 \reimp-
3233*/-
3234void QWizard::paintEvent(QPaintEvent * event)-
3235{-
3236 Q_D(QWizard);-
3237 if (d->wizStyle == MacStyle && currentPage()) {
d->wizStyle == MacStyleDescription
TRUEnever evaluated
FALSEnever evaluated
currentPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
3238 QPixmap backgroundPixmap = currentPage()->pixmap(BackgroundPixmap);-
3239 if (backgroundPixmap.isNull())
backgroundPixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
3240 return;
never executed: return;
0
3241-
3242 QPainter painter(this);-
3243 painter.drawPixmap(0, (height() - backgroundPixmap.height()) / 2, backgroundPixmap);-
3244 }
never executed: end of block
0
3245#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
3246 else if (d->isVistaThemeEnabled()) {-
3247 if (d->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {-
3248 QPainter painter(this);-
3249 QColor color = d->vistaHelper->basicWindowFrameColor();-
3250 painter.fillRect(0, 0, width(), QVistaHelper::topOffset(), color);-
3251 }-
3252 d->vistaHelper->paintEvent(event);-
3253 }-
3254#else-
3255 Q_UNUSED(event);-
3256#endif-
3257}
never executed: end of block
0
3258-
3259#if defined(Q_OS_WIN)-
3260/*!-
3261 \reimp-
3262*/-
3263bool QWizard::nativeEvent(const QByteArray &eventType, void *message, long *result)-
3264{-
3265#if !defined(QT_NO_STYLE_WINDOWSVISTA)-
3266 Q_D(QWizard);-
3267 if (d->isVistaThemeEnabled() && eventType == "windows_generic_MSG") {-
3268 MSG *windowsMessage = static_cast<MSG *>(message);-
3269 const bool winEventResult = d->vistaHelper->handleWinEvent(windowsMessage, result);-
3270 if (QVistaHelper::vistaState() != d->vistaState) {-
3271 d->vistaState = QVistaHelper::vistaState();-
3272 d->vistaStateChanged = true;-
3273 setWizardStyle(AeroStyle);-
3274 }-
3275 return winEventResult;-
3276 } else {-
3277 return QDialog::nativeEvent(eventType, message, result);-
3278 }-
3279#else-
3280 return QDialog::nativeEvent(eventType, message, result);-
3281#endif-
3282}-
3283#endif-
3284-
3285/*!-
3286 \reimp-
3287*/-
3288void QWizard::done(int result)-
3289{-
3290 Q_D(QWizard);-
3291 // canceling leaves the wizard in a known state-
3292 if (result == Rejected) {
result == RejectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3293 d->reset();-
3294 } else {
never executed: end of block
0
3295 if (!validateCurrentPage())
!validateCurrentPage()Description
TRUEnever evaluated
FALSEnever evaluated
0
3296 return;
never executed: return;
0
3297 }
never executed: end of block
0
3298 QDialog::done(result);-
3299}
never executed: end of block
0
3300-
3301/*!-
3302 \fn void QWizard::initializePage(int id)-
3303-
3304 This virtual function is called by QWizard to prepare page \a id-
3305 just before it is shown either as a result of QWizard::restart()-
3306 being called, or as a result of the user clicking \uicontrol Next. (However, if the \l-
3307 QWizard::IndependentPages option is set, this function is only-
3308 called the first time the page is shown.)-
3309-
3310 By reimplementing this function, you can ensure that the page's-
3311 fields are properly initialized based on fields from previous-
3312 pages.-
3313-
3314 The default implementation calls QWizardPage::initializePage() on-
3315 page(\a id).-
3316-
3317 \sa QWizardPage::initializePage(), cleanupPage()-
3318*/-
3319void QWizard::initializePage(int theid)-
3320{-
3321 QWizardPage *page = this->page(theid);-
3322 if (page)
pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
3323 page->initializePage();
never executed: page->initializePage();
0
3324}
never executed: end of block
0
3325-
3326/*!-
3327 \fn void QWizard::cleanupPage(int id)-
3328-
3329 This virtual function is called by QWizard to clean up page \a id just before the-
3330 user leaves it by clicking \uicontrol Back (unless the \l QWizard::IndependentPages option is set).-
3331-
3332 The default implementation calls QWizardPage::cleanupPage() on-
3333 page(\a id).-
3334-
3335 \sa QWizardPage::cleanupPage(), initializePage()-
3336*/-
3337void QWizard::cleanupPage(int theid)-
3338{-
3339 QWizardPage *page = this->page(theid);-
3340 if (page)
pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
3341 page->cleanupPage();
never executed: page->cleanupPage();
0
3342}
never executed: end of block
0
3343-
3344/*!-
3345 This virtual function is called by QWizard when the user clicks-
3346 \uicontrol Next or \uicontrol Finish to perform some last-minute validation.-
3347 If it returns \c true, the next page is shown (or the wizard-
3348 finishes); otherwise, the current page stays up.-
3349-
3350 The default implementation calls QWizardPage::validatePage() on-
3351 the currentPage().-
3352-
3353 When possible, it is usually better style to disable the \uicontrol-
3354 Next or \uicontrol Finish button (by specifying \l{mandatory fields} or-
3355 by reimplementing QWizardPage::isComplete()) than to reimplement-
3356 validateCurrentPage().-
3357-
3358 \sa QWizardPage::validatePage(), currentPage()-
3359*/-
3360bool QWizard::validateCurrentPage()-
3361{-
3362 QWizardPage *page = currentPage();-
3363 if (!page)
!pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
3364 return true;
never executed: return true;
0
3365-
3366 return page->validatePage();
never executed: return page->validatePage();
0
3367}-
3368-
3369/*!-
3370 This virtual function is called by QWizard to find out which page-
3371 to show when the user clicks the \uicontrol Next button.-
3372-
3373 The return value is the ID of the next page, or -1 if no page follows.-
3374-
3375 The default implementation calls QWizardPage::nextId() on the-
3376 currentPage().-
3377-
3378 By reimplementing this function, you can specify a dynamic page-
3379 order.-
3380-
3381 \sa QWizardPage::nextId(), currentPage()-
3382*/-
3383int QWizard::nextId() const-
3384{-
3385 const QWizardPage *page = currentPage();-
3386 if (!page)
!pageDescription
TRUEnever evaluated
FALSEnever evaluated
0
3387 return -1;
never executed: return -1;
0
3388-
3389 return page->nextId();
never executed: return page->nextId();
0
3390}-
3391-
3392/*!-
3393 \class QWizardPage-
3394 \since 4.3-
3395 \brief The QWizardPage class is the base class for wizard pages.-
3396-
3397 \inmodule QtWidgets-
3398-
3399 QWizard represents a wizard. Each page is a QWizardPage. When-
3400 you create your own wizards, you can use QWizardPage directly,-
3401 or you can subclass it for more control.-
3402-
3403 A page has the following attributes, which are rendered by-
3404 QWizard: a \l title, a \l subTitle, and a \l{setPixmap()}{set of-
3405 pixmaps}. See \l{Elements of a Wizard Page} for details. Once a-
3406 page is added to the wizard (using QWizard::addPage() or-
3407 QWizard::setPage()), wizard() returns a pointer to the-
3408 associated QWizard object.-
3409-
3410 Page provides five virtual functions that can be reimplemented to-
3411 provide custom behavior:-
3412-
3413 \list-
3414 \li initializePage() is called to initialize the page's contents-
3415 when the user clicks the wizard's \uicontrol Next button. If you-
3416 want to derive the page's default from what the user entered-
3417 on previous pages, this is the function to reimplement.-
3418 \li cleanupPage() is called to reset the page's contents when the-
3419 user clicks the wizard's \uicontrol Back button.-
3420 \li validatePage() validates the page when the user clicks \uicontrol-
3421 Next or \uicontrol Finish. It is often used to show an error message-
3422 if the user has entered incomplete or invalid information.-
3423 \li nextId() returns the ID of the next page. It is useful when-
3424 \l{creating non-linear wizards}, which allow different-
3425 traversal paths based on the information provided by the user.-
3426 \li isComplete() is called to determine whether the \uicontrol Next-
3427 and/or \uicontrol Finish button should be enabled or disabled. If-
3428 you reimplement isComplete(), also make sure that-
3429 completeChanged() is emitted whenever the complete state-
3430 changes.-
3431 \endlist-
3432-
3433 Normally, the \uicontrol Next button and the \uicontrol Finish button of a-
3434 wizard are mutually exclusive. If isFinalPage() returns \c true, \uicontrol-
3435 Finish is available; otherwise, \uicontrol Next is available. By-
3436 default, isFinalPage() is true only when nextId() returns -1. If-
3437 you want to show \uicontrol Next and \uicontrol Final simultaneously for a-
3438 page (letting the user perform an "early finish"), call-
3439 setFinalPage(true) on that page. For wizards that support early-
3440 finishes, you might also want to set the-
3441 \l{QWizard::}{HaveNextButtonOnLastPage} and-
3442 \l{QWizard::}{HaveFinishButtonOnEarlyPages} options on the-
3443 wizard.-
3444-
3445 In many wizards, the contents of a page may affect the default-
3446 values of the fields of a later page. To make it easy to-
3447 communicate between pages, QWizard supports a \l{Registering and-
3448 Using Fields}{"field" mechanism} that allows you to register a-
3449 field (e.g., a QLineEdit) on a page and to access its value from-
3450 any page. Fields are global to the entire wizard and make it easy-
3451 for any single page to access information stored by another page,-
3452 without having to put all the logic in QWizard or having the-
3453 pages know explicitly about each other. Fields are registered-
3454 using registerField() and can be accessed at any time using-
3455 field() and setField().-
3456-
3457 \sa QWizard, {Class Wizard Example}, {License Wizard Example}-
3458*/-
3459-
3460/*!-
3461 Constructs a wizard page with the given \a parent.-
3462-
3463 When the page is inserted into a wizard using QWizard::addPage()-
3464 or QWizard::setPage(), the parent is automatically set to be the-
3465 wizard.-
3466-
3467 \sa wizard()-
3468*/-
3469QWizardPage::QWizardPage(QWidget *parent)-
3470 : QWidget(*new QWizardPagePrivate, parent, 0)-
3471{-
3472 connect(this, SIGNAL(completeChanged()), this, SLOT(_q_updateCachedCompleteState()));-
3473}
never executed: end of block
0
3474-
3475/*!-
3476 Destructor.-
3477*/-
3478QWizardPage::~QWizardPage()-
3479{-
3480}-
3481-
3482/*!-
3483 \property QWizardPage::title-
3484 \brief the title of the page-
3485-
3486 The title is shown by the QWizard, above the actual page. All-
3487 pages should have a title.-
3488-
3489 The title may be plain text or HTML, depending on the value of the-
3490 \l{QWizard::titleFormat} property.-
3491-
3492 By default, this property contains an empty string.-
3493-
3494 \sa subTitle, {Elements of a Wizard Page}-
3495*/-
3496void QWizardPage::setTitle(const QString &title)-
3497{-
3498 Q_D(QWizardPage);-
3499 d->title = title;-
3500 if (d->wizard && d->wizard->currentPage() == this)
d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
d->wizard->cur...Page() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3501 d->wizard->d_func()->updateLayout();
never executed: d->wizard->d_func()->updateLayout();
0
3502}
never executed: end of block
0
3503-
3504QString QWizardPage::title() const-
3505{-
3506 Q_D(const QWizardPage);-
3507 return d->title;
never executed: return d->title;
0
3508}-
3509-
3510/*!-
3511 \property QWizardPage::subTitle-
3512 \brief the subtitle of the page-
3513-
3514 The subtitle is shown by the QWizard, between the title and the-
3515 actual page. Subtitles are optional. In-
3516 \l{QWizard::ClassicStyle}{ClassicStyle} and-
3517 \l{QWizard::ModernStyle}{ModernStyle}, using subtitles is-
3518 necessary to make the header appear. In-
3519 \l{QWizard::MacStyle}{MacStyle}, the subtitle is shown as a text-
3520 label just above the actual page.-
3521-
3522 The subtitle may be plain text or HTML, depending on the value of-
3523 the \l{QWizard::subTitleFormat} property.-
3524-
3525 By default, this property contains an empty string.-
3526-
3527 \sa title, QWizard::IgnoreSubTitles, {Elements of a Wizard Page}-
3528*/-
3529void QWizardPage::setSubTitle(const QString &subTitle)-
3530{-
3531 Q_D(QWizardPage);-
3532 d->subTitle = subTitle;-
3533 if (d->wizard && d->wizard->currentPage() == this)
d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
d->wizard->cur...Page() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3534 d->wizard->d_func()->updateLayout();
never executed: d->wizard->d_func()->updateLayout();
0
3535}
never executed: end of block
0
3536-
3537QString QWizardPage::subTitle() const-
3538{-
3539 Q_D(const QWizardPage);-
3540 return d->subTitle;
never executed: return d->subTitle;
0
3541}-
3542-
3543/*!-
3544 Sets the pixmap for role \a which to \a pixmap.-
3545-
3546 The pixmaps are used by QWizard when displaying a page. Which-
3547 pixmaps are actually used depend on the \l{Wizard Look and-
3548 Feel}{wizard style}.-
3549-
3550 Pixmaps can also be set for the entire wizard using-
3551 QWizard::setPixmap(), in which case they apply for all pages that-
3552 don't specify a pixmap.-
3553-
3554 \sa QWizard::setPixmap(), {Elements of a Wizard Page}-
3555*/-
3556void QWizardPage::setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap)-
3557{-
3558 Q_D(QWizardPage);-
3559 Q_ASSERT(uint(which) < QWizard::NPixmaps);-
3560 d->pixmaps[which] = pixmap;-
3561 if (d->wizard && d->wizard->currentPage() == this)
d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
d->wizard->cur...Page() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3562 d->wizard->d_func()->updatePixmap(which);
never executed: d->wizard->d_func()->updatePixmap(which);
0
3563}
never executed: end of block
0
3564-
3565/*!-
3566 Returns the pixmap set for role \a which.-
3567-
3568 Pixmaps can also be set for the entire wizard using-
3569 QWizard::setPixmap(), in which case they apply for all pages that-
3570 don't specify a pixmap.-
3571-
3572 \sa QWizard::pixmap(), {Elements of a Wizard Page}-
3573*/-
3574QPixmap QWizardPage::pixmap(QWizard::WizardPixmap which) const-
3575{-
3576 Q_D(const QWizardPage);-
3577 Q_ASSERT(uint(which) < QWizard::NPixmaps);-
3578-
3579 const QPixmap &pixmap = d->pixmaps[which];-
3580 if (!pixmap.isNull())
!pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
3581 return pixmap;
never executed: return pixmap;
0
3582-
3583 if (wizard())
wizard()Description
TRUEnever evaluated
FALSEnever evaluated
0
3584 return wizard()->pixmap(which);
never executed: return wizard()->pixmap(which);
0
3585-
3586 return pixmap;
never executed: return pixmap;
0
3587}-
3588-
3589/*!-
3590 This virtual function is called by QWizard::initializePage() to-
3591 prepare the page just before it is shown either as a result of QWizard::restart()-
3592 being called, or as a result of the user clicking \uicontrol Next.-
3593 (However, if the \l QWizard::IndependentPages option is set, this function is only-
3594 called the first time the page is shown.)-
3595-
3596 By reimplementing this function, you can ensure that the page's-
3597 fields are properly initialized based on fields from previous-
3598 pages. For example:-
3599-
3600 \snippet dialogs/classwizard/classwizard.cpp 17-
3601-
3602 The default implementation does nothing.-
3603-
3604 \sa QWizard::initializePage(), cleanupPage(), QWizard::IndependentPages-
3605*/-
3606void QWizardPage::initializePage()-
3607{-
3608}-
3609-
3610/*!-
3611 This virtual function is called by QWizard::cleanupPage() when-
3612 the user leaves the page by clicking \uicontrol Back (unless the \l QWizard::IndependentPages-
3613 option is set).-
3614-
3615 The default implementation resets the page's fields to their-
3616 original values (the values they had before initializePage() was-
3617 called).-
3618-
3619 \sa QWizard::cleanupPage(), initializePage(), QWizard::IndependentPages-
3620*/-
3621void QWizardPage::cleanupPage()-
3622{-
3623 Q_D(QWizardPage);-
3624 if (d->wizard) {
d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
0
3625 QVector<QWizardField> &fields = d->wizard->d_func()->fields;-
3626 for (int i = 0; i < fields.count(); ++i) {
i < fields.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
3627 const QWizardField &field = fields.at(i);-
3628 if (field.page == this)
field.page == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3629 field.object->setProperty(field.property, field.initialValue);
never executed: field.object->setProperty(field.property, field.initialValue);
0
3630 }
never executed: end of block
0
3631 }
never executed: end of block
0
3632}
never executed: end of block
0
3633-
3634/*!-
3635 This virtual function is called by QWizard::validateCurrentPage()-
3636 when the user clicks \uicontrol Next or \uicontrol Finish to perform some-
3637 last-minute validation. If it returns \c true, the next page is shown-
3638 (or the wizard finishes); otherwise, the current page stays up.-
3639-
3640 The default implementation returns \c true.-
3641-
3642 When possible, it is usually better style to disable the \uicontrol-
3643 Next or \uicontrol Finish button (by specifying \l{mandatory fields} or-
3644 reimplementing isComplete()) than to reimplement validatePage().-
3645-
3646 \sa QWizard::validateCurrentPage(), isComplete()-
3647*/-
3648bool QWizardPage::validatePage()-
3649{-
3650 return true;
never executed: return true;
0
3651}-
3652-
3653/*!-
3654 This virtual function is called by QWizard to determine whether-
3655 the \uicontrol Next or \uicontrol Finish button should be enabled or-
3656 disabled.-
3657-
3658 The default implementation returns \c true if all \l{mandatory-
3659 fields} are filled; otherwise, it returns \c false.-
3660-
3661 If you reimplement this function, make sure to emit completeChanged(),-
3662 from the rest of your implementation, whenever the value of isComplete()-
3663 changes. This ensures that QWizard updates the enabled or disabled state of-
3664 its buttons. An example of the reimplementation is-
3665 available \l{http://doc.qt.io/archives/qq/qq22-qwizard.html#validatebeforeitstoolate}-
3666 {here}.-
3667-
3668 \sa completeChanged(), isFinalPage()-
3669*/-
3670bool QWizardPage::isComplete() const-
3671{-
3672 Q_D(const QWizardPage);-
3673-
3674 if (!d->wizard)
!d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
0
3675 return true;
never executed: return true;
0
3676-
3677 const QVector<QWizardField> &wizardFields = d->wizard->d_func()->fields;-
3678 for (int i = wizardFields.count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3679 const QWizardField &field = wizardFields.at(i);-
3680 if (field.page == this && field.mandatory) {
field.page == thisDescription
TRUEnever evaluated
FALSEnever evaluated
field.mandatoryDescription
TRUEnever evaluated
FALSEnever evaluated
0
3681 QVariant value = field.object->property(field.property);-
3682 if (value == field.initialValue)
value == field.initialValueDescription
TRUEnever evaluated
FALSEnever evaluated
0
3683 return false;
never executed: return false;
0
3684-
3685#ifndef QT_NO_LINEEDIT-
3686 if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(field.object)) {
QLineEdit *lin...(field.object)Description
TRUEnever evaluated
FALSEnever evaluated
0
3687 if (!lineEdit->hasAcceptableInput())
!lineEdit->has...eptableInput()Description
TRUEnever evaluated
FALSEnever evaluated
0
3688 return false;
never executed: return false;
0
3689 }
never executed: end of block
0
3690#endif-
3691#ifndef QT_NO_SPINBOX-
3692 if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(field.object)) {
QAbstractSpinB...(field.object)Description
TRUEnever evaluated
FALSEnever evaluated
0
3693 if (!spinBox->hasAcceptableInput())
!spinBox->hasAcceptableInput()Description
TRUEnever evaluated
FALSEnever evaluated
0
3694 return false;
never executed: return false;
0
3695 }
never executed: end of block
0
3696#endif-
3697 }
never executed: end of block
0
3698 }
never executed: end of block
0
3699 return true;
never executed: return true;
0
3700}-
3701-
3702/*!-
3703 Explicitly sets this page to be final if \a finalPage is true.-
3704-
3705 After calling setFinalPage(true), isFinalPage() returns \c true and the \uicontrol-
3706 Finish button is visible (and enabled if isComplete() returns-
3707 true).-
3708-
3709 After calling setFinalPage(false), isFinalPage() returns \c true if-
3710 nextId() returns -1; otherwise, it returns \c false.-
3711-
3712 \sa isComplete(), QWizard::HaveFinishButtonOnEarlyPages-
3713*/-
3714void QWizardPage::setFinalPage(bool finalPage)-
3715{-
3716 Q_D(QWizardPage);-
3717 d->explicitlyFinal = finalPage;-
3718 QWizard *wizard = this->wizard();-
3719 if (wizard && wizard->currentPage() == this)
wizardDescription
TRUEnever evaluated
FALSEnever evaluated
wizard->currentPage() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3720 wizard->d_func()->updateCurrentPage();
never executed: wizard->d_func()->updateCurrentPage();
0
3721}
never executed: end of block
0
3722-
3723/*!-
3724 This function is called by QWizard to determine whether the \uicontrol-
3725 Finish button should be shown for this page or not.-
3726-
3727 By default, it returns \c true if there is no next page-
3728 (i.e., nextId() returns -1); otherwise, it returns \c false.-
3729-
3730 By explicitly calling setFinalPage(true), you can let the user perform an-
3731 "early finish".-
3732-
3733 \sa isComplete(), QWizard::HaveFinishButtonOnEarlyPages-
3734*/-
3735bool QWizardPage::isFinalPage() const-
3736{-
3737 Q_D(const QWizardPage);-
3738 if (d->explicitlyFinal)
d->explicitlyFinalDescription
TRUEnever evaluated
FALSEnever evaluated
0
3739 return true;
never executed: return true;
0
3740-
3741 QWizard *wizard = this->wizard();-
3742 if (wizard && wizard->currentPage() == this) {
wizardDescription
TRUEnever evaluated
FALSEnever evaluated
wizard->currentPage() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3743 // try to use the QWizard implementation if possible-
3744 return wizard->nextId() == -1;
never executed: return wizard->nextId() == -1;
0
3745 } else {-
3746 return nextId() == -1;
never executed: return nextId() == -1;
0
3747 }-
3748}-
3749-
3750/*!-
3751 Sets this page to be a commit page if \a commitPage is true; otherwise,-
3752 sets it to be a normal page.-
3753-
3754 A commit page is a page that represents an action which cannot be undone-
3755 by clicking \uicontrol Back or \uicontrol Cancel.-
3756-
3757 A \uicontrol Commit button replaces the \uicontrol Next button on a commit page. Clicking this-
3758 button simply calls QWizard::next() just like clicking \uicontrol Next does.-
3759-
3760 A page entered directly from a commit page has its \uicontrol Back button disabled.-
3761-
3762 \sa isCommitPage()-
3763*/-
3764void QWizardPage::setCommitPage(bool commitPage)-
3765{-
3766 Q_D(QWizardPage);-
3767 d->commit = commitPage;-
3768 QWizard *wizard = this->wizard();-
3769 if (wizard && wizard->currentPage() == this)
wizardDescription
TRUEnever evaluated
FALSEnever evaluated
wizard->currentPage() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3770 wizard->d_func()->updateCurrentPage();
never executed: wizard->d_func()->updateCurrentPage();
0
3771}
never executed: end of block
0
3772-
3773/*!-
3774 Returns \c true if this page is a commit page; otherwise returns \c false.-
3775-
3776 \sa setCommitPage()-
3777*/-
3778bool QWizardPage::isCommitPage() const-
3779{-
3780 Q_D(const QWizardPage);-
3781 return d->commit;
never executed: return d->commit;
0
3782}-
3783-
3784/*!-
3785 Sets the text on button \a which to be \a text on this page.-
3786-
3787 By default, the text on buttons depends on the QWizard::wizardStyle,-
3788 but may be redefined for the wizard as a whole using QWizard::setButtonText().-
3789-
3790 \sa buttonText(), QWizard::setButtonText(), QWizard::buttonText()-
3791*/-
3792void QWizardPage::setButtonText(QWizard::WizardButton which, const QString &text)-
3793{-
3794 Q_D(QWizardPage);-
3795 d->buttonCustomTexts.insert(which, text);-
3796 if (wizard() && wizard()->currentPage() == this && wizard()->d_func()->btns[which])
wizard()Description
TRUEnever evaluated
FALSEnever evaluated
wizard()->curr...Page() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
wizard()->d_fu...)->btns[which]Description
TRUEnever evaluated
FALSEnever evaluated
0
3797 wizard()->d_func()->btns[which]->setText(text);
never executed: wizard()->d_func()->btns[which]->setText(text);
0
3798}
never executed: end of block
0
3799-
3800/*!-
3801 Returns the text on button \a which on this page.-
3802-
3803 If a text has ben set using setButtonText(), this text is returned.-
3804 Otherwise, if a text has been set using QWizard::setButtonText(),-
3805 this text is returned.-
3806-
3807 By default, the text on buttons depends on the QWizard::wizardStyle.-
3808 For example, on \macos, the \uicontrol Next button is called \uicontrol-
3809 Continue.-
3810-
3811 \sa setButtonText(), QWizard::buttonText(), QWizard::setButtonText()-
3812*/-
3813QString QWizardPage::buttonText(QWizard::WizardButton which) const-
3814{-
3815 Q_D(const QWizardPage);-
3816-
3817 if (d->buttonCustomTexts.contains(which))
d->buttonCusto...ontains(which)Description
TRUEnever evaluated
FALSEnever evaluated
0
3818 return d->buttonCustomTexts.value(which);
never executed: return d->buttonCustomTexts.value(which);
0
3819-
3820 if (wizard())
wizard()Description
TRUEnever evaluated
FALSEnever evaluated
0
3821 return wizard()->buttonText(which);
never executed: return wizard()->buttonText(which);
0
3822-
3823 return QString();
never executed: return QString();
0
3824}-
3825-
3826/*!-
3827 This virtual function is called by QWizard::nextId() to find-
3828 out which page to show when the user clicks the \uicontrol Next button.-
3829-
3830 The return value is the ID of the next page, or -1 if no page follows.-
3831-
3832 By default, this function returns the lowest ID greater than the ID-
3833 of the current page, or -1 if there is no such ID.-
3834-
3835 By reimplementing this function, you can specify a dynamic page-
3836 order. For example:-
3837-
3838 \snippet dialogs/licensewizard/licensewizard.cpp 18-
3839-
3840 \sa QWizard::nextId()-
3841*/-
3842int QWizardPage::nextId() const-
3843{-
3844 Q_D(const QWizardPage);-
3845-
3846 if (!d->wizard)
!d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
0
3847 return -1;
never executed: return -1;
0
3848-
3849 bool foundCurrentPage = false;-
3850-
3851 const QWizardPrivate::PageMap &pageMap = d->wizard->d_func()->pageMap;-
3852 QWizardPrivate::PageMap::const_iterator i = pageMap.constBegin();-
3853 QWizardPrivate::PageMap::const_iterator end = pageMap.constEnd();-
3854-
3855 for (; i != end; ++i) {
i != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
3856 if (i.value() == this) {
i.value() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
3857 foundCurrentPage = true;-
3858 } else if (foundCurrentPage) {
never executed: end of block
foundCurrentPageDescription
TRUEnever evaluated
FALSEnever evaluated
0
3859 return i.key();
never executed: return i.key();
0
3860 }-
3861 }
never executed: end of block
0
3862 return -1;
never executed: return -1;
0
3863}-
3864-
3865/*!-
3866 \fn void QWizardPage::completeChanged()-
3867-
3868 This signal is emitted whenever the complete state of the page-
3869 (i.e., the value of isComplete()) changes.-
3870-
3871 If you reimplement isComplete(), make sure to emit-
3872 completeChanged() whenever the value of isComplete() changes, to-
3873 ensure that QWizard updates the enabled or disabled state of its-
3874 buttons.-
3875-
3876 \sa isComplete()-
3877*/-
3878-
3879/*!-
3880 Sets the value of the field called \a name to \a value.-
3881-
3882 This function can be used to set fields on any page of the wizard.-
3883 It is equivalent to calling-
3884 wizard()->\l{QWizard::setField()}{setField(\a name, \a value)}.-
3885-
3886 \sa QWizard::setField(), field(), registerField()-
3887*/-
3888void QWizardPage::setField(const QString &name, const QVariant &value)-
3889{-
3890 Q_D(QWizardPage);-
3891 if (!d->wizard)
!d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
0
3892 return;
never executed: return;
0
3893 d->wizard->setField(name, value);-
3894}
never executed: end of block
0
3895-
3896/*!-
3897 Returns the value of the field called \a name.-
3898-
3899 This function can be used to access fields on any page of the-
3900 wizard. It is equivalent to calling-
3901 wizard()->\l{QWizard::field()}{field(\a name)}.-
3902-
3903 Example:-
3904-
3905 \snippet dialogs/classwizard/classwizard.cpp 17-
3906-
3907 \sa QWizard::field(), setField(), registerField()-
3908*/-
3909QVariant QWizardPage::field(const QString &name) const-
3910{-
3911 Q_D(const QWizardPage);-
3912 if (!d->wizard)
!d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
0
3913 return QVariant();
never executed: return QVariant();
0
3914 return d->wizard->field(name);
never executed: return d->wizard->field(name);
0
3915}-
3916-
3917/*!-
3918 Creates a field called \a name associated with the given \a-
3919 property of the given \a widget. From then on, that property-
3920 becomes accessible using field() and setField().-
3921-
3922 Fields are global to the entire wizard and make it easy for any-
3923 single page to access information stored by another page, without-
3924 having to put all the logic in QWizard or having the pages know-
3925 explicitly about each other.-
3926-
3927 If \a name ends with an asterisk (\c *), the field is a mandatory-
3928 field. When a page has mandatory fields, the \uicontrol Next and/or-
3929 \uicontrol Finish buttons are enabled only when all mandatory fields-
3930 are filled. This requires a \a changedSignal to be specified, to-
3931 tell QWizard to recheck the value stored by the mandatory field.-
3932-
3933 QWizard knows the most common Qt widgets. For these (or their-
3934 subclasses), you don't need to specify a \a property or a \a-
3935 changedSignal. The table below lists these widgets:-
3936-
3937 \table-
3938 \header \li Widget \li Property \li Change Notification Signal-
3939 \row \li QAbstractButton \li bool \l{QAbstractButton::}{checked} \li \l{QAbstractButton::}{toggled()}-
3940 \row \li QAbstractSlider \li int \l{QAbstractSlider::}{value} \li \l{QAbstractSlider::}{valueChanged()}-
3941 \row \li QComboBox \li int \l{QComboBox::}{currentIndex} \li \l{QComboBox::}{currentIndexChanged()}-
3942 \row \li QDateTimeEdit \li QDateTime \l{QDateTimeEdit::}{dateTime} \li \l{QDateTimeEdit::}{dateTimeChanged()}-
3943 \row \li QLineEdit \li QString \l{QLineEdit::}{text} \li \l{QLineEdit::}{textChanged()}-
3944 \row \li QListWidget \li int \l{QListWidget::}{currentRow} \li \l{QListWidget::}{currentRowChanged()}-
3945 \row \li QSpinBox \li int \l{QSpinBox::}{value} \li \l{QSpinBox::}{valueChanged()}-
3946 \endtable-
3947-
3948 You can use QWizard::setDefaultProperty() to add entries to this-
3949 table or to override existing entries.-
3950-
3951 To consider a field "filled", QWizard simply checks that their-
3952 current value doesn't equal their original value (the value they-
3953 had before initializePage() was called). For QLineEdit, it also-
3954 checks that-
3955 \l{QLineEdit::hasAcceptableInput()}{hasAcceptableInput()} returns-
3956 true, to honor any validator or mask.-
3957-
3958 QWizard's mandatory field mechanism is provided for convenience.-
3959 It can be bypassed by reimplementing QWizardPage::isComplete().-
3960-
3961 \sa field(), setField(), QWizard::setDefaultProperty()-
3962*/-
3963void QWizardPage::registerField(const QString &name, QWidget *widget, const char *property,-
3964 const char *changedSignal)-
3965{-
3966 Q_D(QWizardPage);-
3967 QWizardField field(this, name, widget, property, changedSignal);-
3968 if (d->wizard) {
d->wizardDescription
TRUEnever evaluated
FALSEnever evaluated
0
3969 d->wizard->d_func()->addField(field);-
3970 } else {
never executed: end of block
0
3971 d->pendingFields += field;-
3972 }
never executed: end of block
0
3973}-
3974-
3975/*!-
3976 Returns the wizard associated with this page, or 0 if this page-
3977 hasn't been inserted into a QWizard yet.-
3978-
3979 \sa QWizard::addPage(), QWizard::setPage()-
3980*/-
3981QWizard *QWizardPage::wizard() const-
3982{-
3983 Q_D(const QWizardPage);-
3984 return d->wizard;
never executed: return d->wizard;
0
3985}-
3986-
3987QT_END_NAMESPACE-
3988-
3989#include "moc_qwizard.cpp"-
3990-
3991#endif // QT_NO_WIZARD-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9