summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-12-04 19:41:52 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-12-04 19:41:52 +0000
commit009a5538ebce4c5517a717a201707f2b79749f64 (patch)
tree9dfd3f3d3b6ab997eeb37215e948b5af7160beb8 /src/widgets/widgets
parente19df161cdc14f834a278fe0939d50475864a78c (diff)
parent5d5c00c67682bce105197b659687fd1fee8f60cf (diff)
Merge "Merge remote-tracking branch 'origin/5.12' into dev" into refs/staging/dev
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp8
-rw-r--r--src/widgets/widgets/qfocusframe.cpp20
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp18
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h6
4 files changed, 49 insertions, 3 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index fca81bec48..68bfd175ff 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -273,7 +273,13 @@ void QDateTimeEdit::setDate(const QDate &date)
setDateRange(date, date);
d->clearCache();
- d->setValue(QDateTime(date, d->value.toTime(), d->spec), EmitIfChanged);
+ QDateTime when(date, d->value.toTime(), d->spec);
+ // The specified time might not exist on the specified day,
+ // i.e. the time is in the gap a spring-forward jumps over.
+ if (!when.isValid())
+ when = QDateTime::fromMSecsSinceEpoch(when.toMSecsSinceEpoch(), d->spec);
+ Q_ASSERT(when.isValid());
+ d->setValue(when, EmitIfChanged);
d->updateTimeSpec();
}
}
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index 8b8f4db86e..0992becdf0 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -335,7 +335,25 @@ QFocusFrame::eventFilter(QObject *o, QEvent *e)
/*! \reimp */
bool QFocusFrame::event(QEvent *e)
{
- return QWidget::event(e);
+ Q_D(QFocusFrame);
+
+ switch (e->type()) {
+ case QEvent::Move:
+ case QEvent::Resize:
+ if (d->widget) {
+ // When we're tracking a widget, we don't allow anyone to move the focus frame around.
+ // We do our best with event filters to make it stay on top of the widget, so trying to
+ // move the frame somewhere else will be flaky at best. This can e.g happen for general
+ // purpose code, like QAbstractScrollView, that bulk-moves all children a certain distance.
+ // So we need to call updateSize() when that happens to ensure that the focus frame stays
+ // on top of the widget.
+ d->updateSize();
+ }
+ break;
+ default:
+ return QWidget::event(e);
+ }
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 03950ef44b..6a24712319 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -898,7 +898,23 @@ bool QToolButton::autoRaise() const
Sets the default action to \a action.
If a tool button has a default action, the action defines the
- button's properties like text, icon, tool tip, etc.
+ following properties of the button:
+
+ \list
+ \li \l {QAbstractButton::}{checkable}
+ \li \l {QAbstractButton::}{checked}
+ \li \l {QWidget::}{enabled}
+ \li \l {QWidget::}{font}
+ \li \l {QAbstractButton::}{icon}
+ \li \l {QToolButton::}{popupMode} (assuming the action has a menu)
+ \li \l {QWidget::}{statusTip}
+ \li \l {QAbstractButton::}{text}
+ \li \l {QWidget::}{toolTip}
+ \li \l {QWidget::}{whatsThis}
+ \endlist
+
+ Other properties, such as \l autoRepeat, are not affected
+ by actions.
*/
void QToolButton::setDefaultAction(QAction *action)
{
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index 3e33bc0605..b730b415f0 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -110,6 +110,12 @@ public:
~QWidgetLineControl()
{
+ // If this control is used for password input, we don't want the
+ // password data to stay in the process memory, therefore we need
+ // to zero it out
+ if (m_echoMode != QLineEdit::Normal)
+ m_text.fill('\0');
+
delete [] m_maskData;
}