62 #include "private/qt_mac_p.h" 64 #elif !defined(QT_NO_STYLE_WINDOWSVISTA) 69 #include "private/qdialog_p.h" 78 #ifdef QT_SOFTKEYS_ENABLED 104 const int MaxIterations = 100;
107 for (
int i = 0; i < MaxIterations; ++i) {
113 if (candidate != ancestor && ancestor->
isAncestorOf(candidate))
123 const QMetaObject *metaObject =
object->metaObject();
142 {
"QAbstractButton",
"checked",
SIGNAL(toggled(
bool)) },
143 {
"QAbstractSlider",
"value",
SIGNAL(valueChanged(
int)) },
144 {
"QComboBox",
"currentIndex",
SIGNAL(currentIndexChanged(
int)) },
147 {
"QListWidget",
"currentRow",
SIGNAL(currentRowChanged(
int)) },
148 {
"QSpinBox",
"value",
SIGNAL(valueChanged(
int)) }
160 const char *changedSignal)
161 : className(className), property(property), changedSignal(changedSignal) {}
185 : page(page),
name(spec), mandatory(false), object(object), property(property),
186 changedSignal(changedSignal)
205 for (
int i = 0; i < propertyCount; ++i) {
218 : topLevelMarginLeft(-1), topLevelMarginRight(-1), topLevelMarginTop(-1),
219 topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1),
220 childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1),
221 wizStyle(
QWizard::ClassicStyle), header(false), watermark(false), title(false),
222 subTitle(false), extension(false), sideWidget(false) {}
263 && title == other.
title 275 :
QWidget(parent) { setFixedHeight(2); }
284 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 286 bool vistaDisabled()
const;
319 layout->setRowMinimumHeight(3, 1);
320 layout->setRowStretch(4, 1);
322 layout->setColumnStretch(2, 1);
331 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 334 bool styleDisabled =
false;
342 return styleDisabled;
364 layout->setColumnMinimumWidth(0, minColumnWidth0);
365 layout->setColumnMinimumWidth(1, minColumnWidth1);
387 int delta = candidateSubTitleWidth >> 1;
390 <= desiredSubTitleHeight)
391 candidateSubTitleWidth -= delta;
419 painter.
drawLine(0, y + 1, x + 1, y + 1);
436 m_layout->addWidget(m_sideWidget);
440 if (!pixmap() && !pixmap()->
isNull())
441 return pixmap()->size();
446 if (m_sideWidget == widget)
449 m_layout->removeWidget(m_sideWidget);
450 m_sideWidget->hide();
454 m_layout->addWidget(m_sideWidget);
469 enum TriState { Tri_Unknown = -1, Tri_False, Tri_True };
472 : wizard(0), completeState(Tri_Unknown), explicitlyFinal(false), commit(false) {}
474 bool cachedIsComplete()
const;
475 void _q_maybeEmitCompleteChanged();
476 void _q_updateCachedCompleteState();
492 if (completeState == Tri_Unknown)
493 completeState = q->isComplete() ? Tri_True : Tri_False;
494 return completeState == Tri_True;
500 TriState newState = q->isComplete() ? Tri_True : Tri_False;
501 if (newState != completeState)
502 emit q->completeChanged();
508 completeState = q->isComplete() ? Tri_True : Tri_False;
519 , wizardPrivate(wizardPrivate) {}
520 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 540 , startSetByUser(false)
544 , disableUpdatesCount(0)
546 , buttonsHaveCustomLayout(false)
549 , placeholderWidget1(0)
550 , placeholderWidget2(0)
558 , vistaInitPending(false)
560 , vistaStateChanged(false)
561 , inHandleAeroStyleChange(false)
570 #ifdef QT_SOFTKEYS_ENABLED 574 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 576 vistaInitPending =
true;
582 void cleanupPagesNotInHistory();
584 void removeFieldAt(
int index);
590 void updateCurrentPage();
593 void updateButtonTexts();
594 void updateButtonLayout();
598 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 601 void handleAeroStyleChange();
603 bool isVistaThemeEnabled()
const;
604 void disableUpdates();
605 void enableUpdates();
606 void _q_emitCustomButtonClicked();
607 void _q_updateButtonStates();
608 void _q_handleFieldObjectDestroyed(
QObject *);
611 static QPixmap findDefaultBackgroundPixmap();
659 #ifdef QT_SOFTKEYS_ENABLED 667 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 682 #if defined(QT_NO_STYLE_WINDOWSVISTA) 720 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 730 pageFrame =
new QFrame(antiFlickerWidget);
734 pageVBoxLayout->setSpacing(0);
735 pageVBoxLayout->addSpacing(0);
737 pageVBoxLayout->addItem(spacerItem);
743 updateButtonLayout();
755 q->currentPage()->hide();
756 cleanupPagesNotInHistory();
757 for (
int i = history.count() - 1; i >= 0; --i)
758 q->cleanupPage(history.at(i));
763 emit q->currentIdChanged(-1);
775 for (; i !=
end; ++i) {
776 if (!history.contains(*i)) {
778 initialized.remove(*i);
788 myField.
resolve(defaultPropertyTable);
790 if (fieldIndexMap.contains(myField.
name)) {
795 fieldIndexMap.insert(myField.
name, fields.
count());
799 myField.
page,
SLOT(_q_maybeEmitCompleteChanged()));
810 fieldIndexMap.remove(field.
name);
813 field.
page,
SLOT(_q_maybeEmitCompleteChanged()));
817 fields.remove(index);
830 if (direction == Backward) {
832 q->cleanupPage(oldId);
833 initialized.remove(oldId);
836 history.removeLast();
845 if (direction == Forward) {
846 if (!initialized.contains(current)) {
847 initialized.insert(current);
850 history.append(current);
855 canContinue = (q->nextId() != -1);
858 _q_updateButtonStates();
877 candidate = nextOrFinishButton;
878 }
else if (newPage) {
882 candidate = nextOrFinishButton;
891 emit q->currentIdChanged(current);
916 info.
hspacing = (layoutHorizontalSpacing == -1)
918 : layoutHorizontalSpacing;
922 : layoutHorizontalSpacing;
941 titleText = page->title();
942 subTitleText = page->subTitle();
951 && !watermarkPixmap.
isNull();
966 for (
int i = mainLayout->count() - 1; i >= 0; --i) {
974 for (
int i = mainLayout->columnCount() - 1; i >= 0; --i)
975 mainLayout->setColumnMinimumWidth(i, 0);
976 for (
int i = mainLayout->rowCount() - 1; i >= 0; --i)
977 mainLayout->setRowMinimumHeight(i, 0);
1002 int pageColumn =
qMin(1, numColumns - 1);
1005 mainLayout->setMargin(0);
1006 mainLayout->setSpacing(0);
1008 pageVBoxLayout->setMargin(7);
1011 mainLayout->setMargin(0);
1012 mainLayout->setSpacing(0);
1013 pageVBoxLayout->setContentsMargins(deltaMarginLeft, deltaMarginTop,
1014 deltaMarginRight, deltaMarginBottom);
1020 mainLayout->setHorizontalSpacing(info.
hspacing);
1021 mainLayout->setVerticalSpacing(info.
vspacing);
1022 pageVBoxLayout->setContentsMargins(0, 0, 0, 0);
1023 buttonLayout->setContentsMargins(0, 0, 0, 0);
1031 headerWidget->setAutoFillBackground(modern);
1032 mainLayout->addWidget(headerWidget, row++, 0, 1, numColumns);
1035 headerWidget->setVisible(info.
header);
1037 int watermarkStartRow = row;
1040 mainLayout->setRowMinimumHeight(row++, 10);
1049 QFont titleFont = q->font();
1063 const int aeroTitleIndent = 25;
1073 if (!placeholderWidget1) {
1074 placeholderWidget1 =
new QWidget(antiFlickerWidget);
1078 mainLayout->addWidget(placeholderWidget1, row++, pageColumn);
1080 mainLayout->addWidget(
titleLabel, row++, pageColumn);
1082 if (!placeholderWidget2) {
1083 placeholderWidget2 =
new QWidget(antiFlickerWidget);
1086 placeholderWidget2->setFixedHeight(5);
1087 mainLayout->addWidget(placeholderWidget2, row++, pageColumn);
1090 mainLayout->setRowMinimumHeight(row++, 7);
1092 if (placeholderWidget1)
1093 placeholderWidget1->setVisible(info.
title && modern);
1094 if (placeholderWidget2)
1095 placeholderWidget2->setVisible(info.
title && modern);
1116 pageFrame->setLineWidth(0);
1117 pageFrame->setMidLineWidth(hMargin);
1122 vMargin = deltaMarginBottom;
1123 }
else if (classic) {
1130 int leftMargin = 18;
1134 pageFrame->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin);
1136 pageFrame->setContentsMargins(hMargin, vMargin, hMargin, vMargin);
1142 watermarkLabel->setMinimumHeight(1);
1148 const bool wasSemiTransparent =
1150 || pageFrame->palette().brush(
QPalette::Base).color().alpha() < 255;
1152 if (!wasSemiTransparent) {
1153 QPalette pal = pageFrame->palette();
1158 pageFrame->setPalette(pal);
1159 pageFrame->setAutoFillBackground(
true);
1160 antiFlickerWidget->setAutoFillBackground(
false);
1163 if (wasSemiTransparent)
1166 bool baseBackground = (modern && !info.
header);
1171 pageFrame->setAutoFillBackground(baseBackground);
1173 watermarkLabel->setAutoFillBackground(baseBackground);
1174 if (placeholderWidget1)
1175 placeholderWidget1->setAutoFillBackground(baseBackground);
1176 if (placeholderWidget2)
1177 placeholderWidget2->setAutoFillBackground(baseBackground);
1180 QPalette pal = pageFrame->palette();
1182 pageFrame->setPalette(pal);
1183 pageFrame->setAutoFillBackground(
true);
1184 pal = antiFlickerWidget->palette();
1186 antiFlickerWidget->setPalette(pal);
1187 antiFlickerWidget->setAutoFillBackground(
true);
1191 mainLayout->addWidget(pageFrame, row++, pageColumn);
1193 int watermarkEndRow = row;
1195 mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
1198 buttonLayout->setContentsMargins(9, 9, 9, 9);
1199 mainLayout->setContentsMargins(0, 11, 0, 0);
1202 int buttonStartColumn = info.
extension ? 1 : 0;
1203 int buttonNumColumns = info.
extension ? 1 : numColumns;
1205 if (classic || modern) {
1208 mainLayout->addWidget(bottomRuler, row++, buttonStartColumn, 1, buttonNumColumns);
1212 mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
1214 mainLayout->addLayout(buttonLayout, row++, buttonStartColumn, 1, buttonNumColumns);
1218 watermarkEndRow = row;
1219 mainLayout->addWidget(watermarkLabel, watermarkStartRow, 0,
1220 watermarkEndRow - watermarkStartRow, 1);
1223 mainLayout->setColumnMinimumWidth(0, mac && !info.
watermark ? 181 : 0);
1225 mainLayout->setColumnMinimumWidth(2, 21);
1228 headerWidget->setVisible(info.
header);
1234 bottomRuler->setVisible(classic || modern);
1248 if (layoutInfo != info)
1249 recreateLayout(info);
1258 bool expandPage = !page->
layout();
1260 const QLayoutItem *pageItem = pageVBoxLayout->itemAt(pageVBoxLayout->indexOf(page));
1263 QSpacerItem *bottomSpacer = pageVBoxLayout->itemAt(pageVBoxLayout->count() - 1)->spacerItem();
1266 pageVBoxLayout->invalidate();
1273 titleFmt, subTitleFmt);
1284 watermarkLabel->setPixmap(pix);
1299 updateMinMaxSizes(info);
1306 int extraHeight = 0;
1307 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 1308 if (isVistaThemeEnabled())
1309 extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset();
1314 minimumSize.
setWidth(headerWidget->maximumWidth());
1315 maximumSize.
setWidth(headerWidget->maximumWidth());
1318 minimumSize.
setHeight(mainLayout->totalSizeHint().height());
1319 maximumSize.
setHeight(mainLayout->totalSizeHint().height());
1342 if (q->currentPage()) {
1343 canContinue = (q->nextId() != -1);
1344 canFinish = q->currentPage()->isFinalPage();
1346 canContinue =
false;
1349 _q_updateButtonStates();
1350 updateButtonTexts();
1399 btns[which] = pushButton;
1404 #ifdef QT_SOFTKEYS_ENABLED 1424 softKeys[which] = softKey;
1426 connectButton(which);
1440 #ifdef QT_SOFTKEYS_ENABLED 1450 if (q->currentPage() && (q->currentPage()->d_func()->buttonCustomTexts.contains(i)))
1451 btns[i]->setText(q->currentPage()->d_func()->buttonCustomTexts.value(i));
1452 else if (buttonCustomTexts.contains(i))
1453 btns[i]->setText(buttonCustomTexts.value(i));
1456 #ifdef QT_SOFTKEYS_ENABLED 1457 softKeys[i]->setText(btns[i]->
text());
1465 if (buttonsHaveCustomLayout) {
1467 for (
int i = 0; i < buttonsCustomLayout.count(); ++i)
1468 array[i] = buttonsCustomLayout.
at(i);
1469 setButtonLayout(array.constData(), array.count());
1474 const int ArraySize = 12;
1476 memset(array, -1,
sizeof(array));
1500 setButtonLayout(array, ArraySize);
1508 for (
int i = buttonLayout->count() - 1; i >= 0; --i) {
1515 for (
int i = 0; i <
size; ++i) {
1518 buttonLayout->addStretch(1);
1520 ensureButton(which);
1521 buttonLayout->addWidget(btns[which]);
1526 btns[which]->show();
1534 _q_updateButtonStates();
1539 return !buttonsHaveCustomLayout || buttonsCustomLayout.contains(which);
1548 q->updateGeometry();
1555 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 1559 const QVariant v = q->property(
"_q_wizard_vista_off");
1574 if (inHandleAeroStyleChange)
1576 inHandleAeroStyleChange =
true;
1578 vistaHelper->disconnectBackButton();
1579 q->removeEventFilter(vistaHelper);
1581 if (isVistaThemeEnabled()) {
1584 q->installEventFilter(vistaHelper);
1585 q->setMouseTracking(
true);
1586 antiFlickerWidget->move(0, vistaHelper->titleBarSize() + vistaHelper->topOffset());
1587 vistaHelper->backButton()->move(
1588 0, vistaHelper->topOffset()
1589 -
qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1));
1592 q->setMouseTracking(
true);
1593 antiFlickerWidget->move(0, vistaHelper->topOffset());
1594 vistaHelper->backButton()->move(0, -1);
1596 vistaHelper->setTitleBarIconAndCaptionVisible(
false);
1599 vistaHelper->backButton()->show();
1601 q->setMouseTracking(
true);
1602 #ifndef QT_NO_CURSOR 1605 antiFlickerWidget->move(0, 0);
1606 vistaHelper->hideBackButton();
1607 vistaHelper->setTitleBarIconAndCaptionVisible(
true);
1610 _q_updateButtonStates();
1613 vistaHelper->setWindowPosHack();
1615 inHandleAeroStyleChange =
false;
1621 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 1632 if (disableUpdatesCount++ == 0) {
1633 q->setUpdatesEnabled(
false);
1634 antiFlickerWidget->hide();
1641 if (--disableUpdatesCount == 0) {
1642 antiFlickerWidget->show();
1643 q->setUpdatesEnabled(
true);
1652 if (btns[i] == button) {
1668 btn.back->setEnabled(history.count() > 1
1669 && !q->page(history.at(history.count() - 2))->isCommitPage()
1671 btn.next->setEnabled(canContinue && complete);
1672 btn.commit->setEnabled(canContinue && complete);
1673 btn.finish->setEnabled(canFinish && complete);
1679 btn.back->setVisible(backButtonVisible);
1688 if (
QPushButton *nextPush = qobject_cast<QPushButton *>(btn.next))
1689 nextPush->setDefault(canContinue && useDefault && !commitPage);
1690 if (
QPushButton *commitPush = qobject_cast<QPushButton *>(btn.commit))
1691 commitPush->setDefault(canContinue && useDefault && commitPage);
1692 if (
QPushButton *finishPush = qobject_cast<QPushButton *>(btn.finish))
1693 finishPush->setDefault(!canContinue && useDefault);
1695 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 1696 if (isVistaThemeEnabled()) {
1697 vistaHelper->backButton()->setEnabled(btn.back->isEnabled());
1698 vistaHelper->backButton()->setVisible(backButtonVisible);
1699 btn.back->setVisible(
false);
1703 #ifdef QT_SOFTKEYS_ENABLED 1706 wizardButton = btns[i];
1708 wizardButton->
hide();
1709 q->addAction(softKeys[i]);
1711 q->removeAction(softKeys[i]);
1721 int destroyed_index = -1;
1723 while (it != fields.
end()) {
1725 if (field.
object ==
object) {
1726 destroyed_index = fieldIndexMap.value(field.
name, -1);
1727 fieldIndexMap.remove(field.
name);
1728 it = fields.
erase(it);
1733 if (destroyed_index != -1) {
1735 while (it2 != fieldIndexMap.
end()) {
1737 if (index > destroyed_index) {
1739 fieldIndexMap.
insert(field_name, index-1);
1750 btns[i]->setStyle(style);
1753 it.value()->setStyle(style);
1761 const int ExpectedImageWidth = 242;
1762 const int ExpectedImageHeight = 414;
1763 if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(
"com.apple.KeyboardSetupAssistant"),
1764 0, 0, &url) == noErr) {
1767 url = CFBundleCopyResourceURL(bundle, CFSTR(
"Background"), CFSTR(
"tif"), 0);
1772 int width = CGImageGetWidth(image);
1773 int height = CGImageGetHeight(image);
1774 if (width == ExpectedImageWidth && height == ExpectedImageHeight)
1786 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 1789 if (wizardPrivate->isVistaThemeEnabled()) {
1790 int leftMargin, topMargin, rightMargin, bottomMargin;
1791 wizardPrivate->buttonLayout->getContentsMargins(
1792 &leftMargin, &topMargin, &rightMargin, &bottomMargin);
1793 const int buttonLayoutTop = wizardPrivate->buttonLayout->contentsRect().top() - topMargin;
1798 painter.
drawLine(0, buttonLayoutTop,
width(), buttonLayoutTop);
2231 delete d->buttonLayout;
2246 if (!
d->pageMap.isEmpty())
2247 theid = (
d->pageMap.constEnd() - 1).
key() + 1;
2267 qWarning(
"QWizard::setPage: Cannot insert null page");
2272 qWarning(
"QWizard::setPage: Cannot insert page with ID -1");
2276 if (
d->pageMap.contains(theid)) {
2277 qWarning(
"QWizard::setPage: Page with duplicate ID %d ignored", theid);
2284 for (
int i = 0; i < pendingFields.
count(); ++i)
2285 d->addField(pendingFields.
at(i));
2286 pendingFields.
clear();
2290 d->pageMap.insert(theid, page);
2291 page->d_func()->
wizard =
this;
2293 int n =
d->pageVBoxLayout->count();
2296 bool pageVBoxLayoutEnabled =
d->pageVBoxLayout->isEnabled();
2297 d->pageVBoxLayout->setEnabled(
false);
2299 d->pageVBoxLayout->insertWidget(n - 1, page);
2303 d->pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled);
2305 if (!
d->startSetByUser &&
d->pageMap.constBegin().key() == theid)
2325 if (
d->pageMap.count() > 0) {
2326 if (
d->start ==
id) {
2327 const int firstId =
d->pageMap.constBegin().key();
2328 if (firstId ==
id) {
2329 if (
d->pageMap.count() > 1)
2330 d->start = (++
d->pageMap.constBegin()).
key();
2336 d->startSetByUser =
false;
2340 if (
d->pageMap.contains(
id))
2343 if (!
d->history.contains(
id)) {
2345 removedPage =
d->pageMap.take(
id);
2346 d->updateCurrentPage();
2347 }
else if (
id !=
d->current) {
2349 removedPage =
d->pageMap.take(
id);
2350 d->history.removeOne(
id);
2351 d->_q_updateButtonStates();
2352 }
else if (
d->history.count() == 1) {
2355 removedPage =
d->pageMap.take(
id);
2356 if (
d->pageMap.isEmpty())
2357 d->updateCurrentPage();
2363 removedPage =
d->pageMap.take(
id);
2364 d->updateCurrentPage();
2368 if (
d->initialized.contains(
id)) {
2370 d->initialized.remove(
id);
2373 d->pageVBoxLayout->removeWidget(removedPage);
2375 for (
int i =
d->fields.count() - 1; i >= 0; --i) {
2376 if (
d->fields.at(i).page == removedPage) {
2377 removedPage->d_func()->pendingFields +=
d->fields.at(i);
2378 d->removeFieldAt(i);
2395 return d->pageMap.value(theid);
2414 return d->history.contains(theid);
2438 return d->pageMap.keys();
2457 int newStart = theid;
2459 newStart =
d->pageMap.count() ?
d->pageMap.constBegin().key() : -1;
2461 if (
d->start == newStart) {
2462 d->startSetByUser = theid != -1;
2466 if (!
d->pageMap.contains(newStart)) {
2467 qWarning(
"QWizard::setStartId: Invalid page ID %d", newStart);
2470 d->start = newStart;
2471 d->startSetByUser = theid != -1;
2491 return page(
d->current);
2526 int index =
d->fieldIndexMap.value(name, -1);
2530 qWarning(
"QWizard::setField: Couldn't write to property '%s'",
2549 int index =
d->fieldIndexMap.value(name, -1);
2580 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 2581 const bool aeroStyleChange =
2582 d->vistaInitPending ||
d->vistaStateChanged || (styleChange && (style ==
AeroStyle ||
d->wizStyle ==
AeroStyle));
2583 d->vistaStateChanged =
false;
2584 d->vistaInitPending =
false;
2592 d->disableUpdates();
2594 d->updateButtonTexts();
2598 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 2599 if (aeroStyleChange)
2600 d->handleAeroStyleChange();
2620 if (!(
d->opts & option) != !on)
2633 return (
d->opts & option) != 0;
2657 WizardOptions changed = (options ^
d->opts);
2661 d->disableUpdates();
2665 d->cleanupPagesNotInHistory();
2670 d->updateButtonLayout();
2674 d->_q_updateButtonStates();
2708 if (!
d->ensureButton(which))
2711 d->buttonCustomTexts.insert(which, text);
2714 d->btns[which]->setText(text);
2733 if (!
d->ensureButton(which))
2736 if (
d->buttonCustomTexts.contains(which))
2737 return d->buttonCustomTexts.value(which);
2743 return d->btns[which]->text();
2766 for (
int i = 0; i < layout.
count(); ++i) {
2771 if (!
d->ensureButton(button1))
2775 for (
int j = 0; j < i; ++j) {
2777 if (button2 == button1) {
2778 qWarning(
"QWizard::setButtonLayout: Duplicate button in layout");
2784 d->buttonsHaveCustomLayout =
true;
2785 d->buttonsCustomLayout =
layout;
2786 d->updateButtonLayout();
2814 d->buttonCustomTexts.insert(which, button->
text());
2815 d->connectButton(which);
2817 d->buttonCustomTexts.remove(which);
2818 d->ensureButton(which);
2821 d->updateButtonLayout();
2832 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 2834 return d->vistaHelper->backButton();
2836 if (!
d->ensureButton(which))
2838 return d->btns[which];
2886 return d->subTitleFmt;
2905 d->defaultPixmaps[which] =
pixmap;
2906 d->updatePixmap(which);
2925 return d->defaultPixmaps[which];
2957 for (
int i =
d->defaultPropertyTable.count() - 1; i >= 0; --i) {
2959 d->defaultPropertyTable.remove(i);
2998 if (
d->watermarkLabel) {
2999 d->watermarkLabel->setSideWidget(widget);
3018 return d->sideWidget;
3028 if (
d->current == -1)
3044 QSize extra(500, 360);
3046 if (
d->wizStyle ==
MacStyle &&
d->current != -1) {
3162 int n =
d->history.count() - 2;
3179 if (
d->current == -1)
3185 if (
d->history.contains(next)) {
3186 qWarning(
"QWizard::next: Page %d already met", next);
3189 if (!
d->pageMap.contains(next)) {
3190 qWarning(
"QWizard::next: No such page %d", next);
3207 d->disableUpdates();
3223 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 3225 d->vistaInitPending =
false;
3227 d->handleAeroStyleChange();
3229 else if (
d->isVistaThemeEnabled()) {
3233 ?
width() -
d->vistaHelper->backButton()->sizeHint().width()
3236 d->vistaHelper->backButton()->move(buttonLeft,
3237 d->vistaHelper->backButton()->y());
3240 d->vistaHelper->mouseEvent(event);
3252 int heightOffset = 0;
3253 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 3254 if (
d->isVistaThemeEnabled()) {
3255 heightOffset =
d->vistaHelper->topOffset();
3257 heightOffset +=
d->vistaHelper->titleBarSize();
3260 d->antiFlickerWidget->resize(event->
size().
width(),
event->size().height() - heightOffset);
3261 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 3262 if (
d->isVistaThemeEnabled())
3263 d->vistaHelper->resizeEvent(event);
3276 if (backgroundPixmap.
isNull())
3282 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 3283 else if (
d->isVistaThemeEnabled()) {
3286 QColor color =
d->vistaHelper->basicWindowFrameColor();
3289 d->vistaHelper->paintEvent(event);
3296 #if defined(Q_WS_WIN) 3302 #if !defined(QT_NO_STYLE_WINDOWSVISTA) 3304 if (
d->isVistaThemeEnabled()) {
3305 const bool winEventResult =
d->vistaHelper->handleWinEvent(message, result);
3308 d->vistaStateChanged =
true;
3311 return winEventResult;
3537 if (
d->wizard &&
d->wizard->currentPage() ==
this)
3538 d->wizard->d_func()->updateLayout();
3573 if (
d->wizard &&
d->wizard->currentPage() ==
this)
3574 d->wizard->d_func()->updateLayout();
3601 if (
d->wizard &&
d->wizard->currentPage() ==
this)
3602 d->wizard->d_func()->updatePixmap(which);
3666 for (
int i = 0; i < fields.
count(); ++i) {
3668 if (field.
page ==
this)
3717 for (
int i = wizardFields.
count() - 1; i >= 0; --i) {
3724 #ifndef QT_NO_LINEEDIT 3726 if (!lineEdit->hasAcceptableInput())
3730 #ifndef QT_NO_SPINBOX 3732 if (!spinBox->hasAcceptableInput())
3756 d->explicitlyFinal = finalPage;
3759 wizard->d_func()->updateCurrentPage();
3777 if (
d->explicitlyFinal)
3783 return wizard->
nextId() == -1;
3806 d->commit = commitPage;
3809 wizard->d_func()->updateCurrentPage();
3834 d->buttonCustomTexts.insert(which, text);
3836 wizard()->d_func()->btns[which]->setText(text);
3856 if (
d->buttonCustomTexts.contains(which))
3857 return d->buttonCustomTexts.value(which);
3888 bool foundCurrentPage =
false;
3894 for (; i !=
end; ++i) {
3895 if (i.
value() ==
this) {
3896 foundCurrentPage =
true;
3897 }
else if (foundCurrentPage) {
3935 d->wizard->setField(name, value);
3956 return d->wizard->field(name);
4011 d->wizard->d_func()->addField(field);
4013 d->pendingFields +=
field;
4031 #include "moc_qwizard.cpp" 4033 #endif // QT_NO_WIZARD static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
void restart()
Restarts the wizard at the start page.
The QPainter class performs low-level painting on widgets and other paint devices.
void paintEvent(QPaintEvent *event)
Reimplemented Function
QList< int > visitedPages() const
Returns the list of IDs of visited pages, in the order in which the pages were visited.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setPointSize(int)
Sets the point size to pointSize.
void setTitle(const QString &title)
void setButton(WizardButton which, QAbstractButton *button)
Sets the button corresponding to role which to button.
void addField(const QWizardField &field)
WizardButton
This enum specifies the buttons in a wizard.
const int MacLayoutRightMargin
QWizardRuler(QWidget *parent=0)
void resizeEvent(QResizeEvent *event)
Reimplemented Function
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
QAbstractButton * button(WizardButton which) const
Returns the button corresponding to role which.
const QBrush & base() const
Returns the base brush of the current color group.
QWizardDefaultProperty(const char *className, const char *property, const char *changedSignal)
void completeChanged()
This signal is emitted whenever the complete state of the page (i.
static mach_timebase_info_data_t info
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
void setTextFormat(Qt::TextFormat)
const Key key(const T &value) const
Returns the first key with value value.
void setWordWrap(bool on)
void setWizardStyle(WizardStyle style)
QPointer< QWidget > widget
QSize size() const
Returns the size of the pixmap.
virtual int nextId() const
This virtual function is called by QWizard::nextId() to find out which page to show when the user cli...
void setDefaultProperty(const char *className, const char *property, const char *changedSignal)
Sets the default property for className to be property, and the associated change signal to be change...
static void changeSpacerSize(QLayout *layout, int index, int width, int height)
const char * changedSignal
bool winEvent(MSG *message, long *result)
Reimplemented Function
#define it(className, varName)
void setButtonLayout(const QWizard::WizardButton *array, int size)
The QDialog class is the base class of dialog windows.
void setText(const QString &)
void setField(const QString &name, const QVariant &value)
Sets the value of the field called name to value.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
static VistaState vistaState()
The QWizardPage class is the base class for wizard pages.
WizardStyle wizardStyle() const
void removeFieldAt(int index)
void _q_emitCustomButtonClicked()
Qt::TextFormat subTitleFmt
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)
const int NFallbackDefaultProperties
QMap< int, QWizardPage * > PageMap
const_iterator constEnd() const
The QByteArray class provides an array of bytes.
void pageAdded(int id)
This signal is emitted whenever a page is added to the wizard.
void chop(int n)
Removes n characters from the end of the string.
void done(int result)
Reimplemented Function
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
virtual bool validatePage()
This virtual function is called by QWizard::validateCurrentPage() when the user clicks Next or Finish...
virtual bool isComplete() const
This virtual function is called by QWizard to determine whether the Next or Finish button should be e...
QPixmap pixmap(QWizard::WizardPixmap which) const
Returns the pixmap set for role which.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
void cleanupPagesNotInHistory()
void resolve(const QVector< QWizardDefaultProperty > &defaultPropertyTable)
QVector< QWizardField > fields
virtual Qt::Orientations expandingDirections() const =0
Returns whether this layout item can make use of more space than sizeHint().
static QWidget * iWantTheFocus(QWidget *ancestor)
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
void setOption(WizardOption option, bool on=true)
Sets the given option to be enabled if on is true; otherwise, clears the given option.
bool operator==(const QWizardLayoutInfo &other)
QSize sizeHint() const
em>Reimplemented Function
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
const Key & key() const
Returns the current item's key.
int count(const T &t) const
Returns the number of occurrences of value in the list.
QWidget * placeholderWidget1
static QStyle * style()
Returns the application's style object.
virtual void cleanupPage(int id)
This virtual function is called by QWizard to clean up page id just before the user leaves it by clic...
void drawLine(const QLineF &line)
Draws a line defined by line.
Qt::TextFormat subTitleFormat() const
static const WinVersion WindowsVersion
the version of the Windows operating system on which the application is run (Windows only) ...
void connectButton(QWizard::WizardButton which) const
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
void handleAeroStyleChange()
The QObject class is the base class of all Qt objects.
QVariant field(const QString &name) const
Returns the value of the field called name.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
QWidget * sideWidget() const
QWizardAntiFlickerWidget * antiFlickerWidget
QString buttonText(QWizard::WizardButton which) const
Returns the text on button which on this page.
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
virtual void cleanupPage()
This virtual function is called by QWizard::cleanupPage() when the user leaves the page by clicking B...
static QPixmap fromMacCGImageRef(CGImageRef image)
Returns a QPixmap that is equivalent to the given image.
void setPixmap(const QPixmap &)
void setParent(QObject *)
Makes the object a child of parent.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
virtual QSpacerItem * spacerItem()
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
void setObjectName(const QString &name)
void pageRemoved(int id)
This signal is emitted whenever a page is removed from the wizard.
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const
Returns the spacing that should be used between control1 and control2 in a layout.
void setWidth(int w)
Sets the width to the given width.
QList< int > pageIds() const
Returns the list of page IDs.
QWizard::WizardStyle wizStyle
virtual bool validateCurrentPage()
This virtual function is called by QWizard when the user clicks Next or Finish to perform some last-m...
const int MacLayoutBottomMargin
bool isFinalPage() const
This function is called by QWizard to determine whether the Finish button should be shown for this pa...
void setFinalPage(bool finalPage)
Explicitly sets this page to be final if finalPage is true.
QList< QWizard::WizardButton > buttonsCustomLayout
int width() const
Returns the width.
QWizardRuler * bottomRuler
void resizeEvent(QResizeEvent *)
Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setSubTitleFormat(Qt::TextFormat format)
void setCommitPage(bool commitPage)
Sets this page to be a commit page if commitPage is true; otherwise, sets it to be a normal page...
int addPage(QWizardPage *page)
Adds the given page to the wizard, and returns the page's ID.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
QWizard(QWidget *parent=0, Qt::WindowFlags flags=0)
Constructs a wizard with the given parent and window flags.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
bool ensureButton(QWizard::WizardButton which) const
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
const struct @155 fallbackProperties[NFallbackDefaultProperties]
static QPixmap findDefaultBackgroundPixmap()
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
bool event(QEvent *event)
Reimplemented Function
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
bool buttonsHaveCustomLayout
The QSpacerItem class provides blank space in a layout.
void _q_updateCachedCompleteState()
void setButtonText(WizardButton which, const QString &text)
Sets the text on button which to be text.
bool isVistaThemeEnabled(QVistaHelper::VistaState state) const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void _q_maybeEmitCompleteChanged()
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool buttonLayoutContains(QWizard::WizardButton which)
void setSoftKeyRole(SoftKeyRole softKeyRole)
The QLayout class is the base class of geometry managers.
const T value(const Key &key) const
Returns the value associated with the key key.
const T & at(int i) const
Returns the item at index position i in the list.
WizardOption
This enum specifies various options that affect the look and feel of a wizard.
const QBrush & mid() const
Returns the mid brush of the current color group.
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
void setButtonText(QWizard::WizardButton which, const QString &text)
Sets the text on button which to be text on this page.
QHBoxLayout * buttonLayout
QWidget * sideWidget() const
Returns the widget on the left side of the wizard or 0.
QPixmap pixmap(WizardPixmap which) const
Returns the pixmap set for role which.
QString subTitle
the subtitle of the page
void setSideWidget(QWidget *widget)
Sets the given widget to be shown on the left side of the wizard.
SoftKeyRole
This enum describes how an action should be placed in the softkey bar.
QWizardPage * page(int id) const
Returns the page with the given id, or 0 if there is no such page.
QWizardPage * currentPage() const
Returns a pointer to the current page, or 0 if there is no current page (e.g., before the wizard is s...
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
QString buttonText(WizardButton which) const
Returns the text on button which.
const T & at(int idx) const
virtual int nextId() const
This virtual function is called by QWizard to find out which page to show when the user clicks the Ne...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
bool hasVisitedPage(int id) const
Returns true if the page history contains page id; otherwise, returns false.
QMap< int, QString > buttonCustomTexts
QWatermarkLabel * watermarkLabel
int heightForWidth(int) const
Reimplemented Function
void back()
Goes back to the previous page.
QVector< QWizardField > pendingFields
QMap< QString, int > fieldIndexMap
const T & at(int i) const
Returns the item at index position i in the vector.
QWatermarkLabel(QWidget *parent, QWidget *sideWidget)
const int ModernHeaderTopMargin
void setButtonLayout(const QList< WizardButton > &layout)
Sets the order in which buttons are displayed to layout, where layout is a list of WizardButton...
bool qt_wince_is_mobile()
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
virtual void done(int)
Closes the dialog and sets its result code to r.
const char * constData() const
Returns a pointer to the data stored in the byte array.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool isNull() const
Returns true if this string is null; otherwise returns false.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
void setTitleFormat(Qt::TextFormat format)
const int MacLayoutLeftMargin
bool vistaDisabled() const
void updateMinMaxSizes(const QWizardLayoutInfo &info)
The QMap::const_iterator class provides an STL-style const iterator for QMap and QMultiMap.
QVistaHelper::VistaState vistaState
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
void next()
Advances to the next page.
bool inHandleAeroStyleChange
virtual void initializePage(int id)
This virtual function is called by QWizard to prepare page id just before it is shown either as a res...
#define Q_DECLARE_PUBLIC(Class)
The QDateTime class provides date and time functions.
bool isVistaThemeEnabled() const
QVariant field(const QString &name) const
Returns the value of the field called name.
void setField(const QString &name, const QVariant &value)
Sets the value of the field called name to value.
The QFont class specifies a font used for drawing text.
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
static QString object_name_for_button(QWizard::WizardButton which)
void findProperty(const QWizardDefaultProperty *properties, int propertyCount)
const QSize & size() const
Returns the new size of the widget.
virtual QLayout * layout()
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned.
bool testOption(WizardOption option) const
Returns true if the given option is enabled; otherwise, returns false.
~QWizard()
Destroys the wizard and its pages, releasing any allocated resources.
void setSideWidget(QWidget *widget)
void setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap)
Sets the pixmap for role which to pixmap.
QVBoxLayout * pageVBoxLayout
QObject * parent() const
Returns a pointer to the parent object.
WizardStyle
This enum specifies the different looks supported by QWizard.
iterator erase(iterator begin, iterator end)
Removes all the items from begin up to (but not including) end.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
The QGridLayout class lays out widgets in a grid.
QWizard::WizardOptions opts
void setOptions(WizardOptions options)
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
bool event(QEvent *e)
Reimplemented Function
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
QWizardPage(QWidget *parent=0)
Constructs a wizard page with the given parent.
QString title
the title of the page
int height() const
Returns the height.
if(void) toggleToolbarShown
QVistaHelper * vistaHelper
QWizardHeader * headerWidget
void switchToPage(int newId, Direction direction)
const T & value() const
Returns the current item's value.
const_iterator constBegin() const
The QLabel widget provides a text or image display.
#define QT_NO_STYLE_WINDOWSVISTA
QWizardLayoutInfo layoutInfo
static int oldButton(int button)
static const char *const buttonSlots[QWizard::NStandardButtons]
The QHBoxLayout class lines up widgets horizontally.
static const QCssKnownValue properties[NumProperties - 1]
The QLineEdit widget is a one-line text editor.
bool operator!=(const QWizardLayoutInfo &other)
QVariant property(const char *name) const
Returns the value of the object's name property.
The QPixmap class is an off-screen image representation that can be used as a paint device...
QSize totalMinimumSize() const
Also takes contentsMargins and menu bar into account.
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
void setPixmap(WizardPixmap which, const QPixmap &pixmap)
Sets the pixmap for role which to pixmap.
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
WizardOptions options() const
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
int height() const
Returns the height of the pixmap.
void recreateLayout(const QWizardLayoutInfo &info)
int pointSize() const
Returns the point size of the font.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QSize class defines the size of a two-dimensional object using integer point precision.
int qstrcmp(const QByteArray &str1, const char *str2)
const T * constData() const
Returns a const pointer to the data stored in the vector.
bool cachedIsComplete() const
The QVBoxLayout class lines up widgets vertically.
bool isCommitPage() const
Returns true if this page is a commit page; otherwise returns false.
QSize sizeHint() const
Reimplemented Function
QWizard * wizard() const
Returns the wizard associated with this page, or 0 if this page hasn't been inserted into a QWizard y...
void updatePixmap(QWizard::WizardPixmap which)
void updateButtonLayout()
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
void removePage(int id)
Removes the page with the given id.
QWizard::WizardStyle wizStyle
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
The QPaintEvent class contains event parameters for paint events.
static const KeyPair *const end
Qt::TextFormat titleFormat() const
QWidget * placeholderWidget2
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
#define qPrintable(string)
The QFrame class is the base class of widgets that can have a frame.
QString & insert(int i, QChar c)
void setVisible(bool visible)
Reimplemented Function
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
bool operator==(QBool b1, bool b2)
virtual void initializePage()
This virtual function is called by QWizard::initializePage() to prepare the page just before it is sh...
void _q_updateButtonStates()
void setAlignment(Qt::Alignment)
Without this function, a call to e.
void changeSize(int w, int h, QSizePolicy::Policy hData=QSizePolicy::Minimum, QSizePolicy::Policy vData=QSizePolicy::Minimum)
Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hPolic...
WizardPixmap
This enum specifies the pixmaps that can be associated with a page.
void setStyle(QStyle *style)
QMap< int, QString > buttonCustomTexts
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
const int GapBetweenLogoAndRightEdge
QSize minimumSizeHint() const
The QAction class provides an abstract user interface action that can be inserted into widgets...
static bool objectInheritsXAndXIsCloserThanY(const QObject *object, const QByteArray &classX, const QByteArray &classY)
void _q_handleFieldObjectDestroyed(QObject *)
const int MacButtonTopMargin
void setPage(int id, QWizardPage *page)
Adds the given page to the wizard with the given id.
static bool isNull(const QVariant::Private *d)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
The QWizard class provides a framework for wizards.
void setVisible(bool visible)
Reimplemented Function
void setSubTitle(const QString &subTitle)
QVector< QWizardDefaultProperty > defaultPropertyTable
Qt::LayoutDirection direction
void registerField(const QString &name, QWidget *widget, const char *property=0, const char *changedSignal=0)
Creates a field called name associated with the given property of the given widget.
QWizardLayoutInfo layoutInfoForCurrentPage()
The QPalette class contains color groups for each widget state.