summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-29 01:00:09 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-29 01:00:10 +0200
commit0e1866017fd389629629b150ce252820592506cd (patch)
tree681142ae0e610ef7af2a43ca2d62c3ea5ed5f91a /src/widgets
parent9567a34bc0d9be87d3b0d6cbcb841837ca1d5659 (diff)
parent9a8175a13124e156948914854d2fda7436065b08 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/configure.json2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp23
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp3
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp3
-rw-r--r--src/widgets/kernel/qwidget.cpp6
-rw-r--r--src/widgets/util/qcompleter.cpp9
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
11 files changed, 38 insertions, 18 deletions
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 0015c9160a..b3a5227d26 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -81,7 +81,7 @@
"label": "QFileSystemModel",
"purpose": "Provides a data model for the local filesystem.",
"section": "File I/O",
- "condition": "features.itemmodel && features.thread",
+ "condition": "features.itemmodel",
"output": [ "publicFeature", "feature" ]
},
"itemviews": {
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index e4edd2f6ef..e54fdc97d4 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -797,7 +797,7 @@ QString QFileSystemModelPrivate::time(const QModelIndex &index) const
{
if (!index.isValid())
return QString();
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
return node(index)->lastModified().toString(Qt::SystemLocaleDate);
#else
Q_UNUSED(index);
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 6de952a1d3..c9f72da060 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;
@@ -2678,7 +2689,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;
}
/*!
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 7cc694a613..37af4ecda0 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -3215,7 +3215,8 @@ void QGraphicsScene::update(const QRectF &rect)
view->d_func()->updateRectF(rect);
}
} else {
- d->updatedRects << rect;
+ if (!d->updatedRects.contains(rect))
+ d->updatedRects << rect;
}
}
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 449850c42e..78fc623fb5 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1319,7 +1319,7 @@ QString QDirModelPrivate::type(const QModelIndex &index) const
QString QDirModelPrivate::time(const QModelIndex &index) const
{
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
return node(index)->info.lastModified().toString(Qt::LocalDate);
#else
Q_UNUSED(index);
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 2f276a7a8c..b7de69d63a 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2213,9 +2213,6 @@ void QHeaderViewPrivate::_q_sectionsAboutToBeChanged(const QList<QPersistentMode
? model->index(0, logical, root)
: model->index(logical, 0, root),
s});
-
- if (layoutChangePersistentSections.size() > 1000)
- break;
}
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 4adccceebb..a1a861e216 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -4497,16 +4497,14 @@ void QWidget::setForegroundRole(QPalette::ColorRole role)
and these styles typically do not follow the palette. Because of this,
assigning roles to a widget's palette is not guaranteed to change the
appearance of the widget. Instead, you may choose to apply a \l
- styleSheet. You can refer to our Knowledge Base article
- \l{http://qt.nokia.com/developer/knowledgebase/22}{here} for more
- information.
+ styleSheet.
\warning Do not use this function in conjunction with \l{Qt Style Sheets}.
When using style sheets, the palette of a widget can be customized using
the "color", "background-color", "selection-color",
"selection-background-color" and "alternate-background-color".
- \sa QApplication::palette(), QWidget::font()
+ \sa QApplication::palette(), QWidget::font(), \l {Qt Style Sheets}
*/
const QPalette &QWidget::palette() const
{
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index df280119cb..0daa4a4b41 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1243,7 +1243,14 @@ void QCompleter::setPopup(QAbstractItemView *popup)
Qt::FocusPolicy origPolicy = Qt::NoFocus;
if (d->widget)
origPolicy = d->widget->focusPolicy();
- popup->setParent(nullptr, Qt::Popup);
+
+ // Mark the widget window as a popup, so that if the last non-popup window is closed by the
+ // user, the application should not be prevented from exiting. It needs to be set explicitly via
+ // setWindowFlag(), because passing the flag via setParent(parent, windowFlags) does not call
+ // QWidgetPrivate::adjustQuitOnCloseAttribute(), and causes an application not to exit if the
+ // popup ends up being the last window.
+ popup->setParent(nullptr);
+ popup->setWindowFlag(Qt::Popup);
popup->setFocusPolicy(Qt::NoFocus);
if (d->widget)
d->widget->setFocusPolicy(origPolicy);
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 3026a5b7d6..54504d124b 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3295,6 +3295,8 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
delta = pick(o, dest - origin);
delta = separatorMoveHelper(list, sep_index, delta, sep);
+ fallbackToSizeHints = false;
+
if (index == QInternal::LeftDock || index == QInternal::RightDock)
setGrid(0, &list);
else
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 8639f57ea1..f32cd26478 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -954,7 +954,7 @@ void QMdiAreaPrivate::rearrange(Rearranger *rearranger)
}
}
- if (active && rearranger->type() == Rearranger::RegularTiler) {
+ if (active && rearranger->type() == Rearranger::RegularTiler && !tileCalledFromResizeEvent) {
// Move active window in front if necessary. That's the case if we
// have any windows with staysOnTopHint set.
int indexToActive = widgets.indexOf((QWidget *)active);
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 000f33e350..63db93d43f 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -2633,8 +2633,8 @@ void QPlainTextEdit::setReadOnly(bool ro)
} else {
flags = Qt::TextEditorInteraction;
}
- setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
d->control->setTextInteractionFlags(flags);
+ setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
QEvent event(QEvent::ReadOnlyChange);
QApplication::sendEvent(this, &event);
}