Qt 4.8
qwizard.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 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_WS_WINCE
73 extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
74 #endif
75 
76 #include <string.h> // for memset()
77 
78 #ifdef QT_SOFTKEYS_ENABLED
79 #include "qaction.h"
80 #endif
81 
83 
84 // These fudge terms were needed a few places to obtain pixel-perfect results
86 const int ModernHeaderTopMargin = 2;
87 const int ClassicHMargin = 4;
88 const int MacButtonTopMargin = 13;
89 const int MacLayoutLeftMargin = 20;
90 //const int MacLayoutTopMargin = 14; // Unused. Save some space and avoid warning.
91 const int MacLayoutRightMargin = 20;
92 const int MacLayoutBottomMargin = 17;
93 
94 static void changeSpacerSize(QLayout *layout, int index, int width, int height)
95 {
96  QSpacerItem *spacer = layout->itemAt(index)->spacerItem();
97  if (!spacer)
98  return;
99  spacer->changeSize(width, height);
100 }
101 
102 static QWidget *iWantTheFocus(QWidget *ancestor)
103 {
104  const int MaxIterations = 100;
105 
106  QWidget *candidate = ancestor;
107  for (int i = 0; i < MaxIterations; ++i) {
108  candidate = candidate->nextInFocusChain();
109  if (!candidate)
110  break;
111 
112  if (candidate->focusPolicy() & Qt::TabFocus) {
113  if (candidate != ancestor && ancestor->isAncestorOf(candidate))
114  return candidate;
115  }
116  }
117  return 0;
118 }
119 
120 static bool objectInheritsXAndXIsCloserThanY(const QObject *object, const QByteArray &classX,
121  const QByteArray &classY)
122 {
123  const QMetaObject *metaObject = object->metaObject();
124  while (metaObject) {
125  if (metaObject->className() == classX)
126  return true;
127  if (metaObject->className() == classY)
128  return false;
129  metaObject = metaObject->superClass();
130  }
131  return false;
132 }
133 
135 
136 const struct {
137  const char *className;
138  const char *property;
139  const char *changedSignal;
141  // If you modify this list, make sure to update the documentation (and the auto test)
142  { "QAbstractButton", "checked", SIGNAL(toggled(bool)) },
143  { "QAbstractSlider", "value", SIGNAL(valueChanged(int)) },
144  { "QComboBox", "currentIndex", SIGNAL(currentIndexChanged(int)) },
145  { "QDateTimeEdit", "dateTime", SIGNAL(dateTimeChanged(QDateTime)) },
146  { "QLineEdit", "text", SIGNAL(textChanged(QString)) },
147  { "QListWidget", "currentRow", SIGNAL(currentRowChanged(int)) },
148  { "QSpinBox", "value", SIGNAL(valueChanged(int)) }
149 };
150 
152 {
153 public:
157 
159  inline QWizardDefaultProperty(const char *className, const char *property,
160  const char *changedSignal)
161  : className(className), property(property), changedSignal(changedSignal) {}
162 };
163 
165 {
166 public:
167  inline QWizardField() {}
168  QWizardField(QWizardPage *page, const QString &spec, QObject *object, const char *property,
169  const char *changedSignal);
170 
171  void resolve(const QVector<QWizardDefaultProperty> &defaultPropertyTable);
172  void findProperty(const QWizardDefaultProperty *properties, int propertyCount);
173 
176  bool mandatory;
181 };
182 
184  const char *property, const char *changedSignal)
185  : page(page), name(spec), mandatory(false), object(object), property(property),
186  changedSignal(changedSignal)
187 {
188  if (name.endsWith(QLatin1Char('*'))) {
189  name.chop(1);
190  mandatory = true;
191  }
192 }
193 
195 {
196  if (property.isEmpty())
197  findProperty(defaultPropertyTable.constData(), defaultPropertyTable.count());
198  initialValue = object->property(property);
199 }
200 
202 {
204 
205  for (int i = 0; i < propertyCount; ++i) {
206  if (objectInheritsXAndXIsCloserThanY(object, properties[i].className, className)) {
207  className = properties[i].className;
208  property = properties[i].property;
209  changedSignal = properties[i].changedSignal;
210  }
211  }
212 }
213 
215 {
216 public:
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) {}
223 
232  int hspacing;
233  int vspacing;
236  bool header;
237  bool watermark;
238  bool title;
239  bool subTitle;
240  bool extension;
242 
243  bool operator==(const QWizardLayoutInfo &other);
244  inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); }
245 };
246 
248 {
249  return topLevelMarginLeft == other.topLevelMarginLeft
250  && topLevelMarginRight == other.topLevelMarginRight
251  && topLevelMarginTop == other.topLevelMarginTop
252  && topLevelMarginBottom == other.topLevelMarginBottom
253  && childMarginLeft == other.childMarginLeft
254  && childMarginRight == other.childMarginRight
255  && childMarginTop == other.childMarginTop
256  && childMarginBottom == other.childMarginBottom
257  && hspacing == other.hspacing
258  && vspacing == other.vspacing
259  && buttonSpacing == other.buttonSpacing
260  && wizStyle == other.wizStyle
261  && header == other.header
262  && watermark == other.watermark
263  && title == other.title
264  && subTitle == other.subTitle
265  && extension == other.extension
266  && sideWidget == other.sideWidget;
267 }
268 
269 class QWizardHeader : public QWidget
270 {
271 public:
272  enum RulerType { Ruler };
273 
274  inline QWizardHeader(RulerType /* ruler */, QWidget *parent = 0)
275  : QWidget(parent) { setFixedHeight(2); }
276  QWizardHeader(QWidget *parent = 0);
277 
278  void setup(const QWizardLayoutInfo &info, const QString &title,
279  const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
280  Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat);
281 
282 protected:
283  void paintEvent(QPaintEvent *event);
284 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
285 private:
286  bool vistaDisabled() const;
287 #endif
288 private:
294 };
295 
297  : QWidget(parent)
298 {
301 
302  titleLabel = new QLabel(this);
304 
305  subTitleLabel = new QLabel(this);
307  subTitleLabel->setWordWrap(true);
308 
309  logoLabel = new QLabel(this);
310 
311  QFont font = titleLabel->font();
312  font.setBold(true);
313  titleLabel->setFont(font);
314 
315  layout = new QGridLayout(this);
316  layout->setMargin(0);
317  layout->setSpacing(0);
318 
319  layout->setRowMinimumHeight(3, 1);
320  layout->setRowStretch(4, 1);
321 
322  layout->setColumnStretch(2, 1);
323  layout->setColumnMinimumWidth(4, 2 * GapBetweenLogoAndRightEdge);
324  layout->setColumnMinimumWidth(6, GapBetweenLogoAndRightEdge);
325 
326  layout->addWidget(titleLabel, 2, 1, 1, 2);
328  layout->addWidget(logoLabel, 1, 5, 5, 1);
329 }
330 
331 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
333 {
334  bool styleDisabled = false;
336  if (wiz) {
337  // Designer dosen't support the Vista style for Wizards. This property is used to turn
338  // off the Vista style.
339  const QVariant v = wiz->property("_q_wizard_vista_off");
340  styleDisabled = v.isValid() && v.toBool();
341  }
342  return styleDisabled;
343 }
344 #endif
345 
347  const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
348  Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat)
349 {
350  bool modern = ((info.wizStyle == QWizard::ModernStyle)
351 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
352  || ((info.wizStyle == QWizard::AeroStyle
354 #endif
355  );
356 
357  layout->setRowMinimumHeight(0, modern ? ModernHeaderTopMargin : 0);
358  layout->setRowMinimumHeight(1, modern ? info.topLevelMarginTop - ModernHeaderTopMargin - 1 : 0);
359  layout->setRowMinimumHeight(6, (modern ? 3 : GapBetweenLogoAndRightEdge) + 2);
360 
361  int minColumnWidth0 = modern ? info.topLevelMarginLeft + info.topLevelMarginRight : 0;
362  int minColumnWidth1 = modern ? info.topLevelMarginLeft + info.topLevelMarginRight + 1
364  layout->setColumnMinimumWidth(0, minColumnWidth0);
365  layout->setColumnMinimumWidth(1, minColumnWidth1);
366 
367  titleLabel->setTextFormat(titleFormat);
368  titleLabel->setText(title);
369  logoLabel->setPixmap(logo);
370 
371  subTitleLabel->setTextFormat(subTitleFormat);
372  subTitleLabel->setText(QLatin1String("Pq\nPq"));
373  int desiredSubTitleHeight = subTitleLabel->sizeHint().height();
374  subTitleLabel->setText(subTitle);
375 
376  if (modern) {
377  bannerPixmap = banner;
378  } else {
379  bannerPixmap = QPixmap();
380  }
381 
382  if (bannerPixmap.isNull()) {
383  /*
384  There is no widthForHeight() function, so we simulate it with a loop.
385  */
386  int candidateSubTitleWidth = qMin(512, 2 * QApplication::desktop()->width() / 3);
387  int delta = candidateSubTitleWidth >> 1;
388  while (delta > 0) {
389  if (subTitleLabel->heightForWidth(candidateSubTitleWidth - delta)
390  <= desiredSubTitleHeight)
391  candidateSubTitleWidth -= delta;
392  delta >>= 1;
393  }
394 
395  subTitleLabel->setMinimumSize(candidateSubTitleWidth, desiredSubTitleHeight);
396 
398  setMinimumSize(size);
400  } else {
402  setFixedSize(banner.size() + QSize(0, 2));
403  }
404  updateGeometry();
405 }
406 
408 {
409  QPainter painter(this);
410  painter.drawPixmap(0, 0, bannerPixmap);
411 
412  int x = width() - 2;
413  int y = height() - 2;
414  const QPalette &pal = palette();
415  painter.setPen(pal.mid().color());
416  painter.drawLine(0, y, x, y);
417  painter.setPen(pal.base().color());
418  painter.drawPoint(x + 1, y);
419  painter.drawLine(0, y + 1, x + 1, y + 1);
420 }
421 
422 // We save one vtable by basing QWizardRuler on QWizardHeader
424 {
425 public:
427  : QWizardHeader(Ruler, parent) {}
428 };
429 
430 class QWatermarkLabel : public QLabel
431 {
432 public:
433  QWatermarkLabel(QWidget *parent, QWidget *sideWidget) : QLabel(parent), m_sideWidget(sideWidget) {
434  m_layout = new QVBoxLayout(this);
435  if (m_sideWidget)
436  m_layout->addWidget(m_sideWidget);
437  }
438 
440  if (!pixmap() && !pixmap()->isNull())
441  return pixmap()->size();
442  return QFrame::minimumSizeHint();
443  }
444 
446  if (m_sideWidget == widget)
447  return;
448  if (m_sideWidget) {
449  m_layout->removeWidget(m_sideWidget);
450  m_sideWidget->hide();
451  }
452  m_sideWidget = widget;
453  if (m_sideWidget)
454  m_layout->addWidget(m_sideWidget);
455  }
456  QWidget *sideWidget() const {
457  return m_sideWidget;
458  }
459 private:
462 };
463 
465 {
467 
468 public:
469  enum TriState { Tri_Unknown = -1, Tri_False, Tri_True };
470 
472  : wizard(0), completeState(Tri_Unknown), explicitlyFinal(false), commit(false) {}
473 
474  bool cachedIsComplete() const;
475  void _q_maybeEmitCompleteChanged();
476  void _q_updateCachedCompleteState();
477 
485  bool commit;
487 };
488 
490 {
491  Q_Q(const QWizardPage);
492  if (completeState == Tri_Unknown)
493  completeState = q->isComplete() ? Tri_True : Tri_False;
494  return completeState == Tri_True;
495 }
496 
498 {
499  Q_Q(QWizardPage);
500  TriState newState = q->isComplete() ? Tri_True : Tri_False;
501  if (newState != completeState)
502  emit q->completeChanged();
503 }
504 
506 {
507  Q_Q(QWizardPage);
508  completeState = q->isComplete() ? Tri_True : Tri_False;
509 }
510 
512 {
515 public:
517  : QWidget(wizard)
518  , wizard(wizard)
519  , wizardPrivate(wizardPrivate) {}
520 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
521 protected:
522  void paintEvent(QPaintEvent *);
523 #endif
524 };
525 
527 {
529 
530 public:
532 
533  enum Direction {
535  Forward
536  };
537 
538  inline QWizardPrivate()
539  : start(-1)
540  , startSetByUser(false)
541  , current(-1)
542  , canContinue(false)
543  , canFinish(false)
544  , disableUpdatesCount(0)
545  , opts(0)
546  , buttonsHaveCustomLayout(false)
547  , titleFmt(Qt::AutoText)
548  , subTitleFmt(Qt::AutoText)
549  , placeholderWidget1(0)
550  , placeholderWidget2(0)
551  , headerWidget(0)
552  , watermarkLabel(0)
553  , sideWidget(0)
554  , titleLabel(0)
555  , subTitleLabel(0)
556  , bottomRuler(0)
557 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
558  , vistaInitPending(false)
559  , vistaState(QVistaHelper::Dirty)
560  , vistaStateChanged(false)
561  , inHandleAeroStyleChange(false)
562 #endif
563  , minimumWidth(0)
564  , minimumHeight(0)
567  {
568  for (int i = 0; i < QWizard::NButtons; ++i) {
569  btns[i] = 0;
570 #ifdef QT_SOFTKEYS_ENABLED
571  softKeys[i] = 0;
572 #endif
573  }
574 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
576  vistaInitPending = true;
577 #endif
578  }
579 
580  void init();
581  void reset();
582  void cleanupPagesNotInHistory();
583  void addField(const QWizardField &field);
584  void removeFieldAt(int index);
585  void switchToPage(int newId, Direction direction);
586  QWizardLayoutInfo layoutInfoForCurrentPage();
587  void recreateLayout(const QWizardLayoutInfo &info);
588  void updateLayout();
589  void updateMinMaxSizes(const QWizardLayoutInfo &info);
590  void updateCurrentPage();
591  bool ensureButton(QWizard::WizardButton which) const;
592  void connectButton(QWizard::WizardButton which) const;
593  void updateButtonTexts();
594  void updateButtonLayout();
595  void setButtonLayout(const QWizard::WizardButton *array, int size);
596  bool buttonLayoutContains(QWizard::WizardButton which);
597  void updatePixmap(QWizard::WizardPixmap which);
598 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
599  bool vistaDisabled() const;
600  bool isVistaThemeEnabled(QVistaHelper::VistaState state) const;
601  void handleAeroStyleChange();
602 #endif
603  bool isVistaThemeEnabled() const;
604  void disableUpdates();
605  void enableUpdates();
606  void _q_emitCustomButtonClicked();
607  void _q_updateButtonStates();
608  void _q_handleFieldObjectDestroyed(QObject *);
609  void setStyle(QStyle *style);
610 #ifdef Q_WS_MAC
611  static QPixmap findDefaultBackgroundPixmap();
612 #endif
613 
614  PageMap pageMap;
619  QSet<int> initialized; // ### remove and move bit to QWizardPage?
620  int start;
622  int current;
624  bool canFinish;
627 
629  QWizard::WizardOptions opts;
635  mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
636 
637  union {
638  // keep in sync with QWizard::WizardButton
639  mutable struct {
646  } btn;
648  };
659 #ifdef QT_SOFTKEYS_ENABLED
660  mutable QAction *softKeys[QWizard::NButtons];
661 #endif
662 
666 
667 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
673 #endif
678 };
679 
680 static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)
681 {
682 #if defined(QT_NO_STYLE_WINDOWSVISTA)
683  Q_UNUSED(wizardPrivate);
684 #endif
685  const bool macStyle = (wstyle == QWizard::MacStyle);
686  switch (which) {
687  case QWizard::BackButton:
688  return macStyle ? QWizard::tr("Go Back") : QWizard::tr("< &Back");
689  case QWizard::NextButton:
690  if (macStyle)
691  return QWizard::tr("Continue");
692  else
693  return wizardPrivate->isVistaThemeEnabled()
694  ? QWizard::tr("&Next") : QWizard::tr("&Next >");
696  return QWizard::tr("Commit");
698  return macStyle ? QWizard::tr("Done") : QWizard::tr("&Finish");
700  return QWizard::tr("Cancel");
701  case QWizard::HelpButton:
702  return macStyle ? QWizard::tr("Help") : QWizard::tr("&Help");
703  default:
704  return QString();
705  }
706 }
707 
709 {
710  Q_Q(QWizard);
711 
712  antiFlickerWidget = new QWizardAntiFlickerWidget(q, this);
713  wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q));
714  if (wizStyle == QWizard::MacStyle) {
716  } else if (wizStyle == QWizard::ModernStyle) {
718  }
719 
720 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
721  vistaHelper = new QVistaHelper(q);
722 #endif
723 
724  // create these buttons right away; create the other buttons as necessary
725  ensureButton(QWizard::BackButton);
726  ensureButton(QWizard::NextButton);
727  ensureButton(QWizard::CommitButton);
728  ensureButton(QWizard::FinishButton);
729 
730  pageFrame = new QFrame(antiFlickerWidget);
731  pageFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
732 
733  pageVBoxLayout = new QVBoxLayout(pageFrame);
734  pageVBoxLayout->setSpacing(0);
735  pageVBoxLayout->addSpacing(0);
737  pageVBoxLayout->addItem(spacerItem);
738 
739  buttonLayout = new QHBoxLayout;
740  mainLayout = new QGridLayout(antiFlickerWidget);
741  mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
742 
743  updateButtonLayout();
744 
745  for (int i = 0; i < NFallbackDefaultProperties; ++i)
746  defaultPropertyTable.append(QWizardDefaultProperty(fallbackProperties[i].className,
749 }
750 
752 {
753  Q_Q(QWizard);
754  if (current != -1) {
755  q->currentPage()->hide();
756  cleanupPagesNotInHistory();
757  for (int i = history.count() - 1; i >= 0; --i)
758  q->cleanupPage(history.at(i));
759  history.clear();
760  initialized.clear();
761 
762  current = -1;
763  emit q->currentIdChanged(-1);
764  }
765 }
766 
768 {
769  Q_Q(QWizard);
770 
771  const QSet<int> original = initialized;
772  QSet<int>::const_iterator i = original.constBegin();
774 
775  for (; i != end; ++i) {
776  if (!history.contains(*i)) {
777  q->cleanupPage(*i);
778  initialized.remove(*i);
779  }
780  }
781 }
782 
784 {
785  Q_Q(QWizard);
786 
787  QWizardField myField = field;
788  myField.resolve(defaultPropertyTable);
789 
790  if (fieldIndexMap.contains(myField.name)) {
791  qWarning("QWizardPage::addField: Duplicate field '%s'", qPrintable(myField.name));
792  return;
793  }
794 
795  fieldIndexMap.insert(myField.name, fields.count());
796  fields += myField;
797  if (myField.mandatory && !myField.changedSignal.isEmpty())
798  QObject::connect(myField.object, myField.changedSignal,
799  myField.page, SLOT(_q_maybeEmitCompleteChanged()));
801  myField.object, SIGNAL(destroyed(QObject*)), q,
802  SLOT(_q_handleFieldObjectDestroyed(QObject*)));
803 }
804 
806 {
807  Q_Q(QWizard);
808 
809  const QWizardField &field = fields.at(index);
810  fieldIndexMap.remove(field.name);
811  if (field.mandatory && !field.changedSignal.isEmpty())
813  field.page, SLOT(_q_maybeEmitCompleteChanged()));
815  field.object, SIGNAL(destroyed(QObject*)), q,
816  SLOT(_q_handleFieldObjectDestroyed(QObject*)));
817  fields.remove(index);
818 }
819 
821 {
822  Q_Q(QWizard);
823 
824  disableUpdates();
825 
826  int oldId = current;
827  if (QWizardPage *oldPage = q->currentPage()) {
828  oldPage->hide();
829 
830  if (direction == Backward) {
831  if (!(opts & QWizard::IndependentPages)) {
832  q->cleanupPage(oldId);
833  initialized.remove(oldId);
834  }
835  Q_ASSERT(history.last() == oldId);
836  history.removeLast();
837  Q_ASSERT(history.last() == newId);
838  }
839  }
840 
841  current = newId;
842 
843  QWizardPage *newPage = q->currentPage();
844  if (newPage) {
845  if (direction == Forward) {
846  if (!initialized.contains(current)) {
847  initialized.insert(current);
848  q->initializePage(current);
849  }
850  history.append(current);
851  }
852  newPage->show();
853  }
854 
855  canContinue = (q->nextId() != -1);
856  canFinish = (newPage && newPage->isFinalPage());
857 
858  _q_updateButtonStates();
859  updateButtonTexts();
860 
861  const QWizard::WizardButton nextOrCommit =
862  newPage && newPage->isCommitPage() ? QWizard::CommitButton : QWizard::NextButton;
863  QAbstractButton *nextOrFinishButton =
864  btns[canContinue ? nextOrCommit : QWizard::FinishButton];
865  QWidget *candidate = 0;
866 
867  /*
868  If there is no default button and the Next or Finish button
869  is enabled, give focus directly to it as a convenience to the
870  user. This is the normal case on Mac OS X.
871 
872  Otherwise, give the focus to the new page's first child that
873  can handle it. If there is no such child, give the focus to
874  Next or Finish.
875  */
876  if ((opts & QWizard::NoDefaultButton) && nextOrFinishButton->isEnabled()) {
877  candidate = nextOrFinishButton;
878  } else if (newPage) {
879  candidate = iWantTheFocus(newPage);
880  }
881  if (!candidate)
882  candidate = nextOrFinishButton;
883  candidate->setFocus();
884 
885  if (wizStyle == QWizard::MacStyle)
886  q->updateGeometry();
887 
888  enableUpdates();
889  updateLayout();
890 
891  emit q->currentIdChanged(current);
892 }
893 
894 // keep in sync with QWizard::WizardButton
895 static const char * const buttonSlots[QWizard::NStandardButtons] = {
896  SLOT(back()), SLOT(next()), SLOT(next()), SLOT(accept()), SLOT(reject()),
897  SIGNAL(helpRequested())
898 };
899 
901 {
902  Q_Q(QWizard);
903  QStyle *style = q->style();
904 
906 
907  const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
916  info.hspacing = (layoutHorizontalSpacing == -1)
918  : layoutHorizontalSpacing;
920  info.buttonSpacing = (layoutHorizontalSpacing == -1)
922  : layoutHorizontalSpacing;
923 
924  if (wizStyle == QWizard::MacStyle)
925  info.buttonSpacing = 12;
926 
927  info.wizStyle = wizStyle;
928  if ((info.wizStyle == QWizard::AeroStyle)
929 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
931 #endif
932  )
934 
935  QString titleText;
936  QString subTitleText;
937  QPixmap backgroundPixmap;
938  QPixmap watermarkPixmap;
939 
940  if (QWizardPage *page = q->currentPage()) {
941  titleText = page->title();
942  subTitleText = page->subTitle();
943  backgroundPixmap = page->pixmap(QWizard::BackgroundPixmap);
944  watermarkPixmap = page->pixmap(QWizard::WatermarkPixmap);
945  }
946 
948  && !(opts & QWizard::IgnoreSubTitles) && !subTitleText.isEmpty();
949  info.sideWidget = sideWidget;
950  info.watermark = (info.wizStyle != QWizard::MacStyle) && (info.wizStyle != QWizard::AeroStyle)
951  && !watermarkPixmap.isNull();
952  info.title = !info.header && !titleText.isEmpty();
953  info.subTitle = !(opts & QWizard::IgnoreSubTitles) && !info.header && !subTitleText.isEmpty();
954  info.extension = (info.watermark || info.sideWidget) && (opts & QWizard::ExtendedWatermarkPixmap);
955 
956  return info;
957 }
958 
960 {
961  Q_Q(QWizard);
962 
963  /*
964  Start by undoing the main layout.
965  */
966  for (int i = mainLayout->count() - 1; i >= 0; --i) {
967  QLayoutItem *item = mainLayout->takeAt(i);
968  if (item->layout()) {
969  item->layout()->setParent(0);
970  } else {
971  delete item;
972  }
973  }
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);
978 
979  /*
980  Now, recreate it.
981  */
982 
983  bool mac = (info.wizStyle == QWizard::MacStyle);
984  bool classic = (info.wizStyle == QWizard::ClassicStyle);
985  bool modern = (info.wizStyle == QWizard::ModernStyle);
986  bool aero = (info.wizStyle == QWizard::AeroStyle);
987  int deltaMarginLeft = info.topLevelMarginLeft - info.childMarginLeft;
988  int deltaMarginRight = info.topLevelMarginRight - info.childMarginRight;
989  int deltaMarginTop = info.topLevelMarginTop - info.childMarginTop;
990  int deltaMarginBottom = info.topLevelMarginBottom - info.childMarginBottom;
991  int deltaVSpacing = info.topLevelMarginBottom - info.vspacing;
992 
993  int row = 0;
994  int numColumns;
995  if (mac) {
996  numColumns = 3;
997  } else if (info.watermark || info.sideWidget) {
998  numColumns = 2;
999  } else {
1000  numColumns = 1;
1001  }
1002  int pageColumn = qMin(1, numColumns - 1);
1003 
1004  if (mac) {
1005  mainLayout->setMargin(0);
1006  mainLayout->setSpacing(0);
1008  pageVBoxLayout->setMargin(7);
1009  } else {
1010  if (modern) {
1011  mainLayout->setMargin(0);
1012  mainLayout->setSpacing(0);
1013  pageVBoxLayout->setContentsMargins(deltaMarginLeft, deltaMarginTop,
1014  deltaMarginRight, deltaMarginBottom);
1015  buttonLayout->setContentsMargins(info.topLevelMarginLeft, info.topLevelMarginTop,
1017  } else {
1018  mainLayout->setContentsMargins(info.topLevelMarginLeft, info.topLevelMarginTop,
1020  mainLayout->setHorizontalSpacing(info.hspacing);
1021  mainLayout->setVerticalSpacing(info.vspacing);
1022  pageVBoxLayout->setContentsMargins(0, 0, 0, 0);
1023  buttonLayout->setContentsMargins(0, 0, 0, 0);
1024  }
1025  }
1026  buttonLayout->setSpacing(info.buttonSpacing);
1027 
1028  if (info.header) {
1029  if (!headerWidget)
1030  headerWidget = new QWizardHeader(antiFlickerWidget);
1031  headerWidget->setAutoFillBackground(modern);
1032  mainLayout->addWidget(headerWidget, row++, 0, 1, numColumns);
1033  }
1034  if (headerWidget)
1035  headerWidget->setVisible(info.header);
1036 
1037  int watermarkStartRow = row;
1038 
1039  if (mac)
1040  mainLayout->setRowMinimumHeight(row++, 10);
1041 
1042  if (info.title) {
1043  if (!titleLabel) {
1044  titleLabel = new QLabel(antiFlickerWidget);
1046  titleLabel->setWordWrap(true);
1047  }
1048 
1049  QFont titleFont = q->font();
1050  titleFont.setPointSize(titleFont.pointSize() + (mac ? 3 : 4));
1051  titleFont.setBold(true);
1053 
1054  if (aero) {
1055  // ### hardcoded for now:
1056  titleFont = QFont(QLatin1String("Segoe UI"), 12);
1057  QPalette pal(titleLabel->palette());
1058  pal.setColor(QPalette::Text, "#003399");
1059  titleLabel->setPalette(pal);
1060  }
1061 
1062  titleLabel->setFont(titleFont);
1063  const int aeroTitleIndent = 25; // ### hardcoded for now - should be calculated somehow
1064  if (aero)
1065  titleLabel->setIndent(aeroTitleIndent);
1066  else if (mac)
1067  titleLabel->setIndent(2);
1068  else if (classic)
1070  else
1072  if (modern) {
1073  if (!placeholderWidget1) {
1074  placeholderWidget1 = new QWidget(antiFlickerWidget);
1075  placeholderWidget1->setBackgroundRole(QPalette::Base);
1076  }
1077  placeholderWidget1->setFixedHeight(info.topLevelMarginLeft + 2);
1078  mainLayout->addWidget(placeholderWidget1, row++, pageColumn);
1079  }
1080  mainLayout->addWidget(titleLabel, row++, pageColumn);
1081  if (modern) {
1082  if (!placeholderWidget2) {
1083  placeholderWidget2 = new QWidget(antiFlickerWidget);
1084  placeholderWidget2->setBackgroundRole(QPalette::Base);
1085  }
1086  placeholderWidget2->setFixedHeight(5);
1087  mainLayout->addWidget(placeholderWidget2, row++, pageColumn);
1088  }
1089  if (mac)
1090  mainLayout->setRowMinimumHeight(row++, 7);
1091  }
1092  if (placeholderWidget1)
1093  placeholderWidget1->setVisible(info.title && modern);
1094  if (placeholderWidget2)
1095  placeholderWidget2->setVisible(info.title && modern);
1096 
1097  if (info.subTitle) {
1098  if (!subTitleLabel) {
1099  subTitleLabel = new QLabel(pageFrame);
1100  subTitleLabel->setWordWrap(true);
1101 
1103  info.childMarginRight , 0);
1104 
1105  pageVBoxLayout->insertWidget(1, subTitleLabel);
1106  }
1107  }
1108 
1109  // ### try to replace with margin.
1110  changeSpacerSize(pageVBoxLayout, 0, 0, info.subTitle ? info.childMarginLeft : 0);
1111 
1112  int hMargin = mac ? 1 : 0;
1113  int vMargin = hMargin;
1114 
1115  pageFrame->setFrameStyle(mac ? (QFrame::Box | QFrame::Raised) : QFrame::NoFrame);
1116  pageFrame->setLineWidth(0);
1117  pageFrame->setMidLineWidth(hMargin);
1118 
1119  if (info.header) {
1120  if (modern) {
1121  hMargin = info.topLevelMarginLeft;
1122  vMargin = deltaMarginBottom;
1123  } else if (classic) {
1124  hMargin = deltaMarginLeft + ClassicHMargin;
1125  vMargin = 0;
1126  }
1127  }
1128 
1129  if (aero) {
1130  int leftMargin = 18; // ### hardcoded for now - should be calculated somehow
1131  int topMargin = vMargin;
1132  int rightMargin = hMargin; // ### for now
1133  int bottomMargin = vMargin;
1134  pageFrame->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin);
1135  } else {
1136  pageFrame->setContentsMargins(hMargin, vMargin, hMargin, vMargin);
1137  }
1138 
1139  if ((info.watermark || info.sideWidget) && !watermarkLabel) {
1140  watermarkLabel = new QWatermarkLabel(antiFlickerWidget, sideWidget);
1141  watermarkLabel->setBackgroundRole(QPalette::Base);
1142  watermarkLabel->setMinimumHeight(1);
1143  watermarkLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
1144  watermarkLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
1145  }
1146 
1147  //bool wasSemiTransparent = pageFrame->testAttribute(Qt::WA_SetPalette);
1148  const bool wasSemiTransparent =
1149  pageFrame->palette().brush(QPalette::Window).color().alpha() < 255
1150  || pageFrame->palette().brush(QPalette::Base).color().alpha() < 255;
1151  if (mac) {
1152  if (!wasSemiTransparent) {
1153  QPalette pal = pageFrame->palette();
1154  pal.setBrush(QPalette::Window, QColor(255, 255, 255, 153));
1155  // ### The next line is required to ensure visual semitransparency when
1156  // ### switching from ModernStyle to MacStyle. See TAG1 below.
1157  pal.setBrush(QPalette::Base, QColor(255, 255, 255, 153));
1158  pageFrame->setPalette(pal);
1159  pageFrame->setAutoFillBackground(true);
1160  antiFlickerWidget->setAutoFillBackground(false);
1161  }
1162  } else {
1163  if (wasSemiTransparent)
1164  pageFrame->setPalette(QPalette());
1165 
1166  bool baseBackground = (modern && !info.header); // ### TAG1
1167  pageFrame->setBackgroundRole(baseBackground ? QPalette::Base : QPalette::Window);
1168 
1169  if (titleLabel)
1170  titleLabel->setAutoFillBackground(baseBackground);
1171  pageFrame->setAutoFillBackground(baseBackground);
1172  if (watermarkLabel)
1173  watermarkLabel->setAutoFillBackground(baseBackground);
1174  if (placeholderWidget1)
1175  placeholderWidget1->setAutoFillBackground(baseBackground);
1176  if (placeholderWidget2)
1177  placeholderWidget2->setAutoFillBackground(baseBackground);
1178 
1179  if (aero) {
1180  QPalette pal = pageFrame->palette();
1181  pal.setBrush(QPalette::Window, QColor(255, 255, 255));
1182  pageFrame->setPalette(pal);
1183  pageFrame->setAutoFillBackground(true);
1184  pal = antiFlickerWidget->palette();
1185  pal.setBrush(QPalette::Window, QColor(255, 255, 255));
1186  antiFlickerWidget->setPalette(pal);
1187  antiFlickerWidget->setAutoFillBackground(true);
1188  }
1189  }
1190 
1191  mainLayout->addWidget(pageFrame, row++, pageColumn);
1192 
1193  int watermarkEndRow = row;
1194  if (classic)
1195  mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
1196 
1197  if (aero) {
1198  buttonLayout->setContentsMargins(9, 9, 9, 9);
1199  mainLayout->setContentsMargins(0, 11, 0, 0);
1200  }
1201 
1202  int buttonStartColumn = info.extension ? 1 : 0;
1203  int buttonNumColumns = info.extension ? 1 : numColumns;
1204 
1205  if (classic || modern) {
1206  if (!bottomRuler)
1207  bottomRuler = new QWizardRuler(antiFlickerWidget);
1208  mainLayout->addWidget(bottomRuler, row++, buttonStartColumn, 1, buttonNumColumns);
1209  }
1210 
1211  if (classic)
1212  mainLayout->setRowMinimumHeight(row++, deltaVSpacing);
1213 
1214  mainLayout->addLayout(buttonLayout, row++, buttonStartColumn, 1, buttonNumColumns);
1215 
1216  if (info.watermark || info.sideWidget) {
1217  if (info.extension)
1218  watermarkEndRow = row;
1219  mainLayout->addWidget(watermarkLabel, watermarkStartRow, 0,
1220  watermarkEndRow - watermarkStartRow, 1);
1221  }
1222 
1223  mainLayout->setColumnMinimumWidth(0, mac && !info.watermark ? 181 : 0);
1224  if (mac)
1225  mainLayout->setColumnMinimumWidth(2, 21);
1226 
1227  if (headerWidget)
1228  headerWidget->setVisible(info.header);
1229  if (titleLabel)
1230  titleLabel->setVisible(info.title);
1231  if (subTitleLabel)
1233  if (bottomRuler)
1234  bottomRuler->setVisible(classic || modern);
1235  if (watermarkLabel)
1236  watermarkLabel->setVisible(info.watermark || info.sideWidget);
1237 
1238  layoutInfo = info;
1239 }
1240 
1242 {
1243  Q_Q(QWizard);
1244 
1245  disableUpdates();
1246 
1247  QWizardLayoutInfo info = layoutInfoForCurrentPage();
1248  if (layoutInfo != info)
1249  recreateLayout(info);
1250  QWizardPage *page = q->currentPage();
1251 
1252  // If the page can expand vertically, let it stretch "infinitely" more
1253  // than the QSpacerItem at the bottom. Otherwise, let the QSpacerItem
1254  // stretch "infinitely" more than the page. Change the bottom item's
1255  // policy accordingly. The case that the page has no layout is basically
1256  // for Designer, only.
1257  if (page) {
1258  bool expandPage = !page->layout();
1259  if (!expandPage) {
1260  const QLayoutItem *pageItem = pageVBoxLayout->itemAt(pageVBoxLayout->indexOf(page));
1261  expandPage = pageItem->expandingDirections() & Qt::Vertical;
1262  }
1263  QSpacerItem *bottomSpacer = pageVBoxLayout->itemAt(pageVBoxLayout->count() - 1)->spacerItem();
1264  Q_ASSERT(bottomSpacer);
1266  pageVBoxLayout->invalidate();
1267  }
1268 
1269  if (info.header) {
1270  Q_ASSERT(page);
1271  headerWidget->setup(info, page->title(), page->subTitle(),
1273  titleFmt, subTitleFmt);
1274  }
1275 
1276  if (info.watermark || info.sideWidget) {
1277  QPixmap pix;
1278  if (info.watermark) {
1279  if (page)
1280  pix = page->pixmap(QWizard::WatermarkPixmap);
1281  else
1282  pix = q->pixmap(QWizard::WatermarkPixmap);
1283  }
1284  watermarkLabel->setPixmap(pix); // in case there is no watermark and we show the side widget we need to clear the watermark
1285  }
1286 
1287  if (info.title) {
1288  Q_ASSERT(page);
1289  titleLabel->setTextFormat(titleFmt);
1290  titleLabel->setText(page->title());
1291  }
1292  if (info.subTitle) {
1293  Q_ASSERT(page);
1294  subTitleLabel->setTextFormat(subTitleFmt);
1295  subTitleLabel->setText(page->subTitle());
1296  }
1297 
1298  enableUpdates();
1299  updateMinMaxSizes(info);
1300 }
1301 
1303 {
1304  Q_Q(QWizard);
1305 
1306  int extraHeight = 0;
1307 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
1308  if (isVistaThemeEnabled())
1309  extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset();
1310 #endif
1311  QSize minimumSize = mainLayout->totalMinimumSize() + QSize(0, extraHeight);
1312  QSize maximumSize = mainLayout->totalMaximumSize();
1313  if (info.header && headerWidget->maximumWidth() != QWIDGETSIZE_MAX) {
1314  minimumSize.setWidth(headerWidget->maximumWidth());
1315  maximumSize.setWidth(headerWidget->maximumWidth());
1316  }
1317  if (info.watermark && !info.sideWidget) {
1318  minimumSize.setHeight(mainLayout->totalSizeHint().height());
1319  maximumSize.setHeight(mainLayout->totalSizeHint().height());
1320  }
1321  if (q->minimumWidth() == minimumWidth) {
1322  minimumWidth = minimumSize.width();
1323  q->setMinimumWidth(minimumWidth);
1324  }
1325  if (q->minimumHeight() == minimumHeight) {
1326  minimumHeight = minimumSize.height();
1327  q->setMinimumHeight(minimumHeight);
1328  }
1329  if (q->maximumWidth() == maximumWidth) {
1330  maximumWidth = maximumSize.width();
1331  q->setMaximumWidth(maximumWidth);
1332  }
1333  if (q->maximumHeight() == maximumHeight) {
1334  maximumHeight = maximumSize.height();
1335  q->setMaximumHeight(maximumHeight);
1336  }
1337 }
1338 
1340 {
1341  Q_Q(QWizard);
1342  if (q->currentPage()) {
1343  canContinue = (q->nextId() != -1);
1344  canFinish = q->currentPage()->isFinalPage();
1345  } else {
1346  canContinue = false;
1347  canFinish = false;
1348  }
1349  _q_updateButtonStates();
1350  updateButtonTexts();
1351 }
1352 
1354 {
1355  switch (which) {
1356  case QWizard::CommitButton:
1357  return QLatin1String("qt_wizard_") + QLatin1String("commit");
1358  case QWizard::FinishButton:
1359  return QLatin1String("qt_wizard_") + QLatin1String("finish");
1360  case QWizard::CancelButton:
1361  return QLatin1String("qt_wizard_") + QLatin1String("cancel");
1362  case QWizard::BackButton:
1363  case QWizard::NextButton:
1364  case QWizard::HelpButton:
1368  // Make navigation buttons detectable as passive interactor in designer
1369  return QLatin1String("__qt__passive_wizardbutton") + QString::number(which);
1370  case QWizard::Stretch:
1371  case QWizard::NoButton:
1372  //case QWizard::NStandardButtons:
1373  //case QWizard::NButtons:
1374  ;
1375  }
1376  //Q_UNREACHABLE();
1377  return QString();
1378 }
1379 
1381 {
1382  Q_Q(const QWizard);
1383  if (uint(which) >= QWizard::NButtons)
1384  return false;
1385 
1386  if (!btns[which]) {
1387  QPushButton *pushButton = new QPushButton(antiFlickerWidget);
1388  QStyle *style = q->style();
1389  if (style != QApplication::style()) // Propagate style
1390  pushButton->setStyle(style);
1391  pushButton->setObjectName(object_name_for_button(which));
1392 #ifdef Q_WS_MAC
1393  pushButton->setAutoDefault(false);
1394 #endif
1395  pushButton->hide();
1396 #ifdef Q_CC_HPACC
1397  const_cast<QWizardPrivate *>(this)->btns[which] = pushButton;
1398 #else
1399  btns[which] = pushButton;
1400 #endif
1401  if (which < QWizard::NStandardButtons)
1402  pushButton->setText(buttonDefaultText(wizStyle, which, this));
1403 
1404 #ifdef QT_SOFTKEYS_ENABLED
1405  QAction *softKey = new QAction(pushButton->text(), pushButton);
1406  QAction::SoftKeyRole softKeyRole;
1407  switch(which) {
1408  case QWizard::NextButton:
1409  case QWizard::FinishButton:
1410  case QWizard::CancelButton:
1411  softKeyRole = QAction::NegativeSoftKey;
1412  break;
1413  case QWizard::BackButton:
1414  case QWizard::CommitButton:
1415  case QWizard::HelpButton:
1419  default:
1420  softKeyRole = QAction::PositiveSoftKey;
1421  break;
1422  }
1423  softKey->setSoftKeyRole(softKeyRole);
1424  softKeys[which] = softKey;
1425 #endif
1426  connectButton(which);
1427  }
1428  return true;
1429 }
1430 
1432 {
1433  Q_Q(const QWizard);
1434  if (which < QWizard::NStandardButtons) {
1435  QObject::connect(btns[which], SIGNAL(clicked()), q, buttonSlots[which]);
1436  } else {
1437  QObject::connect(btns[which], SIGNAL(clicked()), q, SLOT(_q_emitCustomButtonClicked()));
1438  }
1439 
1440 #ifdef QT_SOFTKEYS_ENABLED
1441  QObject::connect(softKeys[which], SIGNAL(triggered()), btns[which], SIGNAL(clicked()));
1442 #endif
1443 }
1444 
1446 {
1447  Q_Q(QWizard);
1448  for (int i = 0; i < QWizard::NButtons; ++i) {
1449  if (btns[i]) {
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));
1454  else if (i < QWizard::NStandardButtons)
1455  btns[i]->setText(buttonDefaultText(wizStyle, i, this));
1456 #ifdef QT_SOFTKEYS_ENABLED
1457  softKeys[i]->setText(btns[i]->text());
1458 #endif
1459  }
1460  }
1461 }
1462 
1464 {
1465  if (buttonsHaveCustomLayout) {
1466  QVarLengthArray<QWizard::WizardButton> array(buttonsCustomLayout.count());
1467  for (int i = 0; i < buttonsCustomLayout.count(); ++i)
1468  array[i] = buttonsCustomLayout.at(i);
1469  setButtonLayout(array.constData(), array.count());
1470  } else {
1471  // Positions:
1472  // Help Stretch Custom1 Custom2 Custom3 Cancel Back Next Commit Finish Cancel Help
1473 
1474  const int ArraySize = 12;
1475  QWizard::WizardButton array[ArraySize];
1476  memset(array, -1, sizeof(array));
1477  Q_ASSERT(array[0] == QWizard::NoButton);
1478 
1479  if (opts & QWizard::HaveHelpButton) {
1480  int i = (opts & QWizard::HelpButtonOnRight) ? 11 : 0;
1481  array[i] = QWizard::HelpButton;
1482  }
1483  array[1] = QWizard::Stretch;
1484  if (opts & QWizard::HaveCustomButton1)
1485  array[2] = QWizard::CustomButton1;
1486  if (opts & QWizard::HaveCustomButton2)
1487  array[3] = QWizard::CustomButton2;
1488  if (opts & QWizard::HaveCustomButton3)
1489  array[4] = QWizard::CustomButton3;
1490 
1491  if (!(opts & QWizard::NoCancelButton)) {
1492  int i = (opts & QWizard::CancelButtonOnLeft) ? 5 : 10;
1493  array[i] = QWizard::CancelButton;
1494  }
1495  array[6] = QWizard::BackButton;
1496  array[7] = QWizard::NextButton;
1497  array[8] = QWizard::CommitButton;
1498  array[9] = QWizard::FinishButton;
1499 
1500  setButtonLayout(array, ArraySize);
1501  }
1502 }
1503 
1505 {
1506  QWidget *prev = pageFrame;
1507 
1508  for (int i = buttonLayout->count() - 1; i >= 0; --i) {
1509  QLayoutItem *item = buttonLayout->takeAt(i);
1510  if (QWidget *widget = item->widget())
1511  widget->hide();
1512  delete item;
1513  }
1514 
1515  for (int i = 0; i < size; ++i) {
1516  QWizard::WizardButton which = array[i];
1517  if (which == QWizard::Stretch) {
1518  buttonLayout->addStretch(1);
1519  } else if (which != QWizard::NoButton) {
1520  ensureButton(which);
1521  buttonLayout->addWidget(btns[which]);
1522 
1523  // Back, Next, Commit, and Finish are handled in _q_updateButtonStates()
1524  if (which != QWizard::BackButton && which != QWizard::NextButton
1525  && which != QWizard::CommitButton && which != QWizard::FinishButton)
1526  btns[which]->show();
1527 
1528  if (prev)
1529  QWidget::setTabOrder(prev, btns[which]);
1530  prev = btns[which];
1531  }
1532  }
1533 
1534  _q_updateButtonStates();
1535 }
1536 
1538 {
1539  return !buttonsHaveCustomLayout || buttonsCustomLayout.contains(which);
1540 }
1541 
1543 {
1544  Q_Q(QWizard);
1545  if (which == QWizard::BackgroundPixmap) {
1546  if (wizStyle == QWizard::MacStyle) {
1547  q->update();
1548  q->updateGeometry();
1549  }
1550  } else {
1551  updateLayout();
1552  }
1553 }
1554 
1555 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
1557 {
1558  Q_Q(const QWizard);
1559  const QVariant v = q->property("_q_wizard_vista_off");
1560  return v.isValid() && v.toBool();
1561 }
1562 
1564 {
1565  return wizStyle == QWizard::AeroStyle
1566  && QVistaHelper::vistaState() == state
1567  && !vistaDisabled();
1568 }
1569 
1571 {
1572  Q_Q(QWizard);
1573 
1574  if (inHandleAeroStyleChange)
1575  return; // prevent recursion
1576  inHandleAeroStyleChange = true;
1577 
1578  vistaHelper->disconnectBackButton();
1579  q->removeEventFilter(vistaHelper);
1580 
1581  if (isVistaThemeEnabled()) {
1582  if (isVistaThemeEnabled(QVistaHelper::VistaAero)) {
1583  vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
1584  q->installEventFilter(vistaHelper);
1585  q->setMouseTracking(true);
1586  antiFlickerWidget->move(0, vistaHelper->titleBarSize() + vistaHelper->topOffset());
1587  vistaHelper->backButton()->move(
1588  0, vistaHelper->topOffset() // ### should ideally work without the '+ 1'
1589  - qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1));
1590  } else {
1591  vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
1592  q->setMouseTracking(true);
1593  antiFlickerWidget->move(0, vistaHelper->topOffset());
1594  vistaHelper->backButton()->move(0, -1); // ### should ideally work with (0, 0)
1595  }
1596  vistaHelper->setTitleBarIconAndCaptionVisible(false);
1598  vistaHelper->backButton(), SIGNAL(clicked()), q, buttonSlots[QWizard::BackButton]);
1599  vistaHelper->backButton()->show();
1600  } else {
1601  q->setMouseTracking(true); // ### original value possibly different
1602 #ifndef QT_NO_CURSOR
1603  q->unsetCursor(); // ### ditto
1604 #endif
1605  antiFlickerWidget->move(0, 0);
1606  vistaHelper->hideBackButton();
1607  vistaHelper->setTitleBarIconAndCaptionVisible(true);
1608  }
1609 
1610  _q_updateButtonStates();
1611 
1612  if (q->isVisible())
1613  vistaHelper->setWindowPosHack();
1614 
1615  inHandleAeroStyleChange = false;
1616 }
1617 #endif
1618 
1620 {
1621 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
1622  return isVistaThemeEnabled(QVistaHelper::VistaAero)
1623  || isVistaThemeEnabled(QVistaHelper::VistaBasic);
1624 #else
1625  return false;
1626 #endif
1627 }
1628 
1630 {
1631  Q_Q(QWizard);
1632  if (disableUpdatesCount++ == 0) {
1633  q->setUpdatesEnabled(false);
1634  antiFlickerWidget->hide();
1635  }
1636 }
1637 
1639 {
1640  Q_Q(QWizard);
1641  if (--disableUpdatesCount == 0) {
1642  antiFlickerWidget->show();
1643  q->setUpdatesEnabled(true);
1644  }
1645 }
1646 
1648 {
1649  Q_Q(QWizard);
1650  QObject *button = q->sender();
1651  for (int i = QWizard::NStandardButtons; i < QWizard::NButtons; ++i) {
1652  if (btns[i] == button) {
1653  emit q->customButtonClicked(QWizard::WizardButton(i));
1654  break;
1655  }
1656  }
1657 }
1658 
1660 {
1661  Q_Q(QWizard);
1662 
1663  disableUpdates();
1664 
1665  const QWizardPage *page = q->currentPage();
1666  bool complete = page && page->isComplete();
1667 
1668  btn.back->setEnabled(history.count() > 1
1669  && !q->page(history.at(history.count() - 2))->isCommitPage()
1670  && (!canFinish || !(opts & QWizard::DisabledBackButtonOnLastPage)));
1671  btn.next->setEnabled(canContinue && complete);
1672  btn.commit->setEnabled(canContinue && complete);
1673  btn.finish->setEnabled(canFinish && complete);
1674 
1675  const bool backButtonVisible = buttonLayoutContains(QWizard::BackButton)
1676  && (history.count() > 1 || !(opts & QWizard::NoBackButtonOnStartPage))
1677  && (canContinue || !(opts & QWizard::NoBackButtonOnLastPage));
1678  bool commitPage = page && page->isCommitPage();
1679  btn.back->setVisible(backButtonVisible);
1680  btn.next->setVisible(buttonLayoutContains(QWizard::NextButton) && !commitPage
1681  && (canContinue || (opts & QWizard::HaveNextButtonOnLastPage)));
1682  btn.commit->setVisible(buttonLayoutContains(QWizard::CommitButton) && commitPage
1683  && canContinue);
1684  btn.finish->setVisible(buttonLayoutContains(QWizard::FinishButton)
1685  && (canFinish || (opts & QWizard::HaveFinishButtonOnEarlyPages)));
1686 
1687  bool useDefault = !(opts & QWizard::NoDefaultButton);
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);
1694 
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);
1700  }
1701 #endif
1702 
1703 #ifdef QT_SOFTKEYS_ENABLED
1704  QAbstractButton *wizardButton;
1705  for (int i = 0; i < QWizard::NButtons; ++i) {
1706  wizardButton = btns[i];
1707  if (wizardButton && !wizardButton->testAttribute(Qt::WA_WState_Hidden)) {
1708  wizardButton->hide();
1709  q->addAction(softKeys[i]);
1710  } else {
1711  q->removeAction(softKeys[i]);
1712  }
1713  }
1714 #endif
1715 
1716  enableUpdates();
1717 }
1718 
1720 {
1721  int destroyed_index = -1;
1722  QVector<QWizardField>::iterator it = fields.begin();
1723  while (it != fields.end()) {
1724  const QWizardField &field = *it;
1725  if (field.object == object) {
1726  destroyed_index = fieldIndexMap.value(field.name, -1);
1727  fieldIndexMap.remove(field.name);
1728  it = fields.erase(it);
1729  } else {
1730  ++it;
1731  }
1732  }
1733  if (destroyed_index != -1) {
1734  QMap<QString, int>::iterator it2 = fieldIndexMap.begin();
1735  while (it2 != fieldIndexMap.end()) {
1736  int index = it2.value();
1737  if (index > destroyed_index) {
1738  QString field_name = it2.key();
1739  fieldIndexMap.insert(field_name, index-1);
1740  }
1741  ++it2;
1742  }
1743  }
1744 }
1745 
1747 {
1748  for (int i = 0; i < QWizard::NButtons; i++)
1749  if (btns[i])
1750  btns[i]->setStyle(style);
1751  const PageMap::const_iterator pcend = pageMap.constEnd();
1752  for (PageMap::const_iterator it = pageMap.constBegin(); it != pcend; ++it)
1753  it.value()->setStyle(style);
1754 }
1755 
1756 #ifdef Q_WS_MAC
1757 
1759 {
1760  QCFType<CFURLRef> url;
1761  const int ExpectedImageWidth = 242;
1762  const int ExpectedImageHeight = 414;
1763  if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"),
1764  0, 0, &url) == noErr) {
1765  QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
1766  if (bundle) {
1767  url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("tif"), 0);
1768  if (url) {
1769  QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
1770  QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
1771  if (image) {
1772  int width = CGImageGetWidth(image);
1773  int height = CGImageGetHeight(image);
1774  if (width == ExpectedImageWidth && height == ExpectedImageHeight)
1775  return QPixmap::fromMacCGImageRef(image);
1776  }
1777  }
1778  }
1779  }
1780  return QPixmap();
1781 
1782 }
1783 
1784 #endif
1785 
1786 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
1788 {
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;
1794  QPainter painter(this);
1795  const QBrush brush(QColor(240, 240, 240)); // ### hardcoded for now
1796  painter.fillRect(0, buttonLayoutTop, width(), height() - buttonLayoutTop, brush);
1797  painter.setPen(QPen(QBrush(QColor(223, 223, 223)), 0)); // ### hardcoded for now
1798  painter.drawLine(0, buttonLayoutTop, width(), buttonLayoutTop);
1799  if (wizardPrivate->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {
1800  if (window()->isActiveWindow())
1801  painter.setPen(QPen(QBrush(QColor(169, 191, 214)), 0)); // ### hardcoded for now
1802  else
1803  painter.setPen(QPen(QBrush(QColor(182, 193, 204)), 0)); // ### hardcoded for now
1804  painter.drawLine(0, 0, width(), 0);
1805  }
1806  }
1807 }
1808 #endif
1809 
2214 QWizard::QWizard(QWidget *parent, Qt::WindowFlags flags)
2215  : QDialog(*new QWizardPrivate, parent, flags)
2216 {
2217  Q_D(QWizard);
2218  d->init();
2219 #ifdef Q_WS_WINCE
2220  if (!qt_wince_is_mobile())
2222 #endif
2223 }
2224 
2229 {
2230  Q_D(QWizard);
2231  delete d->buttonLayout;
2232 }
2233 
2243 {
2244  Q_D(QWizard);
2245  int theid = 0;
2246  if (!d->pageMap.isEmpty())
2247  theid = (d->pageMap.constEnd() - 1).key() + 1;
2248  setPage(theid, page);
2249  return theid;
2250 }
2251 
2263 {
2264  Q_D(QWizard);
2265 
2266  if (!page) {
2267  qWarning("QWizard::setPage: Cannot insert null page");
2268  return;
2269  }
2270 
2271  if (theid == -1) {
2272  qWarning("QWizard::setPage: Cannot insert page with ID -1");
2273  return;
2274  }
2275 
2276  if (d->pageMap.contains(theid)) {
2277  qWarning("QWizard::setPage: Page with duplicate ID %d ignored", theid);
2278  return;
2279  }
2280 
2281  page->setParent(d->pageFrame);
2282 
2283  QVector<QWizardField> &pendingFields = page->d_func()->pendingFields;
2284  for (int i = 0; i < pendingFields.count(); ++i)
2285  d->addField(pendingFields.at(i));
2286  pendingFields.clear();
2287 
2288  connect(page, SIGNAL(completeChanged()), this, SLOT(_q_updateButtonStates()));
2289 
2290  d->pageMap.insert(theid, page);
2291  page->d_func()->wizard = this;
2292 
2293  int n = d->pageVBoxLayout->count();
2294 
2295  // disable layout to prevent layout updates while adding
2296  bool pageVBoxLayoutEnabled = d->pageVBoxLayout->isEnabled();
2297  d->pageVBoxLayout->setEnabled(false);
2298 
2299  d->pageVBoxLayout->insertWidget(n - 1, page);
2300 
2301  // hide new page and reset layout to old status
2302  page->hide();
2303  d->pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled);
2304 
2305  if (!d->startSetByUser && d->pageMap.constBegin().key() == theid)
2306  d->start = theid;
2307  emit pageAdded(theid);
2308 }
2309 
2319 {
2320  Q_D(QWizard);
2321 
2322  QWizardPage *removedPage = 0;
2323 
2324  // update startItem accordingly
2325  if (d->pageMap.count() > 0) { // only if we have any pages
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(); // secondId
2331  else
2332  d->start = -1; // removing the last page
2333  } else { // startSetByUser has to be "true" here
2334  d->start = firstId;
2335  }
2336  d->startSetByUser = false;
2337  }
2338  }
2339 
2340  if (d->pageMap.contains(id))
2341  emit pageRemoved(id);
2342 
2343  if (!d->history.contains(id)) {
2344  // Case 1: removing a page not in the history
2345  removedPage = d->pageMap.take(id);
2346  d->updateCurrentPage();
2347  } else if (id != d->current) {
2348  // Case 2: removing a page in the history before the current page
2349  removedPage = d->pageMap.take(id);
2350  d->history.removeOne(id);
2351  d->_q_updateButtonStates();
2352  } else if (d->history.count() == 1) {
2353  // Case 3: removing the current page which is the first (and only) one in the history
2354  d->reset();
2355  removedPage = d->pageMap.take(id);
2356  if (d->pageMap.isEmpty())
2357  d->updateCurrentPage();
2358  else
2359  restart();
2360  } else {
2361  // Case 4: removing the current page which is not the first one in the history
2362  back();
2363  removedPage = d->pageMap.take(id);
2364  d->updateCurrentPage();
2365  }
2366 
2367  if (removedPage) {
2368  if (d->initialized.contains(id)) {
2369  cleanupPage(id);
2370  d->initialized.remove(id);
2371  }
2372 
2373  d->pageVBoxLayout->removeWidget(removedPage);
2374 
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);
2379  }
2380  }
2381  }
2382 }
2383 
2392 QWizardPage *QWizard::page(int theid) const
2393 {
2394  Q_D(const QWizard);
2395  return d->pageMap.value(theid);
2396 }
2397 
2411 bool QWizard::hasVisitedPage(int theid) const
2412 {
2413  Q_D(const QWizard);
2414  return d->history.contains(theid);
2415 }
2416 
2426 {
2427  Q_D(const QWizard);
2428  return d->history;
2429 }
2430 
2436 {
2437  Q_D(const QWizard);
2438  return d->pageMap.keys();
2439 }
2440 
2454 void QWizard::setStartId(int theid)
2455 {
2456  Q_D(QWizard);
2457  int newStart = theid;
2458  if (theid == -1)
2459  newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1;
2460 
2461  if (d->start == newStart) {
2462  d->startSetByUser = theid != -1;
2463  return;
2464  }
2465 
2466  if (!d->pageMap.contains(newStart)) {
2467  qWarning("QWizard::setStartId: Invalid page ID %d", newStart);
2468  return;
2469  }
2470  d->start = newStart;
2471  d->startSetByUser = theid != -1;
2472 }
2473 
2474 int QWizard::startId() const
2475 {
2476  Q_D(const QWizard);
2477  return d->start;
2478 }
2479 
2489 {
2490  Q_D(const QWizard);
2491  return page(d->current);
2492 }
2493 
2509 int QWizard::currentId() const
2510 {
2511  Q_D(const QWizard);
2512  return d->current;
2513 }
2514 
2522 void QWizard::setField(const QString &name, const QVariant &value)
2523 {
2524  Q_D(QWizard);
2525 
2526  int index = d->fieldIndexMap.value(name, -1);
2527  if (index != -1) {
2528  const QWizardField &field = d->fields.at(index);
2529  if (!field.object->setProperty(field.property, value))
2530  qWarning("QWizard::setField: Couldn't write to property '%s'",
2531  field.property.constData());
2532  return;
2533  }
2534 
2535  qWarning("QWizard::setField: No such field '%s'", qPrintable(name));
2536 }
2537 
2546 {
2547  Q_D(const QWizard);
2548 
2549  int index = d->fieldIndexMap.value(name, -1);
2550  if (index != -1) {
2551  const QWizardField &field = d->fields.at(index);
2552  return field.object->property(field.property);
2553  }
2554 
2555  qWarning("QWizard::field: No such field '%s'", qPrintable(name));
2556  return QVariant();
2557 }
2558 
2575 {
2576  Q_D(QWizard);
2577 
2578  const bool styleChange = style != d->wizStyle;
2579 
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;
2585 #endif
2586 
2587  if (styleChange
2588 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
2589  || aeroStyleChange
2590 #endif
2591  ) {
2592  d->disableUpdates();
2593  d->wizStyle = style;
2594  d->updateButtonTexts();
2595  d->updateLayout();
2596  updateGeometry();
2597  d->enableUpdates();
2598 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
2599  if (aeroStyleChange)
2600  d->handleAeroStyleChange();
2601 #endif
2602  }
2603 }
2604 
2606 {
2607  Q_D(const QWizard);
2608  return d->wizStyle;
2609 }
2610 
2617 void QWizard::setOption(WizardOption option, bool on)
2618 {
2619  Q_D(QWizard);
2620  if (!(d->opts & option) != !on)
2621  setOptions(d->opts ^ option);
2622 }
2623 
2631 {
2632  Q_D(const QWizard);
2633  return (d->opts & option) != 0;
2634 }
2635 
2653 void QWizard::setOptions(WizardOptions options)
2654 {
2655  Q_D(QWizard);
2656 
2657  WizardOptions changed = (options ^ d->opts);
2658  if (!changed)
2659  return;
2660 
2661  d->disableUpdates();
2662 
2663  d->opts = options;
2664  if ((changed & IndependentPages) && !(d->opts & IndependentPages))
2665  d->cleanupPagesNotInHistory();
2666 
2669  | HaveCustomButton3)) {
2670  d->updateButtonLayout();
2671  } else if (changed & (NoBackButtonOnStartPage | NoBackButtonOnLastPage
2674  d->_q_updateButtonStates();
2675  }
2676 
2677  d->enableUpdates();
2678  d->updateLayout();
2679 }
2680 
2681 QWizard::WizardOptions QWizard::options() const
2682 {
2683  Q_D(const QWizard);
2684  return d->opts;
2685 }
2686 
2705 {
2706  Q_D(QWizard);
2707 
2708  if (!d->ensureButton(which))
2709  return;
2710 
2711  d->buttonCustomTexts.insert(which, text);
2712 
2713  if (!currentPage() || !currentPage()->d_func()->buttonCustomTexts.contains(which))
2714  d->btns[which]->setText(text);
2715 }
2716 
2730 {
2731  Q_D(const QWizard);
2732 
2733  if (!d->ensureButton(which))
2734  return QString();
2735 
2736  if (d->buttonCustomTexts.contains(which))
2737  return d->buttonCustomTexts.value(which);
2738 
2739  const QString defText = buttonDefaultText(d->wizStyle, which, d);
2740  if(!defText.isNull())
2741  return defText;
2742 
2743  return d->btns[which]->text();
2744 }
2745 
2763 {
2764  Q_D(QWizard);
2765 
2766  for (int i = 0; i < layout.count(); ++i) {
2767  WizardButton button1 = layout.at(i);
2768 
2769  if (button1 == NoButton || button1 == Stretch)
2770  continue;
2771  if (!d->ensureButton(button1))
2772  return;
2773 
2774  // O(n^2), but n is very small
2775  for (int j = 0; j < i; ++j) {
2776  WizardButton button2 = layout.at(j);
2777  if (button2 == button1) {
2778  qWarning("QWizard::setButtonLayout: Duplicate button in layout");
2779  return;
2780  }
2781  }
2782  }
2783 
2784  d->buttonsHaveCustomLayout = true;
2785  d->buttonsCustomLayout = layout;
2786  d->updateButtonLayout();
2787 }
2788 
2800 {
2801  Q_D(QWizard);
2802 
2803  if (uint(which) >= NButtons || d->btns[which] == button)
2804  return;
2805 
2806  if (QAbstractButton *oldButton = d->btns[which]) {
2807  d->buttonLayout->removeWidget(oldButton);
2808  delete oldButton;
2809  }
2810 
2811  d->btns[which] = button;
2812  if (button) {
2813  button->setParent(d->antiFlickerWidget);
2814  d->buttonCustomTexts.insert(which, button->text());
2815  d->connectButton(which);
2816  } else {
2817  d->buttonCustomTexts.remove(which); // ### what about page-specific texts set for 'which'
2818  d->ensureButton(which); // (QWizardPage::setButtonText())? Clear them as well?
2819  }
2820 
2821  d->updateButtonLayout();
2822 }
2823 
2830 {
2831  Q_D(const QWizard);
2832 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
2833  if (d->wizStyle == AeroStyle && which == BackButton)
2834  return d->vistaHelper->backButton();
2835 #endif
2836  if (!d->ensureButton(which))
2837  return 0;
2838  return d->btns[which];
2839 }
2840 
2853 {
2854  Q_D(QWizard);
2855  d->titleFmt = format;
2856  d->updateLayout();
2857 }
2858 
2860 {
2861  Q_D(const QWizard);
2862  return d->titleFmt;
2863 }
2864 
2877 {
2878  Q_D(QWizard);
2879  d->subTitleFmt = format;
2880  d->updateLayout();
2881 }
2882 
2884 {
2885  Q_D(const QWizard);
2886  return d->subTitleFmt;
2887 }
2888 
2902 {
2903  Q_D(QWizard);
2904  Q_ASSERT(uint(which) < NPixmaps);
2905  d->defaultPixmaps[which] = pixmap;
2906  d->updatePixmap(which);
2907 }
2908 
2918 {
2919  Q_D(const QWizard);
2920  Q_ASSERT(uint(which) < NPixmaps);
2921 #ifdef Q_WS_MAC
2922  if (which == BackgroundPixmap && d->defaultPixmaps[BackgroundPixmap].isNull())
2923  d->defaultPixmaps[BackgroundPixmap] = d->findDefaultBackgroundPixmap();
2924 #endif
2925  return d->defaultPixmaps[which];
2926 }
2927 
2953 void QWizard::setDefaultProperty(const char *className, const char *property,
2954  const char *changedSignal)
2955 {
2956  Q_D(QWizard);
2957  for (int i = d->defaultPropertyTable.count() - 1; i >= 0; --i) {
2958  if (qstrcmp(d->defaultPropertyTable.at(i).className, className) == 0) {
2959  d->defaultPropertyTable.remove(i);
2960  break;
2961  }
2962  }
2963  d->defaultPropertyTable.append(QWizardDefaultProperty(className, property, changedSignal));
2964 }
2965 
2994 {
2995  Q_D(QWizard);
2996 
2997  d->sideWidget = widget;
2998  if (d->watermarkLabel) {
2999  d->watermarkLabel->setSideWidget(widget);
3000  d->updateLayout();
3001  }
3002 }
3003 
3015 {
3016  Q_D(const QWizard);
3017 
3018  return d->sideWidget;
3019 }
3020 
3025 {
3026  Q_D(QWizard);
3027  if (visible) {
3028  if (d->current == -1)
3029  restart();
3030  }
3031  QDialog::setVisible(visible);
3032 }
3033 
3038 {
3039  Q_D(const QWizard);
3040  QSize result = d->mainLayout->totalSizeHint();
3041 #ifdef Q_WS_S60
3042  QSize extra(QApplication::desktop()->availableGeometry(QCursor::pos()).size());
3043 #else
3044  QSize extra(500, 360);
3045 #endif
3046  if (d->wizStyle == MacStyle && d->current != -1) {
3048  extra.setWidth(616);
3049  if (!pixmap.isNull()) {
3050  extra.setHeight(pixmap.height());
3051 
3052  /*
3053  The width isn't always reliable as a size hint, as
3054  some wizard backgrounds just cover the leftmost area.
3055  Use a rule of thumb to determine if the width is
3056  reliable or not.
3057  */
3058  if (pixmap.width() >= pixmap.height())
3059  extra.setWidth(pixmap.width());
3060  }
3061  }
3062  return result.expandedTo(extra);
3063 }
3064 
3160 {
3161  Q_D(QWizard);
3162  int n = d->history.count() - 2;
3163  if (n < 0)
3164  return;
3165  d->switchToPage(d->history.at(n), QWizardPrivate::Backward);
3166 }
3167 
3176 {
3177  Q_D(QWizard);
3178 
3179  if (d->current == -1)
3180  return;
3181 
3182  if (validateCurrentPage()) {
3183  int next = nextId();
3184  if (next != -1) {
3185  if (d->history.contains(next)) {
3186  qWarning("QWizard::next: Page %d already met", next);
3187  return;
3188  }
3189  if (!d->pageMap.contains(next)) {
3190  qWarning("QWizard::next: No such page %d", next);
3191  return;
3192  }
3193  d->switchToPage(next, QWizardPrivate::Forward);
3194  }
3195  }
3196 }
3197 
3205 {
3206  Q_D(QWizard);
3207  d->disableUpdates();
3208  d->reset();
3209  d->switchToPage(startId(), QWizardPrivate::Forward);
3210  d->enableUpdates();
3211 }
3212 
3217 {
3218  Q_D(QWizard);
3219  if (event->type() == QEvent::StyleChange) { // Propagate style
3220  d->setStyle(style());
3221  d->updateLayout();
3222  }
3223 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
3224  else if (event->type() == QEvent::Show && d->vistaInitPending) {
3225  d->vistaInitPending = false;
3226  d->wizStyle = AeroStyle;
3227  d->handleAeroStyleChange();
3228  }
3229  else if (d->isVistaThemeEnabled()) {
3230  if (event->type() == QEvent::Resize
3231  || event->type() == QEvent::LayoutDirectionChange) {
3232  const int buttonLeft = (layoutDirection() == Qt::RightToLeft
3233  ? width() - d->vistaHelper->backButton()->sizeHint().width()
3234  : 0);
3235 
3236  d->vistaHelper->backButton()->move(buttonLeft,
3237  d->vistaHelper->backButton()->y());
3238  }
3239 
3240  d->vistaHelper->mouseEvent(event);
3241  }
3242 #endif
3243  return QDialog::event(event);
3244 }
3245 
3250 {
3251  Q_D(QWizard);
3252  int heightOffset = 0;
3253 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
3254  if (d->isVistaThemeEnabled()) {
3255  heightOffset = d->vistaHelper->topOffset();
3256  if (d->isVistaThemeEnabled(QVistaHelper::VistaAero))
3257  heightOffset += d->vistaHelper->titleBarSize();
3258  }
3259 #endif
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);
3264 #endif
3265  QDialog::resizeEvent(event);
3266 }
3267 
3272 {
3273  Q_D(QWizard);
3274  if (d->wizStyle == MacStyle && currentPage()) {
3275  QPixmap backgroundPixmap = currentPage()->pixmap(BackgroundPixmap);
3276  if (backgroundPixmap.isNull())
3277  return;
3278 
3279  QPainter painter(this);
3280  painter.drawPixmap(0, (height() - backgroundPixmap.height()) / 2, backgroundPixmap);
3281  }
3282 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
3283  else if (d->isVistaThemeEnabled()) {
3284  if (d->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {
3285  QPainter painter(this);
3286  QColor color = d->vistaHelper->basicWindowFrameColor();
3287  painter.fillRect(0, 0, width(), QVistaHelper::topOffset(), color);
3288  }
3289  d->vistaHelper->paintEvent(event);
3290  }
3291 #else
3292  Q_UNUSED(event);
3293 #endif
3294 }
3295 
3296 #if defined(Q_WS_WIN)
3297 
3300 bool QWizard::winEvent(MSG *message, long *result)
3301 {
3302 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
3303  Q_D(QWizard);
3304  if (d->isVistaThemeEnabled()) {
3305  const bool winEventResult = d->vistaHelper->handleWinEvent(message, result);
3306  if (QVistaHelper::vistaState() != d->vistaState) {
3307  d->vistaState = QVistaHelper::vistaState();
3308  d->vistaStateChanged = true;
3310  }
3311  return winEventResult;
3312  } else {
3313  return QDialog::winEvent(message, result);
3314  }
3315 #else
3316  return QDialog::winEvent(message, result);
3317 #endif
3318 }
3319 #endif
3320 
3325 {
3326  Q_D(QWizard);
3327  // canceling leaves the wizard in a known state
3328  if (result == Rejected) {
3329  d->reset();
3330  } else {
3331  if (!validateCurrentPage())
3332  return;
3333  }
3334  QDialog::done(result);
3335 }
3336 
3358 {
3359  QWizardPage *page = this->page(theid);
3360  if (page)
3361  page->initializePage();
3362 }
3363 
3378 void QWizard::cleanupPage(int theid)
3379 {
3380  QWizardPage *page = this->page(theid);
3381  if (page)
3382  page->cleanupPage();
3383 }
3384 
3402 {
3404  if (!page)
3405  return true;
3406 
3407  return page->validatePage();
3408 }
3409 
3424 int QWizard::nextId() const
3425 {
3426  const QWizardPage *page = currentPage();
3427  if (!page)
3428  return -1;
3429 
3430  return page->nextId();
3431 }
3432 
3511  : QWidget(*new QWizardPagePrivate, parent, 0)
3512 {
3513  connect(this, SIGNAL(completeChanged()), this, SLOT(_q_updateCachedCompleteState()));
3514 }
3515 
3534 {
3535  Q_D(QWizardPage);
3536  d->title = title;
3537  if (d->wizard && d->wizard->currentPage() == this)
3538  d->wizard->d_func()->updateLayout();
3539 }
3540 
3542 {
3543  Q_D(const QWizardPage);
3544  return d->title;
3545 }
3546 
3570 {
3571  Q_D(QWizardPage);
3572  d->subTitle = subTitle;
3573  if (d->wizard && d->wizard->currentPage() == this)
3574  d->wizard->d_func()->updateLayout();
3575 }
3576 
3578 {
3579  Q_D(const QWizardPage);
3580  return d->subTitle;
3581 }
3582 
3597 {
3598  Q_D(QWizardPage);
3599  Q_ASSERT(uint(which) < QWizard::NPixmaps);
3600  d->pixmaps[which] = pixmap;
3601  if (d->wizard && d->wizard->currentPage() == this)
3602  d->wizard->d_func()->updatePixmap(which);
3603 }
3604 
3615 {
3616  Q_D(const QWizardPage);
3617  Q_ASSERT(uint(which) < QWizard::NPixmaps);
3618 
3619  const QPixmap &pixmap = d->pixmaps[which];
3620  if (!pixmap.isNull())
3621  return pixmap;
3622 
3623  if (wizard())
3624  return wizard()->pixmap(which);
3625 
3626  return pixmap;
3627 }
3628 
3647 {
3648 }
3649 
3662 {
3663  Q_D(QWizardPage);
3664  if (d->wizard) {
3665  QVector<QWizardField> &fields = d->wizard->d_func()->fields;
3666  for (int i = 0; i < fields.count(); ++i) {
3667  const QWizardField &field = fields.at(i);
3668  if (field.page == this)
3669  field.object->setProperty(field.property, field.initialValue);
3670  }
3671  }
3672 }
3673 
3689 {
3690  return true;
3691 }
3692 
3710 {
3711  Q_D(const QWizardPage);
3712 
3713  if (!d->wizard)
3714  return true;
3715 
3716  const QVector<QWizardField> &wizardFields = d->wizard->d_func()->fields;
3717  for (int i = wizardFields.count() - 1; i >= 0; --i) {
3718  const QWizardField &field = wizardFields.at(i);
3719  if (field.page == this && field.mandatory) {
3720  QVariant value = field.object->property(field.property);
3721  if (value == field.initialValue)
3722  return false;
3723 
3724 #ifndef QT_NO_LINEEDIT
3725  if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(field.object)) {
3726  if (!lineEdit->hasAcceptableInput())
3727  return false;
3728  }
3729 #endif
3730 #ifndef QT_NO_SPINBOX
3731  if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(field.object)) {
3732  if (!spinBox->hasAcceptableInput())
3733  return false;
3734  }
3735 #endif
3736  }
3737  }
3738  return true;
3739 }
3740 
3753 void QWizardPage::setFinalPage(bool finalPage)
3754 {
3755  Q_D(QWizardPage);
3756  d->explicitlyFinal = finalPage;
3757  QWizard *wizard = this->wizard();
3758  if (wizard && wizard->currentPage() == this)
3759  wizard->d_func()->updateCurrentPage();
3760 }
3761 
3775 {
3776  Q_D(const QWizardPage);
3777  if (d->explicitlyFinal)
3778  return true;
3779 
3780  QWizard *wizard = this->wizard();
3781  if (wizard && wizard->currentPage() == this) {
3782  // try to use the QWizard implementation if possible
3783  return wizard->nextId() == -1;
3784  } else {
3785  return nextId() == -1;
3786  }
3787 }
3788 
3803 void QWizardPage::setCommitPage(bool commitPage)
3804 {
3805  Q_D(QWizardPage);
3806  d->commit = commitPage;
3807  QWizard *wizard = this->wizard();
3808  if (wizard && wizard->currentPage() == this)
3809  wizard->d_func()->updateCurrentPage();
3810 }
3811 
3818 {
3819  Q_D(const QWizardPage);
3820  return d->commit;
3821 }
3822 
3832 {
3833  Q_D(QWizardPage);
3834  d->buttonCustomTexts.insert(which, text);
3835  if (wizard() && wizard()->currentPage() == this && wizard()->d_func()->btns[which])
3836  wizard()->d_func()->btns[which]->setText(text);
3837 }
3838 
3853 {
3854  Q_D(const QWizardPage);
3855 
3856  if (d->buttonCustomTexts.contains(which))
3857  return d->buttonCustomTexts.value(which);
3858 
3859  if (wizard())
3860  return wizard()->buttonText(which);
3861 
3862  return QString();
3863 }
3864 
3882 {
3883  Q_D(const QWizardPage);
3884 
3885  if (!d->wizard)
3886  return -1;
3887 
3888  bool foundCurrentPage = false;
3889 
3890  const QWizardPrivate::PageMap &pageMap = d->wizard->d_func()->pageMap;
3893 
3894  for (; i != end; ++i) {
3895  if (i.value() == this) {
3896  foundCurrentPage = true;
3897  } else if (foundCurrentPage) {
3898  return i.key();
3899  }
3900  }
3901  return -1;
3902 }
3903 
3930 void QWizardPage::setField(const QString &name, const QVariant &value)
3931 {
3932  Q_D(QWizardPage);
3933  if (!d->wizard)
3934  return;
3935  d->wizard->setField(name, value);
3936 }
3937 
3952 {
3953  Q_D(const QWizardPage);
3954  if (!d->wizard)
3955  return QVariant();
3956  return d->wizard->field(name);
3957 }
3958 
4006  const char *changedSignal)
4007 {
4008  Q_D(QWizardPage);
4009  QWizardField field(this, name, widget, property, changedSignal);
4010  if (d->wizard) {
4011  d->wizard->d_func()->addField(field);
4012  } else {
4013  d->pendingFields += field;
4014  }
4015 }
4016 
4024 {
4025  Q_D(const QWizardPage);
4026  return d->wizard;
4027 }
4028 
4030 
4031 #include "moc_qwizard.cpp"
4032 
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...
Definition: qstring.cpp:6448
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
void restart()
Restarts the wizard at the start page.
Definition: qwizard.cpp:3204
const int ClassicHMargin
Definition: qwizard.cpp:87
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
void paintEvent(QPaintEvent *event)
Reimplemented Function
Definition: qwizard.cpp:3271
static const int vMargin
Definition: qwhatsthis.cpp:182
QList< int > visitedPages() const
Returns the list of IDs of visited pages, in the order in which the pages were visited.
Definition: qwizard.cpp:2425
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
void setPointSize(int)
Sets the point size to pointSize.
Definition: qfont.cpp:1099
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
void setTitle(const QString &title)
Definition: qwizard.cpp:3533
QAbstractButton * cancel
Definition: qwizard.cpp:644
QLabel * subTitleLabel
Definition: qwizard.cpp:657
void setButton(WizardButton which, QAbstractButton *button)
Sets the button corresponding to role which to button.
Definition: qwizard.cpp:2799
void updateCurrentPage()
Definition: qwizard.cpp:1339
void addField(const QWizardField &field)
Definition: qwizard.cpp:783
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void setFont(const QFont &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4996
int minimumHeight() const
WizardButton
This enum specifies the buttons in a wizard.
Definition: qwizard.h:72
const int MacLayoutRightMargin
Definition: qwizard.cpp:91
QWizardRuler(QWidget *parent=0)
Definition: qwizard.cpp:426
void resizeEvent(QResizeEvent *event)
Reimplemented Function
Definition: qwizard.cpp:3249
QFrame * pageFrame
Definition: qwizard.cpp:655
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
void setup(const QWizardLayoutInfo &info, const QString &title, const QString &subTitle, const QPixmap &logo, const QPixmap &banner, Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat)
Definition: qwizard.cpp:346
QString title() const
QAbstractButton * button(WizardButton which) const
Returns the button corresponding to role which.
Definition: qwizard.cpp:2829
const QBrush & base() const
Returns the base brush of the current color group.
Definition: qpalette.h:130
bool vistaInitPending
Definition: qwizard.cpp:669
QWizardDefaultProperty(const char *className, const char *property, const char *changedSignal)
Definition: qwizard.cpp:159
void completeChanged()
This signal is emitted whenever the complete state of the page (i.
int y() const
static mach_timebase_info_data_t info
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void setSpacing(int)
Definition: qlayout.cpp:469
QString text() const
void setText(const QString &text)
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
void setTextFormat(Qt::TextFormat)
Definition: qlabel.cpp:1497
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
const Key key(const T &value) const
Returns the first key with value value.
Definition: qmap.h:844
void setWordWrap(bool on)
Definition: qlabel.cpp:579
void setWizardStyle(WizardStyle style)
Definition: qwizard.cpp:2574
QSize size() const
EventRef event
QPointer< QWidget > widget
QSize size() const
Returns the size of the pixmap.
Definition: qpixmap.cpp:661
virtual int nextId() const
This virtual function is called by QWizard::nextId() to find out which page to show when the user cli...
Definition: qwizard.cpp:3881
int disableUpdatesCount
Definition: qwizard.cpp:626
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...
Definition: qwizard.cpp:2953
static void changeSpacerSize(QLayout *layout, int index, int width, int height)
Definition: qwizard.cpp:94
QAbstractButton * next
Definition: qwizard.cpp:641
QLabel * subTitleLabel
Definition: qwizard.cpp:290
const char * changedSignal
Definition: qwizard.cpp:139
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
virtual QSize minimumSizeHint() const
bool winEvent(MSG *message, long *result)
Reimplemented Function
Definition: qwizard.cpp:3300
QByteArray changedSignal
Definition: qwizard.cpp:179
#define it(className, varName)
void setButtonLayout(const QWizard::WizardButton *array, int size)
Definition: qwizard.cpp:1504
QByteArray changedSignal
Definition: qwizard.cpp:156
The QDialog class is the base class of dialog windows.
Definition: qdialog.h:56
void setText(const QString &)
Definition: qlabel.cpp:366
void setField(const QString &name, const QVariant &value)
Sets the value of the field called name to value.
Definition: qwizard.cpp:3930
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
static VistaState vistaState()
QWizardPage * page
Definition: qwizard.cpp:174
The QWizardPage class is the base class for wizard pages.
Definition: qwizard.h:214
WizardStyle wizardStyle() const
void removeFieldAt(int index)
Definition: qwizard.cpp:805
void _q_emitCustomButtonClicked()
Definition: qwizard.cpp:1647
Qt::TextFormat subTitleFmt
Definition: qwizard.cpp:634
virtual void styleChange(QStyle &)
Definition: qwidget.cpp:12000
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)
Definition: qwizard.cpp:680
const int NFallbackDefaultProperties
Definition: qwizard.cpp:134
QList< int > history
Definition: qwizard.cpp:618
QMap< int, QWizardPage * > PageMap
Definition: qwizard.cpp:531
const_iterator constEnd() const
Definition: qset.h:171
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
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.
Definition: qstring.cpp:4623
void done(int result)
Reimplemented Function
Definition: qwizard.cpp:3324
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...
Definition: qwizard.cpp:3688
#define SLOT(a)
Definition: qobjectdefs.h:226
virtual bool isComplete() const
This virtual function is called by QWizard to determine whether the Next or Finish button should be e...
Definition: qwizard.cpp:3709
#define QWIDGETSIZE_MAX
Defines the maximum size for a QWidget object.
Definition: qwidget.h:1087
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
QPixmap pixmap(QWizard::WizardPixmap which) const
Returns the pixmap set for role which.
Definition: qwizard.cpp:3614
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object&#39;s name property to value.
Definition: qobject.cpp:3755
void updateButtonTexts()
Definition: qwizard.cpp:1445
void cleanupPagesNotInHistory()
Definition: qwizard.cpp:767
void resolve(const QVector< QWizardDefaultProperty > &defaultPropertyTable)
Definition: qwizard.cpp:194
QVector< QWizardField > fields
Definition: qwizard.cpp:615
void setMaximumSize(const QSize &)
Definition: qwidget.h:972
virtual Qt::Orientations expandingDirections() const =0
Returns whether this layout item can make use of more space than sizeHint().
static QWidget * iWantTheFocus(QWidget *ancestor)
Definition: qwizard.cpp:102
void reset()
Definition: qwizard.cpp:751
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
QByteArray property
Definition: qwizard.cpp:178
void setOption(WizardOption option, bool on=true)
Sets the given option to be enabled if on is true; otherwise, clears the given option.
Definition: qwizard.cpp:2617
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
bool operator==(const QWizardLayoutInfo &other)
Definition: qwizard.cpp:247
QSize sizeHint() const
em>Reimplemented Function
Definition: qlabel.cpp:947
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QWidget * nextInFocusChain() const
Returns the next widget in this widget&#39;s focus chain.
Definition: qwidget.cpp:6873
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.
Definition: qvariant.cpp:2691
static int topOffset()
void setMinimumSize(const QSize &)
Definition: qwidget.h:969
const Key & key() const
Returns the current item&#39;s key.
Definition: qmap.h:324
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QWidget * sideWidget
Definition: qwizard.cpp:654
QWidget * placeholderWidget1
Definition: qwizard.cpp:650
static QStyle * style()
Returns the application&#39;s style object.
QAbstractButton * back
Definition: qwizard.cpp:640
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...
Definition: qwizard.cpp:3378
void drawLine(const QLineF &line)
Draws a line defined by line.
Definition: qpainter.h:573
Qt::TextFormat subTitleFormat() const
QString text
the text shown on the button
static const WinVersion WindowsVersion
the version of the Windows operating system on which the application is run (Windows only) ...
Definition: qglobal.h:1613
void connectButton(QWizard::WizardButton which) const
Definition: qwizard.cpp:1431
The QString class provides a Unicode character string.
Definition: qstring.h:83
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
T * qobject_cast(QObject *object)
Definition: qobject.h:375
int topLevelMarginBottom
Definition: qwizard.cpp:227
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void handleAeroStyleChange()
Definition: qwizard.cpp:1570
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QVariant initialValue
Definition: qwizard.cpp:180
QWizardHeader(RulerType, QWidget *parent=0)
Definition: qwizard.cpp:274
QVariant field(const QString &name) const
Returns the value of the field called name.
Definition: qwizard.cpp:2545
#define Q_D(Class)
Definition: qglobal.h:2482
int height() const
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
QWidget * sideWidget() const
Definition: qwizard.cpp:456
QWizardAntiFlickerWidget * antiFlickerWidget
Definition: qwizard.cpp:649
QString buttonText(QWizard::WizardButton which) const
Returns the text on button which on this page.
Definition: qwizard.cpp:3852
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen&#39;s color.
Definition: qpainter.h:676
virtual void cleanupPage()
This virtual function is called by QWizard::cleanupPage() when the user leaves the page by clicking B...
Definition: qwizard.cpp:3661
const char * className
Definition: qwizard.cpp:137
static QPixmap fromMacCGImageRef(CGImageRef image)
Returns a QPixmap that is equivalent to the given image.
void setStyle(QStyle *)
Sets the widget&#39;s GUI style to style.
Definition: qwidget.cpp:2772
void setPixmap(const QPixmap &)
Definition: qlabel.cpp:439
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
QStyle * style() const
Definition: qwidget.cpp:2742
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition: qobject.cpp:2327
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...
Definition: qvector.h:250
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
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.
Definition: qstyle.cpp:2395
void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qwizard.cpp:1787
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
QList< int > pageIds() const
Returns the list of page IDs.
Definition: qwizard.cpp:2435
QWizard::WizardStyle wizStyle
Definition: qwizard.cpp:628
virtual bool validateCurrentPage()
This virtual function is called by QWizard when the user clicks Next or Finish to perform some last-m...
Definition: qwizard.cpp:3401
const int MacLayoutBottomMargin
Definition: qwizard.cpp:92
bool isFinalPage() const
This function is called by QWizard to determine whether the Finish button should be shown for this pa...
Definition: qwizard.cpp:3774
void setFinalPage(bool finalPage)
Explicitly sets this page to be final if finalPage is true.
Definition: qwizard.cpp:3753
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QWizard * wizard
Definition: qwizard.cpp:478
QList< QWizard::WizardButton > buttonsCustomLayout
Definition: qwizard.cpp:632
int width() const
Returns the width.
Definition: qsize.h:126
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
QWizardRuler * bottomRuler
Definition: qwizard.cpp:658
TriState completeState
Definition: qwizard.cpp:483
void resizeEvent(QResizeEvent *)
Reimplemented Function
Definition: qdialog.cpp:1268
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void setSubTitleFormat(Qt::TextFormat format)
Definition: qwizard.cpp:2876
void setCommitPage(bool commitPage)
Sets this page to be a commit page if commitPage is true; otherwise, sets it to be a normal page...
Definition: qwizard.cpp:3803
int addPage(QWizardPage *page)
Adds the given page to the wizard, and returns the page&#39;s ID.
Definition: qwizard.cpp:2242
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...
Definition: qpalette.h:206
QWizard(QWidget *parent=0, Qt::WindowFlags flags=0)
Constructs a wizard with the given parent and window flags.
Definition: qwizard.cpp:2214
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
bool ensureButton(QWizard::WizardButton which) const
Definition: qwizard.cpp:1380
void setBold(bool)
If enable is true sets the font&#39;s weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
Definition: qfont.h:352
const struct @155 fallbackProperties[NFallbackDefaultProperties]
static QPixmap findDefaultBackgroundPixmap()
Definition: qwizard.cpp:1758
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
bool vistaDisabled() const
Definition: qwizard.cpp:332
bool visible
whether the widget is visible
Definition: qwidget.h:191
friend class QPixmap
Definition: qwidget.h:748
bool event(QEvent *event)
Reimplemented Function
Definition: qwizard.cpp:3216
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347
bool buttonsHaveCustomLayout
Definition: qwizard.cpp:631
The QSpacerItem class provides blank space in a layout.
Definition: qlayoutitem.h:96
void _q_updateCachedCompleteState()
Definition: qwizard.cpp:505
void setButtonText(WizardButton which, const QString &text)
Sets the text on button which to be text.
Definition: qwizard.cpp:2704
bool isVistaThemeEnabled(QVistaHelper::VistaState state) const
Definition: qwizard.cpp:1563
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
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...
Definition: qobject.cpp:2580
void _q_maybeEmitCompleteChanged()
Definition: qwizard.cpp:497
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
int currentId() const
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189
bool buttonLayoutContains(QWizard::WizardButton which)
Definition: qwizard.cpp:1537
static bool init
int width() const
void setContentsMargins(int left, int top, int right, int bottom)
Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom.
Definition: qwidget.cpp:7449
void setSoftKeyRole(SoftKeyRole softKeyRole)
Definition: qaction.cpp:1599
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
const char * name
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
WizardOption
This enum specifies various options that affect the look and feel of a wizard.
Definition: qwizard.h:105
const char * layout
void setWindowFlags(Qt::WindowFlags type)
Definition: qwidget.cpp:10399
const QPalette & palette() const
const QBrush & mid() const
Returns the mid brush of the current color group.
Definition: qpalette.h:128
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
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.
Definition: qwizard.cpp:3831
unsigned int uint
Definition: qglobal.h:996
QHBoxLayout * buttonLayout
Definition: qwizard.cpp:664
bool startSetByUser
Definition: qwizard.cpp:621
QWidget * sideWidget() const
Returns the widget on the left side of the wizard or 0.
Definition: qwizard.cpp:3014
PageMap pageMap
Definition: qwizard.cpp:614
QPixmap bannerPixmap
Definition: qwizard.cpp:293
QPixmap pixmap(WizardPixmap which) const
Returns the pixmap set for role which.
Definition: qwizard.cpp:2917
QString subTitle
the subtitle of the page
Definition: qwizard.h:218
void setSideWidget(QWidget *widget)
Sets the given widget to be shown on the left side of the wizard.
Definition: qwizard.cpp:2993
QAbstractButton * help
Definition: qwizard.cpp:645
SoftKeyRole
This enum describes how an action should be placed in the softkey bar.
Definition: qaction.h:96
QWizardPage * page(int id) const
Returns the page with the given id, or 0 if there is no such page.
Definition: qwizard.cpp:2392
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...
Definition: qwizard.cpp:2488
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
QString buttonText(WizardButton which) const
Returns the text on button which.
Definition: qwizard.cpp:2729
QString name
Definition: qwizard.cpp:175
void setStartId(int id)
Definition: qwizard.cpp:2454
void updateLayout()
Definition: qwizard.cpp:1241
const T & at(int idx) const
void show()
Shows the widget and its child widgets.
virtual int nextId() const
This virtual function is called by QWizard to find out which page to show when the user clicks the Ne...
Definition: qwizard.cpp:3424
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or 0 if there is no such object.
Definition: qobjectdefs.h:494
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
bool hasVisitedPage(int id) const
Returns true if the page history contains page id; otherwise, returns false.
Definition: qwizard.cpp:2411
QMap< int, QString > buttonCustomTexts
Definition: qwizard.cpp:486
QWatermarkLabel * watermarkLabel
Definition: qwizard.cpp:653
bool vistaStateChanged
Definition: qwizard.cpp:671
int heightForWidth(int) const
Reimplemented Function
Definition: qlabel.cpp:765
int count() const
Definition: qstring.h:103
void back()
Goes back to the previous page.
Definition: qwizard.cpp:3159
bool isEnabled() const
Definition: qwidget.h:948
QVector< QWizardField > pendingFields
Definition: qwizard.cpp:482
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
void hide()
Hides the widget.
Definition: qwidget.h:501
QMap< QString, int > fieldIndexMap
Definition: qwizard.cpp:616
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QWatermarkLabel(QWidget *parent, QWidget *sideWidget)
Definition: qwizard.cpp:433
const int ModernHeaderTopMargin
Definition: qwizard.cpp:86
QLabel * titleLabel
Definition: qwizard.cpp:289
QSet< int > initialized
Definition: qwizard.cpp:619
void setButtonLayout(const QList< WizardButton > &layout)
Sets the order in which buttons are displayed to layout, where layout is a list of WizardButton...
Definition: qwizard.cpp:2762
bool qt_wince_is_mobile()
TextFormat
Definition: qnamespace.h:1310
static const int hMargin
Definition: qwhatsthis.cpp:183
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
Definition: qmap.h:372
QWizardAntiFlickerWidget(QWizard *wizard, QWizardPrivate *wizardPrivate)
Definition: qwizard.cpp:516
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
void setAutoFillBackground(bool enabled)
Definition: qwidget.cpp:631
virtual void done(int)
Closes the dialog and sets its result code to r.
Definition: qdialog.cpp:617
bool mandatory
Definition: qwizard.cpp:176
QVBoxLayout * m_layout
Definition: qwizard.cpp:460
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
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.
Definition: qobject.cpp:2895
void setTitleFormat(Qt::TextFormat format)
Definition: qwizard.cpp:2852
const int MacLayoutLeftMargin
Definition: qwizard.cpp:89
bool vistaDisabled() const
Definition: qwizard.cpp:1556
QString subTitle() const
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
void updateMinMaxSizes(const QWizardLayoutInfo &info)
Definition: qwizard.cpp:1302
The QMap::const_iterator class provides an STL-style const iterator for QMap and QMultiMap.
Definition: qmap.h:301
QVistaHelper::VistaState vistaState
Definition: qwizard.cpp:670
struct tagMSG MSG
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
void next()
Advances to the next page.
Definition: qwizard.cpp:3175
bool inHandleAeroStyleChange
Definition: qwizard.cpp:672
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...
Definition: qwizard.cpp:3357
QByteArray className
Definition: qwizard.cpp:154
QObject * object
Definition: qwizard.cpp:177
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QWidget * m_sideWidget
Definition: qwizard.cpp:461
void setAutoDefault(bool)
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
bool isVistaThemeEnabled() const
Definition: qwizard.cpp:1619
int x() const
QVariant field(const QString &name) const
Returns the value of the field called name.
Definition: qwizard.cpp:3951
void setField(const QString &name, const QVariant &value)
Sets the value of the field called name to value.
Definition: qwizard.cpp:2522
Qt::LayoutDirection layoutDirection() const
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941
void setFixedSize(const QSize &)
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing o...
Definition: qwidget.cpp:4284
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
Definition: qlayout.cpp:319
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:375
static QString object_name_for_button(QWizard::WizardButton which)
Definition: qwizard.cpp:1353
void findProperty(const QWizardDefaultProperty *properties, int propertyCount)
Definition: qwizard.cpp:201
const QSize & size() const
Returns the new size of the widget.
Definition: qevent.h:355
virtual QLayout * layout()
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned.
QAbstractButton * finish
Definition: qwizard.cpp:643
bool testOption(WizardOption option) const
Returns true if the given option is enabled; otherwise, returns false.
Definition: qwizard.cpp:2630
~QWizard()
Destroys the wizard and its pages, releasing any allocated resources.
Definition: qwizard.cpp:2228
void setSideWidget(QWidget *widget)
Definition: qwizard.cpp:445
void setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap)
Sets the pixmap for role which to pixmap.
Definition: qwizard.cpp:3596
QVBoxLayout * pageVBoxLayout
Definition: qwizard.cpp:663
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
WizardStyle
This enum specifies the different looks supported by QWizard.
Definition: qwizard.h:97
iterator erase(iterator begin, iterator end)
Removes all the items from begin up to (but not including) end.
Definition: qvector.h:627
int key
QLabel * titleLabel
Definition: qwizard.cpp:656
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...
Definition: qpalette.h:201
int result() const
In general returns the modal dialog&#39;s result code, Accepted or Rejected.
Definition: qdialog.cpp:458
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
QWizard::WizardOptions opts
Definition: qwizard.cpp:629
QSize maximumSize() const
void setOptions(WizardOptions options)
Definition: qwizard.cpp:2653
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
bool canContinue
Definition: qwizard.cpp:623
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
bool event(QEvent *e)
Reimplemented Function
Definition: qdialog.cpp:426
int maximumHeight() const
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
QWizardPage(QWidget *parent=0)
Constructs a wizard page with the given parent.
Definition: qwizard.cpp:3510
void disableUpdates()
Definition: qwizard.cpp:1629
bool isAncestorOf(const QWidget *child) const
Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child...
Definition: qwidget.cpp:8573
const char * property
Definition: qwizard.cpp:138
QString title
the title of the page
Definition: qwizard.h:217
int height() const
Returns the height.
Definition: qsize.h:129
if(void) toggleToolbarShown
QVistaHelper * vistaHelper
Definition: qwizard.cpp:668
QWizardHeader * headerWidget
Definition: qwizard.cpp:652
Definition: qnamespace.h:54
void switchToPage(int newId, Direction direction)
Definition: qwizard.cpp:820
const T & value() const
Returns the current item&#39;s value.
Definition: qmap.h:325
QSize minimumSize() const
const_iterator constBegin() const
Definition: qset.h:168
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
#define QT_NO_STYLE_WINDOWSVISTA
QWizardLayoutInfo layoutInfo
Definition: qwizard.cpp:625
static int oldButton(int button)
static const char *const buttonSlots[QWizard::NStandardButtons]
Definition: qwizard.cpp:895
The QHBoxLayout class lines up widgets horizontally.
Definition: qboxlayout.h:129
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66
quint16 index
bool operator!=(const QWizardLayoutInfo &other)
Definition: qwizard.cpp:244
QVariant property(const char *name) const
Returns the value of the object&#39;s name property.
Definition: qobject.cpp:3807
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QSize totalMinimumSize() const
Also takes contentsMargins and menu bar into account.
Definition: qlayout.cpp:848
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
QAbstractButton * commit
Definition: qwizard.cpp:642
void setPixmap(WizardPixmap which, const QPixmap &pixmap)
Sets the pixmap for role which to pixmap.
Definition: qwizard.cpp:2901
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
Definition: qsize.h:117
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...
Definition: qpainter.cpp:5619
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
void recreateLayout(const QWizardLayoutInfo &info)
Definition: qwizard.cpp:959
void enableUpdates()
Definition: qwizard.cpp:1638
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
int pointSize() const
Returns the point size of the font.
Definition: qfont.cpp:981
const QFont & font() const
QGridLayout * mainLayout
Definition: qwizard.cpp:665
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
Qt::TextFormat titleFmt
Definition: qwizard.cpp:633
void paintEvent(QPaintEvent *event)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qwizard.cpp:407
int qstrcmp(const QByteArray &str1, const char *str2)
Definition: qbytearray.cpp:336
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154
bool cachedIsComplete() const
Definition: qwizard.cpp:489
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
void updateGeometry()
Notifies the layout system that this widget has changed and may need to change geometry.
Definition: qwidget.cpp:10372
bool isCommitPage() const
Returns true if this page is a commit page; otherwise returns false.
Definition: qwizard.cpp:3817
QSize sizeHint() const
Reimplemented Function
Definition: qwizard.cpp:3037
QWizard * wizard() const
Returns the wizard associated with this page, or 0 if this page hasn&#39;t been inserted into a QWizard y...
Definition: qwizard.cpp:4023
void updatePixmap(QWizard::WizardPixmap which)
Definition: qwizard.cpp:1542
void updateButtonLayout()
Definition: qwizard.cpp:1463
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
void removePage(int id)
Removes the page with the given id.
Definition: qwizard.cpp:2318
QWizardPrivate * wizardPrivate
Definition: qwizard.cpp:514
QWizard::WizardStyle wizStyle
Definition: qwizard.cpp:235
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
static void setTabOrder(QWidget *, QWidget *)
Puts the second widget after the first widget in the focus order.
Definition: qwidget.cpp:6975
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
static const KeyPair *const end
Qt::TextFormat titleFormat() const
QWidget * placeholderWidget2
Definition: qwizard.cpp:651
void setMargin(int)
Definition: qlayout.cpp:464
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
#define qPrintable(string)
Definition: qglobal.h:1750
int minimumWidth() const
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55
QString & insert(int i, QChar c)
Definition: qstring.cpp:1671
void setVisible(bool visible)
Reimplemented Function
Definition: qdialog.cpp:756
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QLabel * logoLabel
Definition: qwizard.cpp:291
bool operator==(QBool b1, bool b2)
Definition: qglobal.h:2023
virtual void initializePage()
This virtual function is called by QWizard::initializePage() to prepare the page just before it is sh...
Definition: qwizard.cpp:3646
void _q_updateButtonStates()
Definition: qwizard.cpp:1659
void setAlignment(Qt::Alignment)
Without this function, a call to e.
Definition: qlabel.cpp:532
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.
Definition: qwizard.h:89
void setStyle(QStyle *style)
Definition: qwizard.cpp:1746
QMap< int, QString > buttonCustomTexts
Definition: qwizard.cpp:630
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
int startId() const
const int GapBetweenLogoAndRightEdge
Definition: qwizard.cpp:85
QGridLayout * layout
Definition: qwizard.cpp:292
QSize minimumSizeHint() const
Definition: qwizard.cpp:439
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
void setPalette(const QPalette &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4858
static bool objectInheritsXAndXIsCloserThanY(const QObject *object, const QByteArray &classX, const QByteArray &classY)
Definition: qwizard.cpp:120
void _q_handleFieldObjectDestroyed(QObject *)
Definition: qwizard.cpp:1719
const int MacButtonTopMargin
Definition: qwizard.cpp:88
void setPage(int id, QWizardPage *page)
Adds the given page to the wizard with the given id.
Definition: qwizard.cpp:2262
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
#define text
Definition: qobjectdefs.h:80
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310
The QWizard class provides a framework for wizards.
Definition: qwizard.h:59
void setVisible(bool visible)
Reimplemented Function
Definition: qwizard.cpp:3024
static void setup()
Definition: qtextcodec.cpp:718
void setSubTitle(const QString &subTitle)
Definition: qwizard.cpp:3569
void setIndent(int)
Definition: qlabel.cpp:620
QVector< QWizardDefaultProperty > defaultPropertyTable
Definition: qwizard.cpp:617
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.
Definition: qwizard.cpp:4005
QWizardLayoutInfo layoutInfoForCurrentPage()
Definition: qwizard.cpp:900
int maximumWidth() const
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61