diff options
author | Liang Qi <liang.qi@qt.io> | 2018-12-04 09:58:43 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-12-04 09:58:43 +0100 |
commit | 5d5c00c67682bce105197b659687fd1fee8f60cf (patch) | |
tree | 686e41dc3ea121235fb73afb9157ed603f1bfeff /src/widgets | |
parent | f213e818f03d35cb82e3daf187415197fd156f8e (diff) | |
parent | b82559244e2dc03f1ceff66bb67630df4300dc7c (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
src/gui/painting/qdrawhelper.cpp
Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwindowcontainer.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qfocusframe.cpp | 20 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbutton.cpp | 18 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol_p.h | 6 |
6 files changed, 55 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index d2680e5280..4b289d2d33 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -231,7 +231,7 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt: QString windowName = d->window->objectName(); if (windowName.isEmpty()) windowName = QString::fromUtf8(d->window->metaObject()->className()); - d->fakeParent.setObjectName(windowName + "ContainerFakeParent"); + d->fakeParent.setObjectName(windowName + QLatin1String("ContainerFakeParent")); d->window->setParent(&d->fakeParent); setAcceptDrops(true); @@ -315,6 +315,7 @@ bool QWindowContainer::event(QEvent *e) d->window->setParent(d->usesNativeWidgets ? windowHandle() : window()->windowHandle()); + d->fakeParent.destroy(); } if (d->window->parent()) { d->markParentChain(); @@ -404,6 +405,7 @@ void QWindowContainer::parentWasChanged(QWidget *parent) Q_ASSERT(toplevel->windowHandle()); } d->window->setParent(toplevel->windowHandle()); + d->fakeParent.destroy(); d->updateGeometry(); } } diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 5231f04df9..df151067df 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -247,6 +247,9 @@ static QLinearGradient qt_fusion_gradient(const QRect &rect, const QBrush &baseC static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QStyleOption *option, const QRect &rect, const QColor &color) { + if (rect.isEmpty()) + return; + const int arrowWidth = QStyleHelper::dpiScaled(14); const int arrowHeight = QStyleHelper::dpiScaled(8); 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; } |