summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidgetwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp282
1 files changed, 156 insertions, 126 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 32d89dbb44..f51baba88b 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qwindow_p.h"
#include "qwidgetwindow_p.h"
@@ -43,7 +7,7 @@
#include "private/qwidget_p.h"
#include "private/qapplication_p.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include <QtGui/qaccessible.h>
#endif
#include <private/qwidgetrepaintmanager_p.h>
@@ -55,6 +19,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets();
Q_WIDGETS_EXPORT QWidget *qt_button_down = nullptr; // widget got last button-down
@@ -73,18 +39,25 @@ public:
void setVisible(bool visible) override
{
Q_Q(QWidgetWindow);
+ qCDebug(lcWidgetShowHide) << "Setting visibility of" << q->widget()
+ << "to" << visible << "via QWidgetWindowPrivate";
+
if (QWidget *widget = q->widget()) {
- // Check if the widget was already hidden, as this indicates it was done
- // explicitly and not because the parent window in this case made it hidden.
- // In which case do not automatically show the widget when the parent
- // window is shown.
- const bool wasHidden = widget->testAttribute(Qt::WA_WState_Hidden);
- QWidgetPrivate::get(widget)->setVisible(visible);
- if (!wasHidden)
- widget->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
- } else {
- QWindowPrivate::setVisible(visible);
+ // If the widget's visible state is already matching the new QWindow
+ // visible state we assume the widget has already synced up.
+ if (visible != widget->isVisible())
+ QWidgetPrivate::get(widget)->setVisible(visible);
}
+
+ // If we end up calling QWidgetPrivate::setVisible() above, we will
+ // in most cases recurse back into setNativeWindowVisibility() to
+ // update the QWindow state. But during QWidget::destroy() this is
+ // not the case, as Qt::WA_WState_Created has been unset by the time
+ // we check if we should call hide_helper(). We handle this case, as
+ // well as the cases where we don't call QWidgetPrivate::setVisible(),
+ // by syncing up the QWindow state here if needed.
+ if (q->isVisible() != visible)
+ QWindowPrivate::setVisible(visible);
}
QWindow *eventReceiver() override {
@@ -105,9 +78,6 @@ public:
}
QRectF closestAcceptableGeometry(const QRectF &rect) const override;
-#if QT_CONFIG(opengl)
- QOpenGLContext *shareContext() const override;
-#endif
void processSafeAreaMarginsChanged() override
{
@@ -115,6 +85,9 @@ public:
if (QWidget *widget = q->widget())
QWidgetPrivate::get(widget)->updateContentsRect();
}
+
+ bool participatesInLastWindowClosed() const override;
+ bool treatAsVisible() const override;
};
QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const
@@ -146,35 +119,43 @@ QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const
return result;
}
-#if QT_CONFIG(opengl)
-QOpenGLContext *QWidgetWindowPrivate::shareContext() const
-{
- Q_Q(const QWidgetWindow);
- const QWidgetPrivate *widgetPrivate = QWidgetPrivate::get(q->widget());
- return widgetPrivate->shareContext();
-}
-#endif // opengl
+bool q_evaluateRhiConfig(const QWidget *w, QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType);
QWidgetWindow::QWidgetWindow(QWidget *widget)
: QWindow(*new QWidgetWindowPrivate(), nullptr)
, m_widget(widget)
{
updateObjectName();
- // Enable QOpenGLWidget/QQuickWidget children if the platform plugin supports it,
- // and the application developer has not explicitly disabled it.
- if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)
- && !QCoreApplication::testAttribute(Qt::AA_ForceRasterWidgets)) {
- setSurfaceType(QSurface::RasterGLSurface);
+ if (!QCoreApplication::testAttribute(Qt::AA_ForceRasterWidgets)) {
+ QSurface::SurfaceType type = QSurface::RasterSurface;
+ q_evaluateRhiConfig(m_widget, nullptr, &type);
+ setSurfaceType(type);
}
+
connect(widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
- connect(this, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChange()));
+ connect(this, &QWidgetWindow::screenChanged, this, &QWidgetWindow::handleScreenChange);
}
QWidgetWindow::~QWidgetWindow()
{
+ if (!m_widget)
+ return;
+
+ QTLWExtra *topData = QWidgetPrivate::get(m_widget)->topData();
+ Q_ASSERT(topData);
+
+ // The QPlaformBackingStore may hold a reference to the window,
+ // so the backingstore needs to be deleted first.
+ topData->repaintManager.reset(nullptr);
+ delete topData->backingStore;
+ topData->backingStore = nullptr;
+ topData->widgetTextures.clear();
+
+ // Too late to do anything beyond this point
+ topData->window = nullptr;
}
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessibleInterface *QWidgetWindow::accessibleRoot() const
{
if (m_widget)
@@ -208,6 +189,9 @@ QObject *QWidgetWindow::focusObject() const
void QWidgetWindow::setNativeWindowVisibility(bool visible)
{
Q_D(QWidgetWindow);
+ qCDebug(lcWidgetShowHide) << "Setting visibility of" << this
+ << "to" << visible << "via QWidgetWindow::setNativeWindowVisibility";
+
// Call base class setVisible() implementation to run the QWindow
// visibility logic. Don't call QWidgetWindowPrivate::setVisible()
// since that will recurse back into QWidget code.
@@ -224,6 +208,8 @@ static inline bool shouldBePropagatedToWidget(QEvent *event)
case QEvent::DynamicPropertyChange:
case QEvent::ChildAdded:
case QEvent::ChildRemoved:
+ case QEvent::Paint:
+ case QEvent::Close: // Propagated manually in closeEvent
return false;
default:
return true;
@@ -235,24 +221,7 @@ bool QWidgetWindow::event(QEvent *event)
if (!m_widget)
return QWindow::event(event);
- if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) {
- // \a event is uninteresting for QWidgetWindow, the event was probably
- // generated before WA_DontShowOnScreen was set
- if (!shouldBePropagatedToWidget(event))
- return true;
- return QCoreApplication::forwardEvent(m_widget, event);
- }
-
switch (event->type()) {
- case QEvent::Close: {
- // The widget might be deleted in the close event handler.
- QPointer<QObject> guard = this;
- handleCloseEvent(static_cast<QCloseEvent *>(event));
- if (guard)
- QWindow::event(event);
- return true;
- }
-
case QEvent::Enter:
case QEvent::Leave:
handleEnterLeaveEvent(event);
@@ -264,7 +233,7 @@ bool QWidgetWindow::event(QEvent *event)
handleFocusInEvent(static_cast<QFocusEvent *>(event));
Q_FALLTHROUGH();
case QEvent::FocusOut: {
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::State state;
state.active = true;
QAccessibleStateChangeEvent ev(m_widget, state);
@@ -382,6 +351,10 @@ bool QWidgetWindow::event(QEvent *event)
m_widget->repaint();
return true;
+ case QEvent::DevicePixelRatioChange:
+ handleDevicePixelRatioChange();
+ break;
+
default:
break;
}
@@ -396,14 +369,13 @@ QPointer<QWidget> qt_last_mouse_receiver = nullptr;
void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
{
-#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
// Ignore all enter/leave events from QPA if we are not on the first-level context menu.
// This prevents duplicated events on most platforms. Fake events will be delivered in
// QWidgetWindow::handleMouseEvent(QMouseEvent *). Make an exception whether the widget
// is already under mouse - let the mouse leave.
if (QApplicationPrivate::inPopupMode() && m_widget != QApplication::activePopupWidget() && !m_widget->underMouse())
return;
-#endif
+
if (event->type() == QEvent::Leave) {
QWidget *enter = nullptr;
// Check from window system event queue if the next queued enter targets a window
@@ -412,7 +384,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
QWindowSystemInterfacePrivate::EnterEvent *systemEvent =
static_cast<QWindowSystemInterfacePrivate::EnterEvent *>
(QWindowSystemInterfacePrivate::peekWindowSystemEvent(QWindowSystemInterfacePrivate::Enter));
- const QPointF globalPosF = systemEvent ? systemEvent->globalPos : QGuiApplicationPrivate::lastCursorPosition;
+ const QPointF globalPosF = systemEvent ? systemEvent->globalPos : QPointF(QGuiApplicationPrivate::lastCursorPosition);
if (systemEvent) {
if (QWidgetWindow *enterWindow = qobject_cast<QWidgetWindow *>(systemEvent->enter))
{
@@ -505,11 +477,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
if (QApplicationPrivate::inPopupMode()) {
QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();
- QPoint mapped = event->position().toPoint();
+ QPointF mapped = event->position();
if (activePopupWidget != m_widget)
- mapped = activePopupWidget->mapFromGlobal(event->globalPosition().toPoint());
+ mapped = activePopupWidget->mapFromGlobal(event->globalPosition());
bool releaseAfter = false;
- QWidget *popupChild = activePopupWidget->childAt(mapped);
+ QWidget *popupChild = activePopupWidget->childAt(mapped.toPoint());
if (activePopupWidget != qt_popup_down) {
qt_button_down = nullptr;
@@ -536,16 +508,15 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// deliver event
qt_replay_popup_mouse_event = false;
QPointer<QWidget> receiver = activePopupWidget;
- QPoint widgetPos = mapped;
+ QPointF widgetPos = mapped;
if (qt_button_down)
receiver = qt_button_down;
else if (popupChild)
receiver = popupChild;
if (receiver != activePopupWidget)
- widgetPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
+ widgetPos = receiver->mapFromGlobal(event->globalPosition());
-#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
- const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);
+ const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped.toPoint());
const bool underMouse = activePopupWidget->underMouse();
if (underMouse != reallyUnderMouse) {
if (reallyUnderMouse) {
@@ -562,13 +533,14 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
receiver = activePopupWidget;
}
}
-#endif
+
if ((event->type() != QEvent::MouseButtonPress) || !(QMutableSinglePointEvent::from(event)->isDoubleClick())) {
// if the widget that was pressed is gone, then deliver move events without buttons
const auto buttons = event->type() == QEvent::MouseMove && qt_popup_down_closed
? Qt::NoButton : event->buttons();
QMouseEvent e(event->type(), widgetPos, event->scenePosition(), event->globalPosition(),
- event->button(), buttons, event->modifiers(), event->source());
+ event->button(), buttons, event->modifiers(),
+ event->source(), event->pointingDevice());
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver);
qt_last_mouse_receiver = receiver;
@@ -625,9 +597,10 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QWidget *receiver = activePopupWidget;
if (qt_button_down)
receiver = qt_button_down;
- else if(popupChild)
+ else if (popupChild)
receiver = popupChild;
- QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
+ const QPoint localPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
+ QContextMenuEvent e(QContextMenuEvent::Mouse, localPos, event->globalPosition().toPoint(), event->modifiers());
QApplication::forwardEvent(receiver, &e, event);
}
#else
@@ -670,7 +643,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// The preceding statement excludes MouseButtonPress events which caused
// creation of a MouseButtonDblClick event. QTBUG-25831
QMouseEvent translated(event->type(), mapped, event->scenePosition(), event->globalPosition(),
- event->button(), event->buttons(), event->modifiers(), event->source());
+ event->button(), event->buttons(), event->modifiers(),
+ event->source(), event->pointingDevice());
translated.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget,
&qt_button_down, qt_last_mouse_receiver);
@@ -681,6 +655,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
&& m_widget->rect().contains(event->position().toPoint())) {
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
QGuiApplication::forwardEvent(receiver, &e, event);
+ if (e.isAccepted())
+ event->accept();
}
#endif
}
@@ -695,7 +671,7 @@ void QWidgetWindow::handleTouchEvent(QTouchEvent *event)
// events instead, which QWidgetWindow::handleMouseEvent will forward correctly:
event->ignore();
} else {
- event->setAccepted(QApplicationPrivate::translateRawTouchEvent(m_widget, event->pointingDevice(), event->touchPoints(), event->timestamp()));
+ event->setAccepted(QApplicationPrivate::translateRawTouchEvent(m_widget, event));
}
}
@@ -720,6 +696,9 @@ bool QWidgetWindow::updateSize()
bool changed = false;
if (m_widget->testAttribute(Qt::WA_OutsideWSRange))
return changed;
+ if (m_widget->testAttribute(Qt::WA_DontShowOnScreen))
+ return changed;
+
if (m_widget->data->crect.size() != geometry().size()) {
changed = true;
m_widget->data->crect.setSize(geometry().size());
@@ -731,29 +710,43 @@ bool QWidgetWindow::updateSize()
void QWidgetWindow::updateMargins()
{
- const QMargins margins = frameMargins();
+ // QTBUG-79147 (Windows): Bail out on resize events after closing a dialog
+ // and destroying the platform window which would clear the margins.
QTLWExtra *te = m_widget->d_func()->topData();
+ if (te->window == nullptr || te->window->handle() == nullptr)
+ return;
+ const QMargins margins = frameMargins();
te->posIncludesFrame= false;
te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom());
m_widget->data->fstrut_dirty = false;
}
-static void sendScreenChangeRecursively(QWidget *widget)
+static void sendChangeRecursively(QWidget *widget, QEvent::Type type)
{
- QEvent e(QEvent::ScreenChangeInternal);
+ QEvent e(type);
QCoreApplication::sendEvent(widget, &e);
QWidgetPrivate *d = QWidgetPrivate::get(widget);
for (int i = 0; i < d->children.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
if (w)
- sendScreenChangeRecursively(w);
+ sendChangeRecursively(w, type);
}
}
void QWidgetWindow::handleScreenChange()
{
// Send an event recursively to the widget and its children.
- sendScreenChangeRecursively(m_widget);
+ sendChangeRecursively(m_widget, QEvent::ScreenChangeInternal);
+
+ // Invalidate the backing store buffer and repaint immediately.
+ if (screen())
+ repaintWindow();
+}
+
+void QWidgetWindow::handleDevicePixelRatioChange()
+{
+ // Send an event recursively to the widget and its children.
+ sendChangeRecursively(m_widget, QEvent::DevicePixelRatioChange);
// Invalidate the backing store buffer and repaint immediately.
if (screen())
@@ -791,11 +784,13 @@ void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
{
if (m_widget->testAttribute(Qt::WA_OutsideWSRange))
return;
+ if (m_widget->testAttribute(Qt::WA_DontShowOnScreen))
+ return;
auto oldPosition = m_widget->data->crect.topLeft();
auto newPosition = geometry().topLeft();
- if (!m_widget->isTopLevel()) {
+ if (!m_widget->isWindow()) {
if (auto *nativeParent = m_widget->nativeParentWidget())
newPosition = m_widget->parentWidget()->mapFrom(nativeParent, newPosition);
}
@@ -831,10 +826,38 @@ void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
}
}
-void QWidgetWindow::handleCloseEvent(QCloseEvent *event)
+void QWidgetWindow::closeEvent(QCloseEvent *event)
+{
+ Q_D(QWidgetWindow);
+ bool accepted = m_widget->d_func()->handleClose(d->inClose ? QWidgetPrivate::CloseWithEvent
+ : QWidgetPrivate::CloseWithSpontaneousEvent);
+ event->setAccepted(accepted);
+}
+
+bool QWidgetWindowPrivate::participatesInLastWindowClosed() const
{
- bool is_closing = m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
- event->setAccepted(is_closing);
+ Q_Q(const QWidgetWindow);
+
+ // For historical reasons WA_QuitOnClose has been closely tied
+ // to the lastWindowClosed signal, since the default behavior
+ // is to quit the application after emitting lastWindowClosed.
+ // ### Qt 7: Rename this attribute, or decouple behavior.
+ if (!q->widget()->testAttribute(Qt::WA_QuitOnClose))
+ return false;
+
+ return QWindowPrivate::participatesInLastWindowClosed();
+}
+
+bool QWidgetWindowPrivate::treatAsVisible() const
+{
+ Q_Q(const QWidgetWindow);
+
+ // Widget windows may have Qt::WA_DontShowOnScreen, in which case the
+ // QQWidget will be visible, but the corresponding QWindow will not.
+ // Since the lastWindowClosed logic relies on checking whether the
+ // closed window was visible, and if there are any remaining visible
+ // windows, we need to reflect the QWidget state, not the QWindow one.
+ return q->widget()->isVisible();
}
#if QT_CONFIG(wheelevent)
@@ -912,8 +935,9 @@ void QWidgetWindow::handleDragMoveEvent(QDragMoveEvent *event)
event->ignore();
if (m_dragTarget) { // Send DragLeave to previous
QDragLeaveEvent leaveEvent;
- QGuiApplication::forwardEvent(m_dragTarget, &leaveEvent, event);
+ QWidget *dragTarget = m_dragTarget;
m_dragTarget = nullptr;
+ QGuiApplication::forwardEvent(dragTarget, &leaveEvent, event);
}
} else {
const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->position().toPoint()));
@@ -927,8 +951,9 @@ void QWidgetWindow::handleDragMoveEvent(QDragMoveEvent *event)
} else {
if (m_dragTarget) { // Send DragLeave to previous
QDragLeaveEvent leaveEvent;
- QGuiApplication::forwardEvent(m_dragTarget, &leaveEvent, event);
+ QWidget *dragTarget = m_dragTarget;
m_dragTarget = nullptr;
+ QGuiApplication::forwardEvent(dragTarget, &leaveEvent, event);
}
// widget might have been deleted when handling the leaveEvent
if (widget) {
@@ -950,9 +975,11 @@ void QWidgetWindow::handleDragMoveEvent(QDragMoveEvent *event)
void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event)
{
- if (m_dragTarget)
- QGuiApplication::forwardEvent(m_dragTarget, event);
- m_dragTarget = nullptr;
+ if (m_dragTarget) {
+ QWidget *dragTarget = m_dragTarget;
+ m_dragTarget = nullptr;
+ QGuiApplication::forwardEvent(dragTarget, event);
+ }
}
void QWidgetWindow::handleDropEvent(QDropEvent *event)
@@ -964,16 +991,20 @@ void QWidgetWindow::handleDropEvent(QDropEvent *event)
}
const QPoint mapped = m_dragTarget->mapFromGlobal(m_widget->mapToGlobal(event->position().toPoint()));
QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
- QGuiApplication::forwardEvent(m_dragTarget, &translated, event);
+ QWidget *dragTarget = m_dragTarget;
+ m_dragTarget = nullptr;
+ QGuiApplication::forwardEvent(dragTarget, &translated, event);
event->setAccepted(translated.isAccepted());
event->setDropAction(translated.dropAction());
- m_dragTarget = nullptr;
}
#endif // QT_CONFIG(draganddrop)
void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
+ if (m_widget->testAttribute(Qt::WA_DontShowOnScreen))
+ return; // Ignore for widgets that fake exposure
+
QWidgetPrivate *wPriv = m_widget->d_func();
const bool exposed = isExposed();
@@ -993,7 +1024,7 @@ void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
// If the window becomes not exposed...
if (wPriv->childrenShownByExpose) {
// ... and child widgets was previously shown by the expose event - hide widgets again.
- // This is a workaround, because sometimes when window is minimized programatically,
+ // This is a workaround, because sometimes when window is minimized programmatically,
// the QPA can notify that the window is exposed after changing window state to minimized
// and then, the QPA can send next expose event with null exposed region (not exposed).
wPriv->hideChildren(true);
@@ -1009,8 +1040,8 @@ void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
m_widget->setAttribute(Qt::WA_Mapped);
for (QWidget *p = m_widget->parentWidget(); p && !p->testAttribute(Qt::WA_Mapped); p = p->parentWidget())
p->setAttribute(Qt::WA_Mapped);
- if (!event->region().isNull())
- wPriv->syncBackingStore(event->region());
+ if (!event->m_region.isNull())
+ wPriv->syncBackingStore(event->m_region);
} else {
m_widget->setAttribute(Qt::WA_Mapped, false);
}
@@ -1058,11 +1089,10 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
if (!widget) {
widget = m_widget->childAt(event->position().toPoint());
- if (event->type() == QEvent::TabletPress) {
- if (!widget)
- widget = m_widget;
+ if (!widget)
+ widget = m_widget;
+ if (event->type() == QEvent::TabletPress)
qt_tablet_target = widget;
- }
}
if (widget) {
@@ -1134,8 +1164,8 @@ void QWidgetWindow::updateObjectName()
{
QString name = m_widget->objectName();
if (name.isEmpty())
- name = QString::fromUtf8(m_widget->metaObject()->className()) + QLatin1String("Class");
- name += QLatin1String("Window");
+ name = QString::fromUtf8(m_widget->metaObject()->className()) + "Class"_L1;
+ name += "Window"_L1;
setObjectName(name);
}