diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-04-07 01:00:12 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-04-08 20:11:39 +0200 |
commit | 8823bb8d306d78dd6a2e121a708dc607beff58c8 (patch) | |
tree | 5ca170aa36aa1381b0f31dae6709fd2ce68be344 /src/widgets/kernel | |
parent | 5422fb79486a1818d6355d75f019fe63120a43d0 (diff) | |
parent | 14c55e29794b4f1d6e010fdf7082ef55cbf8f275 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
examples/opengl/doc/src/cube.qdoc
src/corelib/global/qlibraryinfo.cpp
src/corelib/text/qbytearray_p.h
src/corelib/text/qlocale_data_p.h
src/corelib/time/qhijricalendar_data_p.h
src/corelib/time/qjalalicalendar_data_p.h
src/corelib/time/qromancalendar_data_p.h
src/network/ssl/qsslcertificate.h
src/widgets/doc/src/graphicsview.qdoc
src/widgets/widgets/qcombobox.cpp
src/widgets/widgets/qcombobox.h
tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
tests/manual/diaglib/debugproxystyle.cpp
tests/manual/diaglib/qwidgetdump.cpp
tests/manual/diaglib/qwindowdump.cpp
tests/manual/diaglib/textdump.cpp
util/locale_database/cldr2qlocalexml.py
util/locale_database/qlocalexml.py
util/locale_database/qlocalexml2cpp.py
Resolution of util/locale_database/ are based on:
https://codereview.qt-project.org/c/qt/qtbase/+/294250
and src/corelib/{text,time}/*_data_p.h were then regenerated by
running those scripts.
Updated CMakeLists.txt in each of
tests/auto/corelib/serialization/qcborstreamreader/
tests/auto/corelib/serialization/qcborvalue/
tests/auto/gui/kernel/
and generated new ones in each of
tests/auto/gui/kernel/qaddpostroutine/
tests/auto/gui/kernel/qhighdpiscaling/
tests/libfuzzer/corelib/text/qregularexpression/optimize/
tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/
tests/libfuzzer/gui/text/qtextdocument/sethtml/
tests/libfuzzer/gui/text/qtextdocument/setmarkdown/
tests/libfuzzer/gui/text/qtextlayout/beginlayout/
by running util/cmake/pro2cmake.py on their changed .pro files.
Changed target name in
tests/auto/gui/kernel/qaction/qaction.pro
tests/auto/gui/kernel/qaction/qactiongroup.pro
tests/auto/gui/kernel/qshortcut/qshortcut.pro
to ensure unique target names for CMake
Changed tst_QComboBox::currentIndex to not test the
currentIndexChanged(QString), as that one does not exist in Qt 6
anymore.
Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qgesturemanager.cpp | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qtooltip.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetrepaintmanager.cpp | 25 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 22 |
7 files changed, 30 insertions, 39 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index de12347b89..6e5fe0d1cf 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -4294,7 +4294,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QWidget *targetWidget = static_cast<QWidget *>(target.data()); -#ifdef Q_OS_OSX +#ifdef Q_OS_MACOS // Single-touch events are normally not sent unless WA_TouchPadAcceptSingleTouchEvents is set. // In Qt 4 this check was in OS X-only code. That behavior is preserved here by the #ifdef. if (touchPoints.count() == 1 diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 541519245e..134cebca09 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -51,7 +51,7 @@ #include "qgesture.h" #include "qevent.h" -#ifdef Q_OS_OSX +#ifdef Q_OS_MACOS #include "qmacgesturerecognizer_p.h" #endif @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcGestureManager, "qt.widgets.gestures") -#if !defined(Q_OS_OSX) +#if !defined(Q_OS_MACOS) static inline int panTouchPoints() { // Override by environment variable for testing. @@ -89,7 +89,7 @@ QGestureManager::QGestureManager(QObject *parent) { qRegisterMetaType<Qt::GestureState>(); -#if defined(Q_OS_OSX) +#if defined(Q_OS_MACOS) registerGestureRecognizer(new QMacSwipeGestureRecognizer); registerGestureRecognizer(new QMacPinchGestureRecognizer); registerGestureRecognizer(new QMacPanGestureRecognizer); diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 33dd3e59b6..661568dcad 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -402,10 +402,10 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w) #endif //QT_NO_STYLE_STYLESHEET QPoint p = pos; - int screenNumber = getTipScreen(pos, w); - QScreen *screen = QGuiApplication::screens().at(screenNumber); - if (screen) { - const QPlatformScreen *platformScreen = screen->handle(); + const QScreen *screen = QGuiApplication::screens().value(getTipScreen(pos, w), + QGuiApplication::primaryScreen()); + // a QScreen's handle *should* never be null, so this is a bit paranoid + if (const QPlatformScreen *platformScreen = screen ? screen->handle() : nullptr) { const QSize cursorSize = QHighDpi::fromNativePixels(platformScreen->cursor()->size(), platformScreen); QPoint offset(2, cursorSize.height()); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 79c8aba8cf..7be83c1837 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1608,7 +1608,6 @@ void QWidgetPrivate::createTLExtra() x->opacity = 255; x->posIncludesFrame = 0; x->sizeAdjusted = false; - x->inTopLevelResize = false; x->embedded = 0; x->window = nullptr; x->initialScreenIndex = -1; @@ -10803,7 +10802,7 @@ void QWidgetPrivate::repaint(T r) return; QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); - if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) + if (tlwExtra && tlwExtra->backingStore) tlwExtra->repaintManager->markDirty(r, q, QWidgetRepaintManager::UpdateNow); } @@ -10878,7 +10877,7 @@ void QWidgetPrivate::update(T r) } QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); - if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) + if (tlwExtra && tlwExtra->backingStore) tlwExtra->repaintManager->markDirty(clipped, q); } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index a3eac8d9ec..b71b72fe13 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -155,7 +155,6 @@ struct QTLWExtra { uint opacity : 8; uint posIncludesFrame : 1; uint sizeAdjusted : 1; - uint inTopLevelResize : 1; uint embedded : 1; }; diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index 135a1527ac..e7e85c39e7 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -166,7 +166,7 @@ void QWidgetPrivate::invalidateBackingStore(const T &r) return; QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); - if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore) + if (!tlwExtra || !tlwExtra->backingStore) return; T clipped(r); @@ -213,7 +213,6 @@ void QWidgetRepaintManager::markDirty(const T &r, QWidget *widget, UpdateTime up Q_ASSERT(tlw->d_func()->extra); Q_ASSERT(tlw->d_func()->extra->topextra); - Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); Q_ASSERT(widget->window() == tlw); Q_ASSERT(!r.isEmpty()); @@ -446,8 +445,6 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) QWidget *tlw = q->window(); QTLWExtra* x = tlw->d_func()->topData(); - if (x->inTopLevelResize) - return; static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0; @@ -543,8 +540,6 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) Q_Q(QWidget); QWidget *tlw = q->window(); QTLWExtra* x = tlw->d_func()->topData(); - if (x->inTopLevelResize) - return; QWidgetRepaintManager *repaintManager = x->repaintManager.get(); if (!repaintManager) @@ -722,8 +717,7 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR { qCInfo(lcWidgetPainting) << "Syncing" << exposedRegion << "of" << exposedWidget; - QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); - if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize) + if (!tlw->isVisible()) return; if (!exposedWidget || !hasPlatformWindow(exposedWidget) @@ -815,13 +809,11 @@ void QWidgetRepaintManager::paintAndFlush() const bool updatesDisabled = !tlw->updatesEnabled(); bool repaintAllWidgets = false; - const bool inTopLevelResize = tlw->d_func()->maybeTopData()->inTopLevelResize; const QRect tlwRect = tlw->data->crect; - const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); - if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { + if (!updatesDisabled && store->size() != tlwRect.size()) { if (hasStaticContents() && !store->size().isEmpty() ) { // Repaint existing dirty area and newly visible area. - const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); + const QRect clipRect(QPoint(0, 0), store->size()); const QRegion staticRegion(staticContents(nullptr, clipRect)); QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height()); newVisible -= staticRegion; @@ -837,7 +829,7 @@ void QWidgetRepaintManager::paintAndFlush() } } - if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) + if (store->size() != tlwRect.size()) store->resize(tlwRect.size()); if (updatesDisabled) @@ -1248,11 +1240,10 @@ bool QWidgetRepaintManager::hasStaticContents() const QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &withinClipRect) const { if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { - const QSize surfaceGeometry(store->size()); - QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); + QRect backingstoreRect(QPoint(0, 0), store->size()); if (!withinClipRect.isEmpty()) - surfaceRect &= withinClipRect; - return QRegion(surfaceRect); + backingstoreRect &= withinClipRect; + return QRegion(backingstoreRect); } QRegion region; diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index e82ddbcd20..0fa3fb4c67 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -397,7 +397,7 @@ QPointer<QWidget> qt_last_mouse_receiver = nullptr; void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) { -#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups +#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 @@ -505,7 +505,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ? QEvent::MouseButtonRelease : QEvent::MouseButtonPress; if (QApplicationPrivate::inPopupMode()) { - QWidget *activePopupWidget = QApplication::activePopupWidget(); + QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget(); QPoint mapped = event->pos(); if (activePopupWidget != m_widget) mapped = activePopupWidget->mapFromGlobal(event->globalPos()); @@ -544,7 +544,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) if (receiver != activePopupWidget) widgetPos = receiver->mapFromGlobal(event->globalPos()); -#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups +#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped); const bool underMouse = activePopupWidget->underMouse(); if (underMouse != reallyUnderMouse) { @@ -565,9 +565,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) #endif if ((event->type() != QEvent::MouseButtonPress) || !(event->flags().testFlag(Qt::MouseEventCreatedDoubleClick))) { - + // if the widget that was pressed is gone, then deliver move events without buttons + const auto buttons = event->type() == QEvent::MouseMove && qt_button_down == nullptr + ? Qt::NoButton : event->buttons(); QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), - event->button(), event->buttons(), event->modifiers(), event->source()); + event->button(), buttons, event->modifiers(), event->source()); e.setTimestamp(event->timestamp()); QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver); qt_last_mouse_receiver = receiver; @@ -764,7 +766,7 @@ void QWidgetWindow::repaintWindow() return; QTLWExtra *tlwExtra = m_widget->window()->d_func()->maybeTopData(); - if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) + if (tlwExtra && tlwExtra->backingStore) tlwExtra->repaintManager->markDirty(m_widget->rect(), m_widget, QWidgetRepaintManager::UpdateNow, QWidgetRepaintManager::BufferInvalid); } @@ -813,16 +815,16 @@ void QWidgetWindow::handleMoveEvent(QMoveEvent *event) void QWidgetWindow::handleResizeEvent(QResizeEvent *event) { - QSize oldSize = m_widget->data->crect.size(); + auto oldRect = m_widget->rect(); if (updateSize()) { QGuiApplication::forwardEvent(m_widget, event); if (m_widget->d_func()->shouldPaintOnScreen()) { - QRegion updateRegion(geometry()); + QRegion dirtyRegion = m_widget->rect(); if (m_widget->testAttribute(Qt::WA_StaticContents)) - updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height()); - m_widget->d_func()->syncBackingStore(updateRegion); + dirtyRegion -= oldRect; + m_widget->d_func()->syncBackingStore(dirtyRegion); } else { m_widget->d_func()->syncBackingStore(); } |