summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-05-18 12:30:09 (GMT)
committerjasplin <qt-info@nokia.com>2009-05-18 12:37:27 (GMT)
commit0ff3bb25df3626a8112def75fc3ff048c70ebdb2 (patch)
tree3361fa90b167400547fd50b87ac502272c15e02b /src
parent7008bfe80e0466ed2978b39e7e698bbd52fb690f (diff)
downloadQt-0ff3bb25df3626a8112def75fc3ff048c70ebdb2.zip
Qt-0ff3bb25df3626a8112def75fc3ff048c70ebdb2.tar.gz
Qt-0ff3bb25df3626a8112def75fc3ff048c70ebdb2.tar.bz2
Fixed crash in QWizard running on old Windows systems.
When compiling the QWizard on a Windows system where QT_NO_STYLE_WINDOWSVISTA is not set and running the app on an old system that has no Vista support, the app would crash in the paint event of the Vista Back button. In this scenario, the Vista Back button is not needed (i.e. the regular Back button next to the Next button is used), so the fix is simply to avoid instanciating it altogether. Reviewed-by: janarve Task-number: 252662
Diffstat (limited to 'src')
-rw-r--r--src/gui/dialogs/qwizard.cpp4
-rw-r--r--src/gui/dialogs/qwizard_win.cpp5
-rw-r--r--src/gui/dialogs/qwizard_win_p.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 32395c4..298f23f 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -1465,7 +1465,7 @@ void QWizardPrivate::handleAeroStyleChange()
return; // prevent recursion
inHandleAeroStyleChange = true;
- vistaHelper->backButton()->disconnect();
+ vistaHelper->disconnectBackButton();
q->removeEventFilter(vistaHelper);
if (isVistaThemeEnabled()) {
@@ -1491,7 +1491,7 @@ void QWizardPrivate::handleAeroStyleChange()
q->setMouseTracking(true); // ### original value possibly different
q->unsetCursor(); // ### ditto
antiFlickerWidget->move(0, 0);
- vistaHelper->backButton()->hide();
+ vistaHelper->hideBackButton();
vistaHelper->setTitleBarIconAndCaptionVisible(true);
}
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 64696de..8aad4af 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -239,9 +239,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
QVistaHelper::QVistaHelper(QWizard *wizard)
: pressed(false)
, wizard(wizard)
+ , backButton_(0)
{
is_vista = resolveSymbols();
- backButton_ = new QVistaBackButton(wizard);
+ if (is_vista)
+ backButton_ = new QVistaBackButton(wizard);
}
QVistaHelper::~QVistaHelper()
@@ -310,6 +312,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
QRect(0, 0, wizard->width(), titleBarSize() + topOffset()),
painter->paintEngine()->getDC());
+ Q_ASSERT(backButton_);
const int btnTop = backButton_->mapToParent(QPoint()).y();
const int btnHeight = backButton_->size().height();
const int verticalCenter = (btnTop + btnHeight / 2);
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index cbb3b17..148be26 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -94,6 +94,8 @@ public:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; }
+ void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
+ void hideBackButton() { if (backButton_) backButton_->hide(); }
void setWindowPosHack();
QColor basicWindowFrameColor();
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };