summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp11
-rw-r--r--src/widgets/dialogs/qdialog.cpp9
-rw-r--r--src/widgets/dialogs/qdialog_p.h12
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp24
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp39
-rw-r--r--src/widgets/dialogs/qfiledialog.h3
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h16
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp48
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h4
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp3
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/dialogs/qmessagebox.h2
-rw-r--r--src/widgets/dialogs/qsidebar.cpp10
-rw-r--r--src/widgets/dialogs/qsidebar_p.h9
-rw-r--r--src/widgets/dialogs/qwizard.cpp4
-rw-r--r--src/widgets/dialogs/qwizard.h4
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp12
17 files changed, 159 insertions, 55 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 39eacae596..dbcd2d7fe2 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -355,7 +355,7 @@ void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
paintCellContents(p, row, col, opt.rect.adjusted(dfw, dfw, -dfw, -dfw));
}
-/*!
+/*
Reimplement this function to change the contents of the well array.
*/
void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r)
@@ -441,16 +441,12 @@ void QWellArray::focusInEvent(QFocusEvent*)
emit currentChanged(curRow, curCol);
}
-/*!\reimp
-*/
void QWellArray::focusOutEvent(QFocusEvent*)
{
updateCell(curRow, curCol);
}
-/*\reimp
-*/
void QWellArray::keyPressEvent(QKeyEvent* e)
{
switch(e->key()) { // Look at the key code
@@ -2250,10 +2246,13 @@ bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e)
bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e)
{
Q_Q(QColorDialog);
+#if QT_CONFIG(shortcut)
if (e->matches(QKeySequence::Cancel)) {
releaseColorPicking();
q->setCurrentColor(beforeScreenColorPicking);
- } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
+ } else
+#endif
+ if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
q->setCurrentColor(grabScreenColor(QCursor::pos()));
releaseColorPicking();
}
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index e5715ecd57..8e74c659fa 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -43,7 +43,6 @@
#include "qevent.h"
#include "qdesktopwidget.h"
-#include "qpushbutton.h"
#include "qapplication.h"
#include "qlayout.h"
#include "qsizegrip.h"
@@ -367,6 +366,7 @@ QDialog::~QDialog()
default default button becomes the default button. This is what a
push button calls when it loses focus.
*/
+#if QT_CONFIG(pushbutton)
void QDialogPrivate::setDefault(QPushButton *pushButton)
{
Q_Q(QDialog);
@@ -411,6 +411,7 @@ void QDialogPrivate::hideDefault()
list.at(i)->setDefault(false);
}
}
+#endif
void QDialogPrivate::resetModalitySetByOpen()
{
@@ -644,6 +645,7 @@ void QDialog::keyPressEvent(QKeyEvent *e)
#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
+#if QT_CONFIG(pushbutton)
case Qt::Key_Enter:
case Qt::Key_Return: {
QList<QPushButton*> list = findChildren<QPushButton*>();
@@ -657,6 +659,7 @@ void QDialog::keyPressEvent(QKeyEvent *e)
}
}
break;
+#endif
default:
e->ignore();
return;
@@ -716,6 +719,7 @@ void QDialog::setVisible(bool visible)
and actually catches most cases... If not, then they simply
have to use [widget*]->setFocus() themselves...
*/
+#if QT_CONFIG(pushbutton)
if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) {
QWidget *first = fw;
while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus)
@@ -733,6 +737,7 @@ void QDialog::setVisible(bool visible)
}
}
}
+#endif
if (fw && !fw->hasFocus()) {
QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason);
QApplication::sendEvent(fw, &e);
@@ -760,10 +765,12 @@ void QDialog::setVisible(bool visible)
d->eventLoop->exit();
}
+#if QT_CONFIG(pushbutton)
const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
if (d->mainDef && isActiveWindow()
&& theme->themeHint(QPlatformTheme::DialogSnapToDefaultButton).toBool())
QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center()));
+#endif
}
/*!\reimp */
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index ae9e3bcc93..6723edae38 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -56,7 +56,9 @@
#include "QtCore/qeventloop.h"
#include "QtCore/qpointer.h"
#include "QtWidgets/qdialog.h"
+#if QT_CONFIG(pushbutton)
#include "QtWidgets/qpushbutton.h"
+#endif
#include <qpa/qplatformdialoghelper.h>
QT_BEGIN_NAMESPACE
@@ -69,7 +71,11 @@ class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate
public:
QDialogPrivate()
- : mainDef(0), orientation(Qt::Horizontal),extension(0), doShowExtension(false),
+ :
+#if QT_CONFIG(pushbutton)
+ mainDef(0),
+#endif
+ orientation(Qt::Horizontal),extension(0), doShowExtension(false),
#ifndef QT_NO_SIZEGRIP
resizer(0),
sizeGripEnabled(false),
@@ -84,7 +90,9 @@ public:
QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const;
void deletePlatformHelper();
+#if QT_CONFIG(pushbutton)
QPointer<QPushButton> mainDef;
+#endif
Qt::Orientation orientation;
QWidget *extension;
bool doShowExtension;
@@ -95,9 +103,11 @@ public:
#endif
QPoint lastRMBPress;
+#if QT_CONFIG(pushbutton)
void setDefault(QPushButton *);
void setMainDefault(QPushButton *);
void hideDefault();
+#endif
void resetModalitySetByOpen();
int rescode;
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 5fcbe3fe9d..8200135abe 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -62,6 +62,13 @@
QT_BEGIN_NAMESPACE
+namespace {
+struct Message {
+ QString content;
+ QString type;
+};
+}
+
class QErrorMessagePrivate : public QDialogPrivate
{
Q_DECLARE_PUBLIC(QErrorMessage)
@@ -70,7 +77,7 @@ public:
QCheckBox * again;
QTextEdit * errors;
QLabel * icon;
- std::queue<QPair<QString, QString> > pending;
+ std::queue<Message> pending;
QSet<QString> doNotShow;
QSet<QString> doNotShowType;
QString currentMessage;
@@ -163,14 +170,20 @@ static void jump(QtMsgType t, const QMessageLogContext & /*context*/, const QStr
switch (t) {
case QtDebugMsg:
- default:
rich = QErrorMessage::tr("Debug Message:");
break;
case QtWarningMsg:
rich = QErrorMessage::tr("Warning:");
break;
+ case QtCriticalMsg:
+ rich = QErrorMessage::tr("Critical Error:");
+ break;
case QtFatalMsg:
rich = QErrorMessage::tr("Fatal Error:");
+ break;
+ case QtInfoMsg:
+ rich = QErrorMessage::tr("Information:");
+ break;
}
rich = QString::fromLatin1("<p><b>%1</b></p>").arg(rich);
rich += Qt::convertFromPlainText(m, Qt::WhiteSpaceNormal);
@@ -297,9 +310,8 @@ bool QErrorMessagePrivate::isMessageToBeShown(const QString &message, const QStr
bool QErrorMessagePrivate::nextPending()
{
while (!pending.empty()) {
- QPair<QString,QString> &pendingMessage = pending.front();
- QString message = qMove(pendingMessage.first);
- QString type = qMove(pendingMessage.second);
+ QString message = std::move(pending.front().content);
+ QString type = std::move(pending.front().type);
pending.pop();
if (isMessageToBeShown(message, type)) {
#ifndef QT_NO_TEXTHTMLPARSER
@@ -349,7 +361,7 @@ void QErrorMessage::showMessage(const QString &message, const QString &type)
Q_D(QErrorMessage);
if (!d->isMessageToBeShown(message, type))
return;
- d->pending.push(qMakePair(message, type));
+ d->pending.push({message, type});
if (!isVisible() && d->nextPending())
show();
}
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 5892ec6a75..78e304950a 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -860,7 +860,7 @@ void QFileDialog::setVisible(bool visible)
}
}
- if (d->usingWidgets())
+ if (visible && d->usingWidgets())
d->qFileDialogUi->fileNameEdit->setFocus();
QDialog::setVisible(visible);
@@ -1461,6 +1461,19 @@ void QFileDialog::selectNameFilter(const QString &filter)
}
/*!
+ * \since 5.9
+ * \return The mimetype of the file that the user selected in the file dialog.
+ */
+QString QFileDialog::selectedMimeTypeFilter() const
+{
+ Q_D(const QFileDialog);
+ if (!d->usingWidgets())
+ return d->selectedMimeTypeFilter_sys();
+
+ return d->options->initiallySelectedMimeTypeFilter();
+}
+
+/*!
\since 4.4
Returns the filter that the user selected in the file dialog.
@@ -1579,9 +1592,19 @@ QStringList QFileDialog::mimeTypeFilters() const
*/
void QFileDialog::selectMimeTypeFilter(const QString &filter)
{
- const QString text = nameFilterForMime(filter);
- if (!text.isEmpty())
- selectNameFilter(text);
+ Q_D(QFileDialog);
+ d->options->setInitiallySelectedMimeTypeFilter(filter);
+
+ const QString filterForMime = nameFilterForMime(filter);
+
+ if (!d->usingWidgets()) {
+ d->selectMimeTypeFilter_sys(filter);
+ if (d->selectedMimeTypeFilter_sys().isEmpty() && !filterForMime.isEmpty()) {
+ selectNameFilter(filterForMime);
+ }
+ } else if (!filterForMime.isEmpty()) {
+ selectNameFilter(filterForMime);
+ }
}
#endif // QT_NO_MIMETYPE
@@ -2223,7 +2246,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
}
/*!
- This is a convenience static function that will return or or more existing
+ This is a convenience static function that will return one or more existing
files selected by the user. If the user presses Cancel, it returns an
empty list.
@@ -3790,12 +3813,12 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory)
bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
Q_Q(QFileDialog);
-
+#if QT_CONFIG(shortcut)
if (event->matches(QKeySequence::Cancel)) {
q->reject();
return true;
}
-
+#endif
switch (event->key()) {
case Qt::Key_Backspace:
_q_navigateToParent();
@@ -3997,7 +4020,9 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
int key = e->key();
QLineEdit::keyPressEvent(e);
+#if QT_CONFIG(shortcut)
if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back)
+#endif
e->accept();
}
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index 4ade50793d..7959eebd7b 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -62,7 +62,6 @@ class QAbstractProxyModel;
class Q_WIDGETS_EXPORT QFileDialog : public QDialog
{
Q_OBJECT
- Q_FLAGS(Options)
Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode)
Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode)
Q_PROPERTY(AcceptMode acceptMode READ acceptMode WRITE setAcceptMode)
@@ -97,6 +96,7 @@ public:
};
Q_ENUM(Option)
Q_DECLARE_FLAGS(Options, Option)
+ Q_FLAG(Options)
QFileDialog(QWidget *parent, Qt::WindowFlags f);
explicit QFileDialog(QWidget *parent = Q_NULLPTR,
@@ -125,6 +125,7 @@ public:
void setNameFilters(const QStringList &filters);
QStringList nameFilters() const;
void selectNameFilter(const QString &filter);
+ QString selectedMimeTypeFilter() const;
QString selectedNameFilter() const;
#ifndef QT_NO_MIMETYPE
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index afebad4457..b665b54a9b 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -258,6 +258,8 @@ public:
void selectFile_sys(const QUrl &filename);
QList<QUrl> selectedFiles_sys() const;
void setFilter_sys();
+ void selectMimeTypeFilter_sys(const QString &filter);
+ QString selectedMimeTypeFilter_sys() const;
void selectNameFilter_sys(const QString &filter);
QString selectedNameFilter_sys() const;
//////////////////////////////////////////////
@@ -400,6 +402,20 @@ inline void QFileDialogPrivate::setFilter_sys()
helper->setFilter();
}
+inline void QFileDialogPrivate::selectMimeTypeFilter_sys(const QString &filter)
+{
+ if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
+ helper->selectMimeTypeFilter(filter);
+}
+
+QString QFileDialogPrivate::selectedMimeTypeFilter_sys() const
+{
+ if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
+ return helper->selectedMimeTypeFilter();
+
+ return QString();
+}
+
inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 6df020dd58..08c5a40c7c 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -65,6 +65,18 @@ Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot()
}
#endif
+static QString translateDriveName(const QFileInfo &drive)
+{
+ QString driveName = drive.absoluteFilePath();
+#ifdef Q_OS_WIN
+ if (driveName.startsWith(QLatin1Char('/'))) // UNC host
+ return drive.fileName();
+ if (driveName.endsWith(QLatin1Char('/')))
+ driveName.chop(1);
+#endif // Q_OS_WIN
+ return driveName;
+}
+
/*!
Creates thread
*/
@@ -82,6 +94,16 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString)));
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString)));
+
+# if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+ const QVariant listener = watcher->property("_q_driveListener");
+ if (listener.canConvert<QObject *>()) {
+ if (QObject *driveListener = listener.value<QObject *>()) {
+ connect(driveListener, SIGNAL(driveAdded()), this, SLOT(driveAdded()));
+ connect(driveListener, SIGNAL(driveRemoved(QString)), this, SLOT(driveRemoved()));
+ }
+ }
+# endif // Q_OS_WIN && !Q_OS_WINRT
#endif
start(LowPriority);
}
@@ -106,6 +128,20 @@ void QFileInfoGatherer::setResolveSymlinks(bool enable)
#endif
}
+void QFileInfoGatherer::driveAdded()
+{
+ fetchExtendedInformation(QString(), QStringList());
+}
+
+void QFileInfoGatherer::driveRemoved()
+{
+ QStringList drives;
+ const QFileInfoList driveInfoList = QDir::drives();
+ for (const QFileInfo &fi : driveInfoList)
+ drives.append(translateDriveName(fi));
+ newListOfFiles(QString(), drives);
+}
+
bool QFileInfoGatherer::resolveSymlinks() const
{
#ifdef Q_OS_WIN
@@ -260,18 +296,6 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
return info;
}
-static QString translateDriveName(const QFileInfo &drive)
-{
- QString driveName = drive.absoluteFilePath();
-#if defined(Q_OS_WIN)
- if (driveName.startsWith(QLatin1Char('/'))) // UNC host
- return drive.fileName();
- if (driveName.endsWith(QLatin1Char('/')))
- driveName.chop(1);
-#endif
- return driveName;
-}
-
/*
Get specific file info's, batch the files so update when we have 100
items and every 200ms after that
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index 3186e9d015..0018b6c387 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -180,6 +180,10 @@ public Q_SLOTS:
void setResolveSymlinks(bool enable);
void setIconProvider(QFileIconProvider *provider);
+private Q_SLOTS:
+ void driveAdded();
+ void driveRemoved();
+
private:
void run() Q_DECL_OVERRIDE;
// called by run():
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 955e93a26f..b20a1449eb 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -867,8 +867,7 @@ QFont QFontDialog::selectedFont() const
\value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)
\value DontUseNativeDialog Use Qt's standard font dialog on the Mac instead of Apple's
- native font panel. (Currently, the native dialog is never used,
- but this is likely to change in future Qt releases.)
+ native font panel.
\value ScalableFonts Show scalable fonts
\value NonScalableFonts Show non scalable fonts
\value MonospacedFonts Show monospaced fonts
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 98d070e493..3b0a71518d 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1405,7 +1405,7 @@ void QMessageBox::changeEvent(QEvent *ev)
void QMessageBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QMessageBox);
-
+#if QT_CONFIG(shortcut)
if (e->matches(QKeySequence::Cancel)) {
if (d->detectedEscapeButton) {
#ifdef Q_OS_MAC
@@ -1416,7 +1416,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
}
return;
}
-
+#endif // QT_CONFIG(shortcut)
#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index c6a55964fe..3e561a5161 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -56,7 +56,6 @@ class QCheckBox;
class Q_WIDGETS_EXPORT QMessageBox : public QDialog
{
Q_OBJECT
- Q_FLAGS(StandardButtons)
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(Icon icon READ icon WRITE setIcon)
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
@@ -131,6 +130,7 @@ public:
typedef StandardButton Button; // obsolete
Q_DECLARE_FLAGS(StandardButtons, StandardButton)
+ Q_FLAG(StandardButtons)
explicit QMessageBox(QWidget *parent = Q_NULLPTR);
QMessageBox(Icon icon, const QString &title, const QString &text,
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 713ccb6556..9bb046db61 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -274,7 +274,7 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move)
continue;
insertRows(row, 1);
setUrl(index(row, 0), url, idx);
- watching.append(qMakePair(idx, cleanUrl));
+ watching.append({idx, cleanUrl});
}
}
@@ -326,7 +326,7 @@ void QUrlModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
{
QModelIndex parent = topLeft.parent();
for (int i = 0; i < watching.count(); ++i) {
- QModelIndex index = watching.at(i).first;
+ QModelIndex index = watching.at(i).index;
if (index.model() && topLeft.model()) {
Q_ASSERT(index.model() == topLeft.model());
}
@@ -335,7 +335,7 @@ void QUrlModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
&& index.column() >= topLeft.column()
&& index.column() <= bottomRight.column()
&& index.parent() == parent) {
- changed(watching.at(i).second);
+ changed(watching.at(i).path);
}
}
}
@@ -349,12 +349,12 @@ void QUrlModel::layoutChanged()
const int numPaths = watching.count();
paths.reserve(numPaths);
for (int i = 0; i < numPaths; ++i)
- paths.append(watching.at(i).second);
+ paths.append(watching.at(i).path);
watching.clear();
for (int i = 0; i < numPaths; ++i) {
QString path = paths.at(i);
QModelIndex newIndex = fileSystemModel->index(path);
- watching.append(QPair<QModelIndex, QString>(newIndex, path));
+ watching.append({newIndex, path});
if (newIndex.isValid())
changed(path);
}
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 3e177e7e68..0685e81b2b 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -108,9 +108,16 @@ private:
void changed(const QString &path);
void addIndexToWatch(const QString &path, const QModelIndex &index);
QFileSystemModel *fileSystemModel;
- QVector<QPair<QModelIndex, QString> > watching;
+ struct WatchItem {
+ QModelIndex index;
+ QString path;
+ };
+ friend class QTypeInfo<WatchItem>;
+
+ QVector<WatchItem> watching;
QList<QUrl> invalidUrls;
};
+Q_DECLARE_TYPEINFO(QUrlModel::WatchItem, Q_MOVABLE_TYPE);
class Q_AUTOTEST_EXPORT QSidebar : public QListView
{
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 9153d7ea41..5e598ba990 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1465,8 +1465,10 @@ void QWizardPrivate::updateButtonTexts()
// Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right
// even in RTL mode, so do the same, even if it might be counter-intuitive.
// The shortcut for 'back' is set in class QVistaBackButton.
+#if QT_CONFIG(shortcut)
if (btns[QWizard::NextButton])
btns[QWizard::NextButton]->setShortcut(isVistaThemeEnabled() ? QKeySequence(Qt::ALT | Qt::Key_Right) : QKeySequence());
+#endif
}
void QWizardPrivate::updateButtonLayout()
@@ -3255,7 +3257,7 @@ void QWizard::paintEvent(QPaintEvent * event)
#endif
}
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
/*!
\reimp
*/
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 9ce68b6566..7915c9e7f8 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -55,7 +55,6 @@ class QWizardPrivate;
class Q_WIDGETS_EXPORT QWizard : public QDialog
{
Q_OBJECT
- Q_FLAGS(WizardOptions)
Q_PROPERTY(WizardStyle wizardStyle READ wizardStyle WRITE setWizardStyle)
Q_PROPERTY(WizardOptions options READ options WRITE setOptions)
Q_PROPERTY(Qt::TextFormat titleFormat READ titleFormat WRITE setTitleFormat)
@@ -120,6 +119,7 @@ public:
Q_ENUM(WizardOption)
Q_DECLARE_FLAGS(WizardOptions, WizardOption)
+ Q_FLAG(WizardOptions)
explicit QWizard(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
~QWizard();
@@ -188,7 +188,7 @@ protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
#endif
void done(int result) Q_DECL_OVERRIDE;
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 80e37dab25..4ab01aca66 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -49,6 +49,7 @@
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
+#include <QtCore/QOperatingSystemVersion>
#include <QtCore/QVariant>
#include <QtCore/QDebug>
#include <QtGui/QMouseEvent>
@@ -214,8 +215,7 @@ void QVistaHelper::disconnectBackButton()
QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
- HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
- const HANDLE hTheme = OpenThemeData(handle, L"WINDOW");
+ const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
GetThemeColor(hTheme, WP_CAPTION, CS_ACTIVE,
wizard->isActiveWindow() ? TMT_FILLCOLORHINT : TMT_BORDERCOLORHINT, &rgb);
BYTE r = GetRValue(rgb);
@@ -257,8 +257,7 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme)
static bool getCaptionQFont(int dpi, QFont *result)
{
- const HANDLE hTheme =
- OpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW");
+ const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
if (!hTheme)
return false;
// Call into QWindowsNativeInterface to convert the LOGFONT into a QFont.
@@ -589,8 +588,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
if (vistaState() == VistaAero) {
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
rect.size() * QVistaHelper::m_devicePixelRatio);
- HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
- const HANDLE hTheme = OpenThemeData(handle, L"WINDOW");
+ const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
if (!hTheme) return false;
// Set up a memory DC and bitmap that we'll draw into
HDC dcMem;
@@ -718,7 +716,7 @@ int QVistaHelper::topOffset()
if (vistaState() != VistaAero)
return titleBarSize() + 3;
static const int aeroOffset =
- QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ?
+ QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8 ?
QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
return aeroOffset + titleBarSize();
}