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