summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp5
-rw-r--r--src/widgets/dialogs/qcolordialog.h5
-rw-r--r--src/widgets/dialogs/qdialog.cpp20
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp39
-rw-r--r--src/widgets/dialogs/qfiledialog.h2
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h14
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp35
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h6
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp1
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp7
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp31
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp1
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp6
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h15
14 files changed, 105 insertions, 82 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 99946d341d..4aa680af61 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -2123,7 +2123,6 @@ void QColorDialog::setVisible(bool visible)
}
/*!
- \overload
\since 4.5
Opens the dialog and connects its colorSelected() signal to the slot specified
@@ -2162,6 +2161,7 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
return dlg.selectedColor();
}
+#if QT_DEPRECATED_SINCE(5, 12)
/*!
\obsolete
@@ -2169,7 +2169,7 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
and an alpha channel (transparency) value. The color+alpha is
initially set to \a initial. The dialog is a child of \a parent.
- If \a ok is non-null, \e *\a ok is set to true if the user clicked
+ If \a ok is non-null, \e {*ok} is set to true if the user clicked
\uicontrol{OK}, and to false if the user clicked Cancel.
If the user clicks Cancel, the \a initial value is returned.
@@ -2187,6 +2187,7 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
*ok = color.isValid();
return result;
}
+#endif
/*!
Destroys the color dialog.
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 6451ff9bde..cdbe0e7fb4 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -92,8 +92,9 @@ public:
const QString &title = QString(),
ColorDialogOptions options = ColorDialogOptions());
- // obsolete
- static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = nullptr, QWidget *parent = nullptr);
+#if QT_DEPRECATED_SINCE(5, 12)
+ QT_DEPRECATED_X("Use getColor()") static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = nullptr, QWidget *parent = nullptr);
+#endif
static int customCount();
static QColor customColor(int index);
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index f5db4481ee..06f0393b4c 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -100,6 +100,10 @@ static inline int themeDialogType(const QDialog *dialog)
if (qobject_cast<const QErrorMessage *>(dialog))
return QPlatformTheme::MessageDialog;
#endif
+#if !QT_CONFIG(filedialog) && !QT_CONFIG(colordialog) && !QT_CONFIG(fontdialog) && \
+ !QT_CONFIG(messagebox) && !QT_CONFIG(errormessage)
+ Q_UNUSED(dialog);
+#endif
return -1;
}
@@ -514,6 +518,13 @@ void QDialog::open()
interaction with the parent window is blocked while the dialog is open.
By default, the dialog is application modal.
+ \note Avoid using this function; instead, use \c{open()}. Unlike exec(),
+ open() is asynchronous, and does not spin an additional event loop. This
+ prevents a series of dangerous bugs from happening (e.g. deleting the
+ dialog's parent while the dialog is open via exec()). When using open() you
+ can connect to the finished() signal of QDialog to be notified when the
+ dialog is closed.
+
\sa open(), show(), result(), setWindowModality()
*/
@@ -560,9 +571,12 @@ int QDialog::exec()
}
/*!
- Closes the dialog and sets its result code to \a r. If this dialog
- is shown with exec(), done() causes the local event loop to finish,
- and exec() to return \a r.
+ Closes the dialog and sets its result code to \a r. The finished() signal
+ will emit \a r; if \a r is QDialog::Accepted or QDialog::Rejected, the
+ accepted() or the rejected() signals will also be emitted, respectively.
+
+ If this dialog is shown with exec(), done() also causes the local event loop
+ to finish, and exec() to return \a r.
As with QWidget::close(), done() deletes the dialog if the
Qt::WA_DeleteOnClose flag is set. If the dialog is the application's
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 778e8556c7..5c6c03d3aa 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -519,7 +519,7 @@ void QFileDialog::changeEvent(QEvent *e)
QFileDialogPrivate::QFileDialogPrivate()
:
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
proxyModel(0),
#endif
model(0),
@@ -665,7 +665,7 @@ void QFileDialogPrivate::retranslateStrings()
QList<QAction*> actions = qFileDialogUi->treeView->header()->actions();
QAbstractItemModel *abstractModel = model;
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
if (proxyModel)
abstractModel = proxyModel;
#endif
@@ -804,8 +804,6 @@ QFileDialog::Options QFileDialog::options() const
}
/*!
- \overload
-
\since 4.5
This function connects one of its signals to the slot specified by \a receiver
@@ -1049,10 +1047,15 @@ void QFileDialog::selectFile(const QString &filename)
return;
if (!d->usingWidgets()) {
- QUrl url = QUrl::fromLocalFile(filename);
+ QUrl url;
if (QFileInfo(filename).isRelative()) {
- QDir dir(d->options->initialDirectory().toLocalFile());
- url = QUrl::fromLocalFile(dir.absoluteFilePath(filename));
+ url = d->options->initialDirectory();
+ QString path = url.path();
+ if (!path.endsWith(QLatin1Char('/')))
+ path += QLatin1Char('/');
+ url.setPath(path + filename);
+ } else {
+ url = QUrl::fromLocalFile(filename);
}
d->selectFile_sys(url);
d->options->setInitiallySelectedFiles(QList<QUrl>() << url);
@@ -1110,7 +1113,7 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path)
const QString homePath = QDir::homePath();
#else
const QByteArray userName = path.midRef(1, separatorPosition - 1).toLocal8Bit();
-# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
+# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_WASM)
passwd pw;
passwd *tmpPw;
char buf[200];
@@ -2108,9 +2111,7 @@ QString QFileDialog::labelText(DialogLabel label) const
strings. If you want multiple filters, separate them with ';;', for
example:
- \code
- "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
- \endcode
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 14
The \a options argument holds various options about how to run the dialog,
see the QFileDialog::Option enum for more information on the flags you can
@@ -2223,9 +2224,7 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent,
\a selectedFilter and \a filter may be empty strings. If you need multiple
filters, separate them with ';;', for instance:
- \code
- "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
- \endcode
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 14
The dialog's caption is set to \a caption. If \a caption is not specified
then a default caption will be used.
@@ -2339,9 +2338,7 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent,
parameters \a dir, \a selectedFilter, and \a filter may be empty strings.
Multiple filters are separated with ';;'. For instance:
- \code
- "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
- \endcode
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 14
The \a options argument holds various options about how to run the dialog,
see the QFileDialog::Option enum for more information on the flags you can
@@ -2815,7 +2812,7 @@ bool QFileDialogPrivate::restoreWidgetState(QStringList &history, int splitterPo
QList<QAction*> actions = headerView->actions();
QAbstractItemModel *abstractModel = model;
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
if (proxyModel)
abstractModel = proxyModel;
#endif
@@ -2984,7 +2981,7 @@ void QFileDialogPrivate::createWidgets()
q, SLOT(_q_showHeader(QAction*)));;
QAbstractItemModel *abstractModel = model;
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
if (proxyModel)
abstractModel = proxyModel;
#endif
@@ -3065,7 +3062,7 @@ void QFileDialogPrivate::_q_showHeader(QAction *action)
qFileDialogUi->treeView->header()->setSectionHidden(actionGroup->actions().indexOf(action) + 1, !action->isChecked());
}
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
/*!
\since 4.3
@@ -3143,7 +3140,7 @@ QAbstractProxyModel *QFileDialog::proxyModel() const
Q_D(const QFileDialog);
return d->proxyModel;
}
-#endif // QT_NO_PROXYMODEL
+#endif // QT_CONFIG(proxymodel)
/*!
\internal
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index b9a49d3d18..a4d289a77a 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -178,7 +178,7 @@ public:
void setSupportedSchemes(const QStringList &schemes);
QStringList supportedSchemes() const;
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
void setProxyModel(QAbstractProxyModel *model);
QAbstractProxyModel *proxyModel() const;
#endif
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index 17290381d3..3a93a53911 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -227,7 +227,7 @@ public:
void _q_fileRenamed(const QString &path, const QString &oldName, const QString &newName);
// layout
-#ifndef QT_NO_PROXYMODEL
+#if QT_CONFIG(proxymodel)
QAbstractProxyModel *proxyModel;
#endif
@@ -346,17 +346,17 @@ private:
};
QModelIndex QFileDialogPrivate::mapToSource(const QModelIndex &index) const {
-#ifdef QT_NO_PROXYMODEL
- return index;
-#else
+#if QT_CONFIG(proxymodel)
return proxyModel ? proxyModel->mapToSource(index) : index;
+#else
+ return index;
#endif
}
QModelIndex QFileDialogPrivate::mapFromSource(const QModelIndex &index) const {
-#ifdef QT_NO_PROXYMODEL
- return index;
-#else
+#if QT_CONFIG(proxymodel)
return proxyModel ? proxyModel->mapFromSource(index) : index;
+#else
+ return index;
#endif
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 3a30cb5b2a..8b3549c3f5 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -48,6 +48,9 @@
#endif
#include <qapplication.h>
#include <QtCore/qcollator.h>
+#if QT_CONFIG(regularexpression)
+# include <QtCore/qregularexpression.h>
+#endif
#include <algorithm>
@@ -1580,7 +1583,7 @@ bool QFileSystemModel::nameFilterDisables() const
void QFileSystemModel::setNameFilters(const QStringList &filters)
{
// Prep the regexp's ahead of time
-#ifndef QT_NO_REGEXP
+#if QT_CONFIG(regularexpression)
Q_D(QFileSystemModel);
if (!d->bypassFilters.isEmpty()) {
@@ -1601,11 +1604,7 @@ void QFileSystemModel::setNameFilters(const QStringList &filters)
}
}
- d->nameFilters.clear();
- const Qt::CaseSensitivity caseSensitive =
- (filter() & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive;
- for (const auto &filter : filters)
- d->nameFilters << QRegExp(filter, caseSensitive, QRegExp::Wildcard);
+ d->nameFilters = filters;
d->forceSort = true;
d->delayedSort();
#endif
@@ -1616,16 +1615,12 @@ void QFileSystemModel::setNameFilters(const QStringList &filters)
*/
QStringList QFileSystemModel::nameFilters() const
{
+#if QT_CONFIG(regularexpression)
Q_D(const QFileSystemModel);
- QStringList filters;
-#ifndef QT_NO_REGEXP
- const int numNameFilters = d->nameFilters.size();
- filters.reserve(numNameFilters);
- for (int i = 0; i < numNameFilters; ++i) {
- filters << d->nameFilters.at(i).pattern();
- }
+ return d->nameFilters;
+#else
+ return QStringList();
#endif
- return filters;
}
/*!
@@ -2026,15 +2021,21 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
*/
bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const
{
-#ifndef QT_NO_REGEXP
+#if QT_CONFIG(regularexpression)
if (nameFilters.isEmpty())
return true;
// Check the name regularexpression filters
if (!(node->isDir() && (filters & QDir::AllDirs))) {
+ const QRegularExpression::PatternOptions options =
+ (filters & QDir::CaseSensitive) ? QRegularExpression::NoPatternOption
+ : QRegularExpression::CaseInsensitiveOption;
+
for (const auto &nameFilter : nameFilters) {
- QRegExp copy = nameFilter;
- if (copy.exactMatch(node->fileName))
+ const QString wildcard = QRegularExpression::wildcardToRegularExpression(nameFilter);
+ QRegularExpression rx(QRegularExpression::anchoredPattern(wildcard), options);
+ QRegularExpressionMatch match = rx.match(node->fileName);
+ if (match.hasMatch())
return true;
}
return false;
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index a2a02e2d41..9c432e1ae6 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -294,8 +294,6 @@ public:
void _q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &);
void _q_resolvedName(const QString &fileName, const QString &resolvedName);
- static int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs);
-
QDir rootDir;
#if QT_CONFIG(filesystemwatcher)
# ifdef Q_OS_WIN
@@ -317,8 +315,8 @@ public:
//It enable a sort which is not recursive, it means
//we sort only what we see.
bool disableRecursiveSort;
-#ifndef QT_NO_REGEXP
- QList<QRegExp> nameFilters;
+#if QT_CONFIG(regularexpression)
+ QStringList nameFilters;
#endif
QHash<QString, QString> resolvedSymLinks;
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 5f912c582f..477c6bd540 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -931,7 +931,6 @@ QFontDialog::FontDialogOptions QFontDialog::options() const
/*!
\since 4.5
- \overload
Opens the dialog and connects its fontSelected() signal to the slot specified
by \a receiver and \a member.
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 5c6e0f45a5..5a7d6edddf 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -1070,7 +1070,6 @@ QString QInputDialog::cancelButtonText() const
/*!
\since 4.5
- \overload
This function connects one of its signals to the slot specified by \a receiver
and \a member. The specific signal depends on the arguments that are specified
@@ -1180,7 +1179,7 @@ void QInputDialog::done(int result)
\a inputMethodHints is the input method hints that will be used in the
edit widget if an input method is active.
- If \a ok is nonnull \e *\a ok will be set to true if the user pressed
+ If \a ok is nonnull \e {*ok} will be set to true if the user pressed
\uicontrol OK and to false if the user pressed \uicontrol Cancel. The dialog's parent
is \a parent. The dialog will be modal and uses the specified widget
\a flags.
@@ -1228,7 +1227,7 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
\a inputMethodHints is the input method hints that will be used in the
edit widget if an input method is active.
- If \a ok is nonnull \e *\a ok will be set to true if the user pressed
+ If \a ok is nonnull \e {*ok} will be set to true if the user pressed
\uicontrol OK and to false if the user pressed \uicontrol Cancel. The dialog's parent
is \a parent. The dialog will be modal and uses the specified widget
\a flags.
@@ -1436,7 +1435,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
If \a editable is true the user can enter their own text; otherwise, the
user may only select one of the existing items.
- If \a ok is nonnull \e *\a ok will be set to true if the user pressed
+ If \a ok is nonnull \e {*ok} will be set to true if the user pressed
\uicontrol OK and to false if the user pressed \uicontrol Cancel. The dialog's parent
is \a parent. The dialog will be modal and uses the widget \a flags.
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 6de952a1d3..99157747dd 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -64,6 +64,7 @@
#include <QtGui/qfont.h>
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
+#include "private/qabstractbutton_p.h"
#include <private/qdesktopwidget_p.h>
#ifdef Q_OS_WIN
@@ -492,9 +493,17 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
{
- Q_UNUSED(role);
Q_Q(QMessageBox);
- q->done(button);
+ if (button > QPlatformDialogHelper::LastButton) {
+ // It's a custom button, and the QPushButton in options is just a proxy
+ // for the button on the platform dialog. Simulate the user clicking it.
+ clickedButton = static_cast<QAbstractButton *>(options->customButton(button)->button);
+ Q_ASSERT(clickedButton);
+ clickedButton->click();
+ q->done(role);
+ } else {
+ q->done(button);
+ }
}
/*!
@@ -831,6 +840,8 @@ void QMessageBox::addButton(QAbstractButton *button, ButtonRole role)
if (!button)
return;
removeButton(button);
+ d->options->addButton(button->text(), static_cast<QPlatformDialogHelper::ButtonRole>(role),
+ button);
d->buttonBox->addButton(button, (QDialogButtonBox::ButtonRole)role);
d->customButtonList.append(button);
d->autoAddOkButton = false;
@@ -1064,7 +1075,7 @@ void QMessageBoxPrivate::detectEscapeButton()
or 0 if the user hit the \uicontrol Esc key and
no \l{setEscapeButton()}{escape button} was set.
- If exec() hasn't been called yet, returns 0.
+ If exec() hasn't been called yet, returns nullptr.
Example:
@@ -1082,7 +1093,7 @@ QAbstractButton *QMessageBox::clickedButton() const
\since 4.2
Returns the button that should be the message box's
- \l{QPushButton::setDefault()}{default button}. Returns 0
+ \l{QPushButton::setDefault()}{default button}. Returns nullptr
if no default button was set.
\sa addButton(), QPushButton::setDefault()
@@ -1489,8 +1500,6 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
}
/*!
- \overload
-
Opens the dialog and connects its finished() or buttonClicked() signal to
the slot specified by \a receiver and \a member. If the slot in \a member
has a pointer for its first parameter the connection is to buttonClicked(),
@@ -2678,7 +2687,11 @@ void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *)
void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
{
Q_Q(QMessageBox);
- clickedButton = q->button(QMessageBox::StandardButton(code));
+ QAbstractButton *button = q->button(QMessageBox::StandardButton(code));
+ // If it was a custom button, a custom ID was used, so we won't get a valid pointer here.
+ // In that case, clickedButton has already been set in _q_buttonClicked.
+ if (button)
+ clickedButton = button;
}
/*!
@@ -2730,7 +2743,7 @@ QPixmap QMessageBox::standardIcon(Icon icon)
Shows the message box as a \l{QDialog#Modal Dialogs}{modal dialog},
blocking until the user closes it.
- When using a QMessageBox with standard buttons, this functions returns a
+ When using a QMessageBox with standard buttons, this function returns a
\l StandardButton value indicating the standard button that was clicked.
When using QMessageBox with custom buttons, this function returns an
opaque value; use clickedButton() to determine which button was clicked.
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index a276e28a0c..4bf78e2115 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -865,7 +865,6 @@ void QProgressDialog::forceShow()
/*!
\since 4.5
- \overload
Opens the dialog and connects its canceled() signal to the slot specified
by \a receiver and \a member.
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 5ef304c9f1..aa9ad7f290 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -606,8 +606,8 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
// Set up the DC
const LOGFONT captionLogFont = getCaptionLogFont(hTheme);
const HFONT hCaptionFont = CreateFontIndirect(&captionLogFont);
- HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
- HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
+ auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
+ auto hOldFont = reinterpret_cast<HFONT>(SelectObject(dcMem, (HGDIOBJ) hCaptionFont));
// Draw the text!
DTTOPTS dto;
@@ -654,7 +654,7 @@ bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
dib.bmiHeader.biCompression = BI_RGB;
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
- HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
+ auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index 7ca4899a1f..d302dedaa3 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -71,22 +71,23 @@ class QVistaBackButton : public QAbstractButton
public:
QVistaBackButton(QWidget *widget);
- QSize sizeHint() const;
- inline QSize minimumSizeHint() const
+ QSize sizeHint() const override;
+ inline QSize minimumSizeHint() const override
{ return sizeHint(); }
- void enterEvent(QEvent *event);
- void leaveEvent(QEvent *event);
- void paintEvent(QPaintEvent *event);
+ void enterEvent(QEvent *event) override;
+ void leaveEvent(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
};
class QWizard;
class QVistaHelper : public QObject
{
+ Q_DISABLE_COPY(QVistaHelper)
public:
QVistaHelper(QWizard *wizard);
- ~QVistaHelper();
+ ~QVistaHelper() override;
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
void updateCustomMargins(bool vistaMargins);
bool setDWMTitleBar(TitleBarChangeType type);
@@ -133,7 +134,7 @@ private:
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
static int instanceCount;
static VistaState cachedVistaState;