summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-20 13:46:57 +0100
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-20 13:49:28 +0100
commit76c0be34cd4ff4564693162fa7528463e23ce9d8 (patch)
treef165b7bc319548fb0082365411a871028f92e89e /src/widgets/dialogs
parent27b4fe96b59e9e63d1e570e802c072e9afdfb2d4 (diff)
parent36cb3f3f655a9090c82de609010cbfb88651a0f3 (diff)
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp7
-rw-r--r--src/widgets/dialogs/qcolordialog.h6
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h2
-rw-r--r--src/widgets/dialogs/qdialog.cpp2
-rw-r--r--src/widgets/dialogs/qdialog.h6
-rw-r--r--src/widgets/dialogs/qdialog_p.h2
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp2
-rw-r--r--src/widgets/dialogs/qerrormessage.h6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
-rw-r--r--src/widgets/dialogs/qfiledialog.h6
-rw-r--r--src/widgets/dialogs/qfiledialog.ui2
-rw-r--r--src/widgets/dialogs/qfiledialog_embedded.ui2
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h4
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp4
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h6
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h2
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp2
-rw-r--r--src/widgets/dialogs/qfontdialog.h6
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h2
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h2
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp2
-rw-r--r--src/widgets/dialogs/qinputdialog.h6
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp26
-rw-r--r--src/widgets/dialogs/qmessagebox.h10
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp6
-rw-r--r--src/widgets/dialogs/qprogressdialog.h6
-rw-r--r--src/widgets/dialogs/qsidebar.cpp2
-rw-r--r--src/widgets/dialogs/qsidebar_p.h2
-rw-r--r--src/widgets/dialogs/qwizard.cpp44
-rw-r--r--src/widgets/dialogs/qwizard.h6
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp181
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h17
34 files changed, 216 insertions, 173 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index af43ecc8df..d6254076c5 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1857,15 +1857,12 @@ void QColorDialog::setVisible(bool visible)
}
#else
- if (!(options() & DontUseNativeDialog))
+ if (!(options() & DontUseNativeDialog) && d->nativeDialogInUse) {
d->setNativeDialogVisible(visible);
-
- if (d->nativeDialogInUse) {
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
// updates the state correctly, but skips showing the non-native version:
setAttribute(Qt::WA_DontShowOnScreen);
} else {
- d->nativeDialogInUse = false;
setAttribute(Qt::WA_DontShowOnScreen, false);
}
#endif
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 2149c9c6d2..80a31c4268 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -133,6 +131,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOLORDIALOG_H
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index 6711ba9287..900b38fc61 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index e397ed4576..a76c88dc5e 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index eeb0ac56b5..efbc475118 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -125,6 +123,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDIALOG_H
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 3ef210045e..eb0cb2372b 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 6cb5888a75..cc79582cb0 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 4bba3131c9..6be063b57b 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,6 +77,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QERRORMESSAGE_H
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index c60f2476c3..c42752311f 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -941,7 +941,9 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded
} else {
QString userName = tokens.first();
userName.remove(0, 1);
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
+#if defined(Q_OS_VXWORKS)
+ const QString homePath = QDir::homePath();
+#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
passwd pw;
passwd *tmpPw;
char buf[200];
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index 18aaa781fd..98d1fd5695 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -265,6 +263,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILEDIALOG_H
diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui
index fa4fa4cdf5..29f476e378 100644
--- a/src/widgets/dialogs/qfiledialog.ui
+++ b/src/widgets/dialogs/qfiledialog.ui
@@ -5,7 +5,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfiledialog_embedded.ui b/src/widgets/dialogs/qfiledialog_embedded.ui
index 5988211aea..16128dc0a0 100644
--- a/src/widgets/dialogs/qfiledialog_embedded.ui
+++ b/src/widgets/dialogs/qfiledialog_embedded.ui
@@ -4,7 +4,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index ffaa2bc6f8..f8f33eb18d 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,6 +53,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_FILEDIALOG
#include "qfiledialog.h"
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 98cde84450..213aefe5f5 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index f9566eb0af..0c4e644e40 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 9a81e0f02f..d91ac424e2 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -964,6 +964,8 @@ Qt::ItemFlags QFileSystemModel::flags(const QModelIndex &index) const
flags |= Qt::ItemIsEditable;
if (indexNode->isDir())
flags |= Qt::ItemIsDropEnabled;
+ else
+ flags |= Qt::ItemNeverHasChildren;
}
return flags;
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index 18df89d736..0b52b6565b 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,8 +48,6 @@
#include <QtGui/qicon.h>
#include <QtCore/qdiriterator.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -173,7 +171,5 @@ inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILESYSTEMMODEL_H
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 4f5eeb9ff7..d61936d545 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 4036dc80ab..313b475f1f 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 51d68d1b88..c2d930bc1e 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtWidgets/qdialog.h>
#include <QtGui/qfont.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -126,6 +124,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFONTDIALOG_H
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index 90b6a6eff8..18429e8ede 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index 9099ea1a5e..e995114ee9 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 99ecf02bdb..a0aefdef9d 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 096a81d4bc..41dca1f94f 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qlineedit.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -215,6 +213,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QINPUTDIALOG_H
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 57ed4da8a6..a485a55609 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1225,6 +1225,30 @@ void QMessageBox::setTextFormat(Qt::TextFormat format)
}
/*!
+ \property QMessageBox::textInteractionFlags
+ \since 5.1
+
+ Specifies how the label of the message box should interact with user
+ input.
+
+ The default value depends on the style.
+
+ \sa QStyle::SH_MessageBox_TextInteractionFlags
+*/
+
+Qt::TextInteractionFlags QMessageBox::textInteractionFlags() const
+{
+ Q_D(const QMessageBox);
+ return d->label->textInteractionFlags();
+}
+
+void QMessageBox::setTextInteractionFlags(Qt::TextInteractionFlags flags)
+{
+ Q_D(QMessageBox);
+ d->label->setTextInteractionFlags(flags);
+}
+
+/*!
\reimp
*/
bool QMessageBox::event(QEvent *e)
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index e0eb47ea2a..32b7027d89 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -69,6 +67,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
#endif
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
+ Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
public:
enum Icon {
@@ -186,6 +185,9 @@ public:
Qt::TextFormat textFormat() const;
void setTextFormat(Qt::TextFormat format);
+ void setTextInteractionFlags(Qt::TextInteractionFlags flags);
+ Qt::TextInteractionFlags textInteractionFlags() const;
+
static StandardButton information(QWidget *parent, const QString &title,
const QString &text, StandardButtons buttons = Ok,
StandardButton defaultButton = NoButton);
@@ -329,6 +331,4 @@ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplicatio
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMESSAGEBOX_H
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index de86e2ed7c..78612f3181 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -297,7 +297,7 @@ QProgressDialog::QProgressDialog(QWidget *parent, Qt::WindowFlags f)
The \a labelText is the text used to remind the user what is progressing.
- The \a cancelButtonText is the text to display on the cancel button. If
+ The \a cancelButtonText is the text to display on the cancel button. If
QString() is passed then no cancel button is shown.
The \a minimum and \a maximum is the number of steps in the operation for
@@ -438,7 +438,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
/*!
Sets the cancel button's text to \a cancelButtonText. If the text
- is set to QString() then it will cause the cancel button to be
+ is set to QString() then it will cause the cancel button to be
hidden and deleted.
\sa setCancelButton()
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 1f17727900..20b658eb58 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -139,6 +137,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPROGRESSDIALOG_H
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 37bcc62425..3d22992e3a 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 72d632280c..319006f167 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 8bc2eb92c1..f58a10b166 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -54,6 +54,7 @@
#include "qlabel.h"
#include "qlineedit.h"
#include "qpainter.h"
+#include "qwindow.h"
#include "qpushbutton.h"
#include "qset.h"
#include "qstyle.h"
@@ -592,7 +593,7 @@ public:
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
bool vistaDisabled() const;
bool isVistaThemeEnabled(QVistaHelper::VistaState state) const;
- void handleAeroStyleChange();
+ bool handleAeroStyleChange();
#endif
bool isVistaThemeEnabled() const;
void disableUpdates();
@@ -1514,33 +1515,48 @@ bool QWizardPrivate::isVistaThemeEnabled(QVistaHelper::VistaState state) const
&& !vistaDisabled();
}
-void QWizardPrivate::handleAeroStyleChange()
+bool QWizardPrivate::handleAeroStyleChange()
{
Q_Q(QWizard);
if (inHandleAeroStyleChange)
- return; // prevent recursion
+ return false; // prevent recursion
+ // For top-level wizards, we need the platform window handle for the
+ // DWM changes. Delay aero initialization to the show event handling if
+ // it does not exist. If we are a child, skip DWM and just make room by
+ // moving the antiFlickerWidget.
+ const bool isWindow = q->isWindow();
+ if (isWindow && (!q->windowHandle() || !q->windowHandle()->handle()))
+ return false;
inHandleAeroStyleChange = true;
vistaHelper->disconnectBackButton();
q->removeEventFilter(vistaHelper);
+ bool vistaMargins = false;
+
if (isVistaThemeEnabled()) {
if (isVistaThemeEnabled(QVistaHelper::VistaAero)) {
- vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
- q->installEventFilter(vistaHelper);
+ if (isWindow) {
+ vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
+ q->installEventFilter(vistaHelper);
+ }
q->setMouseTracking(true);
antiFlickerWidget->move(0, vistaHelper->titleBarSize() + vistaHelper->topOffset());
vistaHelper->backButton()->move(
0, vistaHelper->topOffset() // ### should ideally work without the '+ 1'
- qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1));
+ vistaMargins = true;
+ vistaHelper->backButton()->show();
} else {
- vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
+ if (isWindow)
+ vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
q->setMouseTracking(true);
antiFlickerWidget->move(0, vistaHelper->topOffset());
vistaHelper->backButton()->move(0, -1); // ### should ideally work with (0, 0)
}
- vistaHelper->setTitleBarIconAndCaptionVisible(false);
+ if (isWindow)
+ vistaHelper->setTitleBarIconAndCaptionVisible(false);
QObject::connect(
vistaHelper->backButton(), SIGNAL(clicked()), q, buttonSlots[QWizard::BackButton]);
vistaHelper->backButton()->show();
@@ -1551,15 +1567,16 @@ void QWizardPrivate::handleAeroStyleChange()
#endif
antiFlickerWidget->move(0, 0);
vistaHelper->hideBackButton();
- vistaHelper->setTitleBarIconAndCaptionVisible(true);
+ if (isWindow)
+ vistaHelper->setTitleBarIconAndCaptionVisible(true);
}
_q_updateButtonStates();
- if (q->isVisible())
- vistaHelper->setWindowPosHack();
+ vistaHelper->updateCustomMargins(vistaMargins);
inHandleAeroStyleChange = false;
+ return true;
}
#endif
@@ -2507,8 +2524,9 @@ void QWizard::setWizardStyle(WizardStyle style)
updateGeometry();
d->enableUpdates();
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
- if (aeroStyleChange)
- d->handleAeroStyleChange();
+ // Delay initialization when activating Aero style fails due to missing native window.
+ if (aeroStyleChange && !d->handleAeroStyleChange() && d->wizStyle == AeroStyle)
+ d->vistaInitPending = true;
#endif
}
}
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 7a95492f94..9dea9a8e6f 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -261,8 +259,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_WIZARD
#endif // QWIZARD_H
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 2bcb7a2167..001c21da61 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -49,7 +49,10 @@
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
+#include <QtCore/QVariant>
+#include <QtCore/QDebug>
#include <QtGui/QMouseEvent>
+#include <QtGui/QWindow>
#include <QtWidgets/QDesktopWidget>
// Note, these tests are duplicates in qwindowsxpstyle_p.h.
@@ -66,10 +69,12 @@
#include <uxtheme.h>
+Q_DECLARE_METATYPE(QMargins)
+
QT_BEGIN_NAMESPACE
//DWM related
-typedef struct { //MARGINS
+typedef struct { //MARGINS
int cxLeftWidth; // width of left border that retains its size
int cxRightWidth; // width of right border that retains its size
int cyTopHeight; // height of top border that retains its size
@@ -216,9 +221,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
QRect r = rect();
HANDLE theme = pOpenThemeData(0, L"Navigation");
//RECT rect;
+ QPoint origin;
+ const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin);
RECT clipRect;
- int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1;
- int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1;
+ int xoffset = origin.x() + QWidget::mapToParent(r.topLeft()).x() - 1;
+ int yoffset = origin.y() + QWidget::mapToParent(r.topLeft()).y() - 1;
clipRect.top = r.top() + yoffset;
clipRect.bottom = r.bottom() + yoffset;
@@ -233,8 +240,6 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
else if (underMouse())
state = WIZ_NAV_BB_HOT;
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore()));
pDrawThemeBackground(theme, hdc, WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect);
}
@@ -251,8 +256,10 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
is_vista = resolveSymbols();
if (instanceCount++ == 0)
cachedVistaState = Dirty;
- if (is_vista)
+ if (is_vista) {
backButton_ = new QVistaBackButton(wizard);
+ backButton_->hide();
+ }
// Handle diff between Windows 7 and Vista
iconSpacing = QStyleHelper::dpiScaled(7);
@@ -265,6 +272,26 @@ QVistaHelper::~QVistaHelper()
--instanceCount;
}
+void QVistaHelper::updateCustomMargins(bool vistaMargins)
+{
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8)
+ return; // Negative margins are not supported on Windows 8.
+ if (QWindow *window = wizard->windowHandle()) {
+ // Reduce top frame to zero since we paint it ourselves.
+ const QMargins customMargins = vistaMargins ?
+ QMargins(0, -titleBarSize(), 0, 0) : QMargins();
+ const QVariant customMarginsV = qVariantFromValue(customMargins);
+ // The dynamic property takes effect when creating the platform window.
+ window->setProperty("_q_windowsCustomMargins", customMarginsV);
+ // If a platform window exists, change via native interface.
+ if (QPlatformWindow *platformWindow = window->handle()) {
+ QGuiApplication::platformNativeInterface()->
+ setWindowProperty(platformWindow, QStringLiteral("WindowsCustomMargins"),
+ customMarginsV);
+ }
+ }
+}
+
bool QVistaHelper::isCompositionEnabled()
{
bool value = is_vista;
@@ -291,6 +318,12 @@ QVistaHelper::VistaState QVistaHelper::vistaState()
return cachedVistaState;
}
+void QVistaHelper::disconnectBackButton()
+{
+ if (backButton_) // Leave QStyleSheetStyle's connections on destroyed() intact.
+ backButton_->disconnect(SIGNAL(clicked()));
+}
+
QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
@@ -315,9 +348,9 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
mar.cyTopHeight = 0;
else
mar.cyTopHeight = titleBarSize() + topOffset();
- HWND wizardHandle = QApplicationPrivate::getHWNDForWidget(wizard);
- HRESULT hr = pDwmExtendFrameIntoClientArea(wizardHandle, &mar);
- value = SUCCEEDED(hr);
+ if (const HWND wizardHandle = wizardHWND())
+ if (SUCCEEDED(pDwmExtendFrameIntoClientArea(wizardHandle, &mar)))
+ value = true;
}
return value;
}
@@ -327,11 +360,11 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
void QVistaHelper::drawTitleBar(QPainter *painter)
{
Q_ASSERT(backButton_);
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- QBackingStore *backingStore = backButton_->backingStore();
- HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore));
+ QPoint origin;
+ const bool isWindow = wizard->isWindow();
+ const HDC hdc = QVistaHelper::backingStoreDC(wizard, &origin);
- if (vistaState() == VistaAero)
+ if (vistaState() == VistaAero && isWindow)
drawBlackRect(QRect(0, 0, wizard->width(),
titleBarSize() + topOffset()), hdc);
const int btnTop = backButton_->mapToParent(QPoint()).y();
@@ -352,14 +385,20 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
glowOffset = glowSize();
}
- drawTitleText(
- painter, text,
- QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight),
- hdc);
+ const QRect textRectangle(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight);
+ if (isWindow) {
+ drawTitleText(painter, text, textRectangle, hdc);
+ } else {
+ painter->save();
+ painter->setFont(font);
+ painter->drawText(textRectangle, Qt::AlignVCenter | Qt::AlignHCenter, text);
+ painter->restore();
+ }
const QIcon windowIcon = wizard->windowIcon();
if (!windowIcon.isNull()) {
- QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize());
+ const QRect rect(origin.x() + leftMargin(),
+ origin.y() + verticalCenter - iconSize() / 2, iconSize(), iconSize());
const HICON hIcon = qt_pixmapToWinHICON(windowIcon.pixmap(iconSize()));
DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
@@ -375,8 +414,8 @@ void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
opt.dwMask = 0;
else
opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
+ if (const HWND handle = wizardHWND())
+ pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
}
}
@@ -402,13 +441,6 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
}
break;
}
-// case WM_NCCALCSIZE: { #fixme: If the frame size is changed, it needs to be communicated to the QWindow.
-// NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam;
-// *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
-// lpncsp->rgrc[0].top -= (vistaState() == VistaAero ? titleBarSize() : 0);
-//
-// break;
-// }
default:
LRESULT lResult;
// Pass to DWM to handle
@@ -449,38 +481,6 @@ void QVistaHelper::mouseEvent(QEvent *event)
}
}
-// The following hack ensures that the titlebar is updated correctly
-// when the wizard style changes to and from AeroStyle. Specifically,
-// this function causes a Windows message of type WM_NCCALCSIZE to
-// be triggered.
-void QVistaHelper::setWindowPosHack()
-{
- const int x = wizard->geometry().x(); // ignored by SWP_NOMOVE
- const int y = wizard->geometry().y(); // ignored by SWP_NOMOVE
- const int w = wizard->width();
- const int h = wizard->height();
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- SetWindowPos(handle, 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
-}
-
-// The following hack allows any QWidget subclass to access
-// QWidgetPrivate::topData() without being declared as a
-// friend by QWidget.
-class QHackWidget : public QWidget
-{
-public:
- Q_DECLARE_PRIVATE(QWidget)
- QTLWExtra* topData() { return d_func()->topData(); }
-};
-
-void QVistaHelper::collapseTopFrameStrut()
-{
- QTLWExtra *top = ((QHackWidget *)wizard)->d_func()->topData();
- int x1, y1, x2, y2;
- top->frameStrut.getCoords(&x1, &y1, &x2, &y2);
- top->frameStrut.setCoords(x1, 0, x2, y2);
-}
-
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
{
if (message->message == WIZ_WM_THEMECHANGED || message->message == WIZ_WM_DWMCOMPOSITIONCHANGED)
@@ -489,12 +489,8 @@ bool QVistaHelper::handleWinEvent(MSG *message, long *result)
bool status = false;
if (wizard->wizardStyle() == QWizard::AeroStyle && vistaState() == VistaAero) {
status = winEvent(message, result);
- if (message->message == WM_NCCALCSIZE) {
-// if (status) #fixme
-// collapseTopFrameStrut();
- } else if (message->message == WM_NCPAINT) {
+ if (message->message == WM_NCPAINT)
wizard->update();
- }
}
return status;
}
@@ -598,8 +594,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- msg.hwnd = handle;
+ msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCMOUSEMOVE;
@@ -613,8 +608,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- msg.hwnd = handle;
+ msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONDOWN;
@@ -629,8 +623,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- msg.hwnd = handle;
+ msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONUP;
@@ -657,6 +650,31 @@ HFONT QVistaHelper::getCaptionFont(HANDLE hTheme)
return CreateFontIndirect(&lf);
}
+// Return a HDC for the wizard along with the transformation if the
+// wizard is a child window.
+HDC QVistaHelper::backingStoreDC(const QWidget *wizard, QPoint *offset)
+{
+ HDC hdc = static_cast<HDC>(QGuiApplication::platformNativeInterface()->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), wizard->backingStore()));
+ *offset = QPoint(0, 0);
+ if (!wizard->windowHandle())
+ if (QWidget *nativeParent = wizard->nativeParentWidget())
+ *offset = wizard->mapTo(nativeParent, *offset);
+ return hdc;
+}
+
+HWND QVistaHelper::wizardHWND() const
+{
+ // Obtain the HWND if the wizard is a top-level window.
+ // Do not use winId() as this enforces native children of the parent
+ // widget when called before show() as happens when calling setWizardStyle().
+ if (QWindow *window = wizard->windowHandle())
+ if (window->handle())
+ if (void *vHwnd = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("handle"), window))
+ return static_cast<HWND>(vHwnd);
+ qWarning().nospace() << "Failed to obtain HWND for wizard.";
+ return 0;
+}
+
bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc)
{
bool value = false;
@@ -677,14 +695,14 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
dib.bmiHeader.biPlanes = 1;
dib.bmiHeader.biBitCount = 32;
dib.bmiHeader.biCompression = BI_RGB;
-
+
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
// Set up the DC
HFONT hCaptionFont = getCaptionFont(hTheme);
HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
-
+
// Draw the text!
WIZ_DTTOPTS dto;
dto.dwSize = sizeof(WIZ_DTTOPTS);
@@ -693,7 +711,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
dto.dwFlags = WIZ_DTT_COMPOSITED|WIZ_DTT_GLOWSIZE;
dto.iGlowSize = glowSize();
-
+
pDrawThemeTextEx(hTheme, dcMem, 0, 0, (LPCWSTR)text.utf16(), -1, uFormat, &rctext, &dto );
BitBlt(hdc, rect.left(), rect.top(), rect.width(), rect.height(), dcMem, 0, 0, SRCCOPY);
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
@@ -725,7 +743,7 @@ bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
dib.bmiHeader.biPlanes = 1;
dib.bmiHeader.biBitCount = 32;
dib.bmiHeader.biCompression = BI_RGB;
-
+
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
@@ -789,6 +807,19 @@ int QVistaHelper::titleOffset()
return leftMargin() + iconOffset;
}
+int QVistaHelper::topOffset()
+{
+ if (vistaState() != VistaAero)
+ return titleBarSize() + 3;
+ static const int aeroOffset =
+ QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ?
+ QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
+ int result = aeroOffset;
+ if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
+ result += titleBarSize();
+ return result;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_STYLE_WINDOWSVISTA
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index cd0b2da38e..a7713d889b 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,6 +53,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA
@@ -87,6 +89,7 @@ public:
QVistaHelper(QWizard *wizard);
~QVistaHelper();
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
+ void updateCustomMargins(bool vistaMargins);
bool setDWMTitleBar(TitleBarChangeType type);
void setTitleBarIconAndCaptionVisible(bool visible);
void mouseEvent(QEvent *event);
@@ -94,9 +97,8 @@ public:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; }
- void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
+ void disconnectBackButton();
void hideBackButton() { if (backButton_) backButton_->hide(); }
- void setWindowPosHack();
QColor basicWindowFrameColor();
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
static VistaState vistaState();
@@ -105,12 +107,13 @@ public:
return int(QStyleHelper::dpiScaled(
QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
}
- static int topOffset() {
- static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
- QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
- return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
+ static int topOffset();
+
+ static HDC backingStoreDC(const QWidget *wizard, QPoint *offset);
+
private:
static HFONT getCaptionFont(HANDLE hTheme);
+ HWND wizardHWND() const;
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
static bool drawBlackRect(const QRect &rect, HDC hdc);