From 89a25a3ef169cb42c54ef1ddcb28f70b24f923ab Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Sun, 9 Jun 2019 20:01:36 +0200 Subject: Don't count all engines as "in use" in cache Back in 36cb3f3f655a9090c82de609010cbfb88651a0f3, we started properly reference counting font engines as they were entered into the font cache. Prior to this, ref.load == 0 would mean that the engine was essentially owned by the cache. When the change was made, the condition that an engine must be in use if its reference is != 0 remained, and the result of this was used to calculate the limit for when the cache should be flushed. Since this limit was miscalculated, the cache would keep growing, even if it only contained unused font engines. [ChangeLog][QtGui][Text] Fixed a bug which could cause the font cache to grow larger than it was supposed to. Task-number: QTBUG-76219 Change-Id: I4d1541756f3bdf5bd9b0301bf47c6db2e220716a Reviewed-by: Konstantin Ritt --- src/gui/text/qfont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 69255fd59d..fe4fa4929a 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2970,7 +2970,7 @@ void QFontCache::decreaseCache() it.value().data->ref.load(), engineCacheCount.value(it.value().data), it.value().data->cache_cost); - if (it.value().data->ref.load() != 0) + if (it.value().data->ref.load() > engineCacheCount.value(it.value().data)) in_use_cost += it.value().data->cache_cost / engineCacheCount.value(it.value().data); } -- cgit v1.2.3 From ac68ef1efc27669e9c8fc255298345d72d198d68 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 3 May 2019 13:45:53 +0200 Subject: Don't duplicate font family names in the fallback list Fixes: QTBUG-75333 Change-Id: Iaaf4b13d50c6b9b52e629b81d5e9cbc552a0202c Reviewed-by: Allan Sandfeld Jensen --- src/gui/text/qfontdatabase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index fa9573441a..6dad5196e8 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -707,7 +707,8 @@ static QStringList familyList(const QFontDef &req) if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"'))) || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\'')))) str = str.mid(1, str.length() - 2); - family_list << str.toString(); + if (!family_list.contains(str)) + family_list << str.toString(); } } // append the substitute list for each family in family_list -- cgit v1.2.3 From 0e2c013a4523915a0af37fe1f338a4f66b07f91d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 7 May 2019 10:56:08 +0200 Subject: doc: Add dontdocument.qdoc files Each module that has publically declared classes or structs that are not meant to be documented is given a dontdocument.qdoc file to tell qdoc that these classes are not meant to be documentented. Then qdoc will not print warnings about missing \class comments for these classes and structs. Change-Id: I9195f0b546032e1c7642c9da34d85a0a4a9bfb08 Reviewed-by: Paul Wicking --- src/gui/doc/src/dontdocument.qdoc | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/gui/doc/src/dontdocument.qdoc (limited to 'src/gui') diff --git a/src/gui/doc/src/dontdocument.qdoc b/src/gui/doc/src/dontdocument.qdoc new file mode 100644 index 0000000000..b360acefc1 --- /dev/null +++ b/src/gui/doc/src/dontdocument.qdoc @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \dontdocument (QTypeInfo QScreenOrientationChangeEvent QApplicationStateChangeEvent + QImageTextKeyLang QMetaTypeId QAbstractUndoItem + QOpenGLVersionStatus + QOpenGLVersionFunctionsBackend + QOpenGLVersionFunctionsStorage + QOpenGLFunctions_1_0_CoreBackend + QOpenGLFunctions_1_1_CoreBackend + QOpenGLFunctions_1_2_CoreBackend + QOpenGLFunctions_1_3_CoreBackend + QOpenGLFunctions_1_4_CoreBackend + QOpenGLFunctions_1_5_CoreBackend + QOpenGLFunctions_2_0_CoreBackend + QOpenGLFunctions_2_1_CoreBackend + QOpenGLFunctions_3_0_CoreBackend + QOpenGLFunctions_3_1_CoreBackend + QOpenGLFunctions_3_2_CoreBackend + QOpenGLFunctions_3_3_CoreBackend + QOpenGLFunctions_4_0_CoreBackend + QOpenGLFunctions_4_1_CoreBackend + QOpenGLFunctions_4_2_CoreBackend + QOpenGLFunctions_4_3_CoreBackend + QOpenGLFunctions_4_4_CoreBackend + QOpenGLFunctions_4_5_CoreBackend + QOpenGLFunctions_1_0_DeprecatedBackend + QOpenGLFunctions_1_1_DeprecatedBackend + QOpenGLFunctions_1_2_DeprecatedBackend + QOpenGLFunctions_1_3_DeprecatedBackend + QOpenGLFunctions_1_4_DeprecatedBackend + QOpenGLFunctions_2_0_DeprecatedBackend + QOpenGLFunctions_3_0_DeprecatedBackend + QOpenGLFunctions_3_3_DeprecatedBackend + QOpenGLFunctions_4_5_DeprecatedBackend + QTextFrameLayoutData QPlatformDropQtResponse QPlatformDragQtResponse + QPlatformOffscreenSurface QColorDialogOptions QFontDialogOptions + QFileDialogOptions QMessageDialogOptions QMessageDialogOptions::CustomButton + QPlatformSessionManager QPlatformIntegrationPlugin QPlatformMenuItem + QPlatformMenu QPlatformMenuBar QPlatformTextureList) +*/ -- cgit v1.2.3 From 1c7b5c20a5f1c2fabf9df7ee636014f5ba0ab114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 29 Apr 2019 09:52:55 +0200 Subject: QOpenGLWindow: set QOffScreenSurface screen Required by QWasmOpenGLContext. Task-number: QTBUG-75463 Change-Id: Ie3cb80b50d7c909e6f46a6dec19644bf27cd41e7 Reviewed-by: Lorn Potter --- src/gui/kernel/qopenglwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index 8b052d92ae..022a47c919 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -440,7 +440,7 @@ void QOpenGLWindow::makeCurrent() d->context->makeCurrent(this); } else { if (!d->offscreenSurface) { - d->offscreenSurface.reset(new QOffscreenSurface); + d->offscreenSurface.reset(new QOffscreenSurface(screen())); d->offscreenSurface->setFormat(d->context->format()); d->offscreenSurface->create(); } -- cgit v1.2.3 From cc4c0b43a54d9606f491c193df381a424ae696bf Mon Sep 17 00:00:00 2001 From: Ryan Chu Date: Fri, 3 May 2019 16:14:19 +0200 Subject: QDataStream: Fix inconsistent results of iostream with QPalette objects The value of NColorRoles got changed since 5.11. It introduced one more role called "PlaceholderText" in the ColorRole enumeration. When using QDataStream (5.12) to read QPalette objects from a file written by 5.9 (<5.11), the processing results are inconsistent. Fixes: QTBUG-74885 Change-Id: I14d57f9603a26e5890b4fd57c7e464c5b38eb3f2 Reviewed-by: Eirik Aavitsland --- src/gui/kernel/qpalette.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 9ccfb9b819..c6805dd4e6 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -1006,6 +1006,8 @@ QDataStream &operator<<(QDataStream &s, const QPalette &p) max = QPalette::HighlightedText + 1; else if (s.version() <= QDataStream::Qt_4_3) max = QPalette::AlternateBase + 1; + else if (s.version() <= QDataStream::Qt_5_11) + max = QPalette::ToolTipText + 1; for (int r = 0; r < max; r++) s << p.d->br[grp][r]; } @@ -1046,6 +1048,9 @@ QDataStream &operator>>(QDataStream &s, QPalette &p) } else if (s.version() <= QDataStream::Qt_4_3) { p = QPalette(); max = QPalette::AlternateBase + 1; + } else if (s.version() <= QDataStream::Qt_5_11) { + p = QPalette(); + max = QPalette::ToolTipText + 1; } QBrush tmp; -- cgit v1.2.3 From c04bd30de072793faee5166cff866a4c4e0a9dd7 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 8 May 2019 15:24:14 +0200 Subject: Guard against numerical overflow when processing QPainterPaths Many operations on and with QPainterPaths do calculations on the path coordinates, e.g. computing the distance between points, which may cause numerical overflow for extreme coordinate values. This patch introduces a limit on the coordinate values and extends the previous check against nan/inf coordinates to also check against out of range coordinates. Fixes: QTBUG-75574 Change-Id: I3a2fa88bfc6a9f19934c43d3dbbfb41855c78107 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qpainterpath.cpp | 57 ++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index c5ccf0003d..9b82b768d4 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -71,6 +71,24 @@ QT_BEGIN_NAMESPACE +static inline bool isValidCoord(qreal c) +{ + if (sizeof(qreal) >= sizeof(double)) + return qIsFinite(c) && fabs(c) < 1e128; + else + return qIsFinite(c) && fabsf(float(c)) < 1e16f; +} + +static bool hasValidCoords(QPointF p) +{ + return isValidCoord(p.x()) && isValidCoord(p.y()); +} + +static bool hasValidCoords(QRectF r) +{ + return isValidCoord(r.x()) && isValidCoord(r.y()) && isValidCoord(r.width()) && isValidCoord(r.height()); +} + struct QPainterPathPrivateDeleter { static inline void cleanup(QPainterPathPrivate *d) @@ -675,9 +693,9 @@ void QPainterPath::moveTo(const QPointF &p) printf("QPainterPath::moveTo() (%.2f,%.2f)\n", p.x(), p.y()); #endif - if (!qt_is_finite(p.x()) || !qt_is_finite(p.y())) { + if (!hasValidCoords(p)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call"); + qWarning("QPainterPath::moveTo: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -725,9 +743,9 @@ void QPainterPath::lineTo(const QPointF &p) printf("QPainterPath::lineTo() (%.2f,%.2f)\n", p.x(), p.y()); #endif - if (!qt_is_finite(p.x()) || !qt_is_finite(p.y())) { + if (!hasValidCoords(p)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call"); + qWarning("QPainterPath::lineTo: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -784,10 +802,9 @@ void QPainterPath::cubicTo(const QPointF &c1, const QPointF &c2, const QPointF & c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y()); #endif - if (!qt_is_finite(c1.x()) || !qt_is_finite(c1.y()) || !qt_is_finite(c2.x()) || !qt_is_finite(c2.y()) - || !qt_is_finite(e.x()) || !qt_is_finite(e.y())) { + if (!hasValidCoords(c1) || !hasValidCoords(c2) || !hasValidCoords(e)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::cubicTo: Adding point where x or y is NaN or Inf, ignoring call"); + qWarning("QPainterPath::cubicTo: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -841,9 +858,9 @@ void QPainterPath::quadTo(const QPointF &c, const QPointF &e) c.x(), c.y(), e.x(), e.y()); #endif - if (!qt_is_finite(c.x()) || !qt_is_finite(c.y()) || !qt_is_finite(e.x()) || !qt_is_finite(e.y())) { + if (!hasValidCoords(c) || !hasValidCoords(e)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::quadTo: Adding point where x or y is NaN or Inf, ignoring call"); + qWarning("QPainterPath::quadTo: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -912,10 +929,9 @@ void QPainterPath::arcTo(const QRectF &rect, qreal startAngle, qreal sweepLength rect.x(), rect.y(), rect.width(), rect.height(), startAngle, sweepLength); #endif - if ((!qt_is_finite(rect.x()) && !qt_is_finite(rect.y())) || !qt_is_finite(rect.width()) || !qt_is_finite(rect.height()) - || !qt_is_finite(startAngle) || !qt_is_finite(sweepLength)) { + if (!hasValidCoords(rect) || !isValidCoord(startAngle) || !isValidCoord(sweepLength)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::arcTo: Adding arc where a parameter is NaN or Inf, ignoring call"); + qWarning("QPainterPath::arcTo: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -1018,9 +1034,9 @@ QPointF QPainterPath::currentPosition() const */ void QPainterPath::addRect(const QRectF &r) { - if (!qt_is_finite(r.x()) || !qt_is_finite(r.y()) || !qt_is_finite(r.width()) || !qt_is_finite(r.height())) { + if (!hasValidCoords(r)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::addRect: Adding rect where a parameter is NaN or Inf, ignoring call"); + qWarning("QPainterPath::addRect: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -1098,10 +1114,9 @@ void QPainterPath::addPolygon(const QPolygonF &polygon) */ void QPainterPath::addEllipse(const QRectF &boundingRect) { - if (!qt_is_finite(boundingRect.x()) || !qt_is_finite(boundingRect.y()) - || !qt_is_finite(boundingRect.width()) || !qt_is_finite(boundingRect.height())) { + if (!hasValidCoords(boundingRect)) { #ifndef QT_NO_DEBUG - qWarning("QPainterPath::addEllipse: Adding ellipse where a parameter is NaN or Inf, ignoring call"); + qWarning("QPainterPath::addEllipse: Adding point with invalid coordinates, ignoring call"); #endif return; } @@ -2446,6 +2461,7 @@ QDataStream &operator<<(QDataStream &s, const QPainterPath &p) */ QDataStream &operator>>(QDataStream &s, QPainterPath &p) { + bool errorDetected = false; int size; s >> size; @@ -2464,10 +2480,11 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p) s >> x; s >> y; Q_ASSERT(type >= 0 && type <= 3); - if (!qt_is_finite(x) || !qt_is_finite(y)) { + if (!isValidCoord(qreal(x)) || !isValidCoord(qreal(y))) { #ifndef QT_NO_DEBUG - qWarning("QDataStream::operator>>: NaN or Inf element found in path, skipping it"); + qWarning("QDataStream::operator>>: Invalid QPainterPath coordinates read, skipping it"); #endif + errorDetected = true; continue; } QPainterPath::Element elm = { qreal(x), qreal(y), QPainterPath::ElementType(type) }; @@ -2480,6 +2497,8 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p) p.d_func()->fillRule = Qt::FillRule(fillRule); p.d_func()->dirtyBounds = true; p.d_func()->dirtyControlBounds = true; + if (errorDetected) + p = QPainterPath(); // Better than to return path with possibly corrupt datastructure, which would likely cause crash return s; } #endif // QT_NO_DATASTREAM -- cgit v1.2.3 From 1eac947ce2c1d63bd04a94939c4f04e9086913c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 22 May 2019 14:01:41 +0200 Subject: Work around crash where a destroyed window becomes focus_window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clear QGuiApplication::focus_window (again) in the QWindow destructor. Task-number: QTBUG-75326 Change-Id: Ief00b6adfb267fcc7e3881fd728e12df07fc1094 Reviewed-by: Christian Andersen Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index bcd8351619..a19df4da0f 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -218,6 +218,12 @@ QWindow::~QWindow() QGuiApplicationPrivate::window_list.removeAll(this); if (!QGuiApplicationPrivate::is_app_closing) QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this); + + // focus_window is normally cleared in destroy(), but the window may in + // some cases end up becoming the focus window again. Clear it again + // here as a workaround. See QTBUG-75326. + if (QGuiApplicationPrivate::focus_window == this) + QGuiApplicationPrivate::focus_window = 0; } void QWindowPrivate::init(QScreen *targetScreen) -- cgit v1.2.3 From 1dc1a032a84d1cc408623ba5b77a0acf50a58eea Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Tue, 21 May 2019 22:02:56 +0200 Subject: doc: Improve the Coordinate System rectangle coordinate examples QRect and QLine share a constructor with the same signature but with different meanings. This patch improves the coordinate examples to show the possibilities and make things clearer. Change-Id: I76a95ca226c12968ae5b15d4eb12fc2965cb57d2 Reviewed-by: Paul Wicking Reviewed-by: Luca Beldi Reviewed-by: Sze Howe Koh --- src/gui/doc/snippets/code/doc_src_coordsys.cpp | 2 ++ src/gui/doc/src/coordsys.qdoc | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/doc/snippets/code/doc_src_coordsys.cpp b/src/gui/doc/snippets/code/doc_src_coordsys.cpp index 7c53d9e731..147c146b44 100644 --- a/src/gui/doc/snippets/code/doc_src_coordsys.cpp +++ b/src/gui/doc/snippets/code/doc_src_coordsys.cpp @@ -52,6 +52,7 @@ QPainter painter(this); painter.setPen(Qt::darkGreen); +// Using the (x y w h) overload painter.drawRect(1, 2, 6, 4); //! [0] @@ -69,6 +70,7 @@ QPainter painter(this); painter.setRenderHint( QPainter::Antialiasing); painter.setPen(Qt::darkGreen); +// Using the (x y w h) overload painter.drawRect(1, 2, 6, 4); //! [2] diff --git a/src/gui/doc/src/coordsys.qdoc b/src/gui/doc/src/coordsys.qdoc index 1856428361..1018b2122b 100644 --- a/src/gui/doc/src/coordsys.qdoc +++ b/src/gui/doc/src/coordsys.qdoc @@ -70,8 +70,15 @@ \li \inlineimage coordinatesystem-rect.png \li \inlineimage coordinatesystem-line.png \row - \li QRect(1, 2, 6, 4) + \li QRect(QPoint(1, 2), QPoint(7, 6)) + \li QLine(QPoint(2, 7), QPoint(6, 1)) + \row + \li \li QLine(2, 7, 6, 1) + \row + \li QRect(QPoint(1, 2), QSize(6, 4)) + \row + \li QRect(1, 2, 6, 4) \endtable \section2 Aliased Painting -- cgit v1.2.3 From 7fc67e09f3f0c6c14392702efb01bd861a410fb7 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 5 Jun 2019 15:31:31 +0200 Subject: doc: Correct several QEnterEvent accessors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's cursor position not widget position, pos() is relative to the widget, and 3 of these accessors return QPointF. Amends e6ddae07e1e571a7a6e0c531b961dbddcd217643. Task-number: QTBUG-36985 Change-Id: Ide437f7496824f8cdd0d03fa38ad7b573e30feaa Reviewed-by: Jan Arve Sæther --- src/gui/kernel/qevent.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 7123c4d8ba..e7a320f3a4 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -97,35 +97,35 @@ QEnterEvent::~QEnterEvent() /*! \fn QPoint QEnterEvent::globalPos() const - Returns the global position of the widget \e{at the time of the event}. + Returns the global position of the mouse cursor \e{at the time of the event}. */ /*! \fn int QEnterEvent::globalX() const - Returns the global position on the X-axis of the mouse cursor relative to the the widget. + Returns the global position on the X-axis of the mouse cursor \e{at the time of the event}. */ /*! \fn int QEnterEvent::globalY() const - Returns the global position on the Y-axis of the mouse cursor relative to the the widget. + Returns the global position on the Y-axis of the mouse cursor \e{at the time of the event}. */ /*! - \fn QPoint QEnterEvent::localPos() const + \fn QPointF QEnterEvent::localPos() const Returns the mouse cursor's position relative to the receiving widget. */ /*! \fn QPoint QEnterEvent::pos() const - Returns the position of the mouse cursor in global screen coordinates. + Returns the position of the mouse cursor relative to the receiving widget. */ /*! - \fn QPoint QEnterEvent::screenPos() const + \fn QPointF QEnterEvent::screenPos() const Returns the position of the mouse cursor relative to the receiving screen. */ /*! - \fn QPoint QEnterEvent::windowPos() const + \fn QPointF QEnterEvent::windowPos() const Returns the position of the mouse cursor relative to the receiving window. */ -- cgit v1.2.3 From a4f79313f065815451610dabdbbb33b8a35f0a86 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 3 Jun 2019 14:45:07 +0200 Subject: Fix: QTextDocument::find backward search crossing paragraphs If the start position of a backward string search was the at the start of a paragraph, the code would start searching at an illegal position (at the eol character) in the preceding paragraph. That caused that whole paragraph to be skipped, so any matches there would not be found. Fix by making sure the search starts at legal position. Fixes: QTBUG-48035 Change-Id: Id6c0159b6613ec75ec617a0a57096ceef2b4cbd0 Reviewed-by: Konstantin Ritt --- src/gui/text/qtextdocument.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 4f187c6701..c2020f3f86 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1358,6 +1358,8 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op blockOffset = 0; } } else { + if (blockOffset == block.length() - 1) + --blockOffset; // make sure to skip end-of-paragraph character while (block.isValid()) { if (findInBlock(block, subString, blockOffset, options, &cursor)) return cursor; -- cgit v1.2.3 From 83dccf00ccf75da27551b68652d5c3c1b4f7ebff Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 11 Apr 2019 15:29:44 +0200 Subject: Fix printing of table headers in multi-frame QTextDocuments The calculation of page position of table headers would only work correctly for tables in the root frame of a QTextDocument. Fix by including the relative positions of subframes. Fixes: QTBUG-59000 Change-Id: I2cc7e21bddf806f7f5f9b0675ac014c339ba2453 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextdocumentlayout.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index bed0a2c450..cf02e2f9c8 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -970,8 +970,14 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain if (pageHeight <= 0) pageHeight = QFIXED_MAX; - const int tableStartPage = (td->position.y / pageHeight).truncate(); - const int tableEndPage = ((td->position.y + td->size.height) / pageHeight).truncate(); + QFixed absYPos = td->position.y; + QTextFrame *parentFrame = table->parentFrame(); + while (parentFrame) { + absYPos += data(parentFrame)->position.y; + parentFrame = parentFrame->parentFrame(); + } + const int tableStartPage = (absYPos / pageHeight).truncate(); + const int tableEndPage = ((absYPos + td->size.height) / pageHeight).truncate(); qreal border = td->border.toReal(); drawFrameDecoration(painter, frame, fd, context.clip, frameRect); -- cgit v1.2.3