diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/image.pri | 2 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qpixelformat.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/painting.pri | 2 | ||||
-rw-r--r-- | src/gui/painting/qbackingstore.cpp | 2 | ||||
-rw-r--r-- | src/gui/rhi/qrhi.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qtextmarkdownimporter.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qtextmarkdownwriter.cpp | 76 |
12 files changed, 96 insertions, 16 deletions
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 1f42f28d1e..01e48c17dd 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -97,7 +97,7 @@ qtConfig(png) { MIPS_DSPR2_ASM += image/qimage_mips_dspr2_asm.S } else { # see https://developer.android.com/ndk/guides/abis - arm64-v8a { + arm64-v8a | armeabi-v7a { SOURCES += image/qimage_neon.cpp } x86 | x86_64 { diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 38285dd827..41fe649fc5 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1527,7 +1527,7 @@ QDebug operator<<(QDebug dbg, const QIcon &i) \internal \since 5.6 Attempts to find a suitable @Nx file for the given \a targetDevicePixelRatio - Returns the the \a baseFileName if no such file was found. + Returns the \a baseFileName if no such file was found. Given base foo.png and a target dpr of 2.5, this function will look for foo@3x.png, then foo@2x, then fall back to foo.png if not found. diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 267faa7753..9a5aefbfed 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1621,7 +1621,9 @@ const uchar *QImage::scanLine(int i) const Returns a pointer to the pixel data at the scanline with index \a i. The first scanline is at index 0. - The scanline data is aligned on a 32-bit boundary. + The scanline data is as minimum 32-bit aligned. For 64-bit formats + it follows the native alignment of 64-bit integers (64-bit for most + platforms, but notably 32-bit on i386). Note that QImage uses \l{Implicit Data Sharing} {implicit data sharing}, but this function does \e not perform a deep copy of the diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 49f9550519..8435e5a0fe 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -606,7 +606,7 @@ bool QPngHandlerPrivate::readPngHeader() #endif png_uint_32 profLen; png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen); - colorSpace = QColorSpace::fromIccProfile(QByteArray::fromRawData((const char *)profileData, profLen)); + colorSpace = QColorSpace::fromIccProfile(QByteArray((const char *)profileData, profLen)); if (!colorSpace.isValid()) { qWarning() << "QPngHandler: Failed to parse ICC profile"; } else { diff --git a/src/gui/kernel/qpixelformat.cpp b/src/gui/kernel/qpixelformat.cpp index c28fe7ac63..3100d13398 100644 --- a/src/gui/kernel/qpixelformat.cpp +++ b/src/gui/kernel/qpixelformat.cpp @@ -485,7 +485,7 @@ QT_BEGIN_NAMESPACE /*! \fn ByteOrder QPixelFormat::byteOrder() const - The byte order is almost always set the the byte order of the current + The byte order is almost always set the byte order of the current system. However, it can be useful to describe some YUV formats. This function should never return QPixelFormat::CurrentSystemEndian as this value is translated to a endian value in the constructor. diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 03f2e4d79e..15d7505133 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -740,7 +740,7 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo QPlatformWindow subclasses can re-implement this function to provide display refresh synchronized updates. The event should be delivered using QPlatformWindow::deliverUpdateRequest() - to not get out of sync with the the internal state of QWindow. + to not get out of sync with the internal state of QWindow. The default implementation posts an UpdateRequest event to the window after 5 ms. The additional time is there to give the event diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 9de59f8c7e..fd25becbca 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -149,6 +149,8 @@ QScreen::~QScreen() /*! Get the platform screen handle. + + \sa {Qt Platform Abstraction}{Qt Platform Abstraction (QPA)} */ QPlatformScreen *QScreen::handle() const { diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 1a0f4f11e4..94a88f55dc 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -161,7 +161,7 @@ gcc:equals(QT_GCC_MAJOR_VERSION, 5) { DEFINES += QT_COMPILER_SUPPORTS_SSE4_1 QT_COMPILER_SUPPORTS_SSE4_2 SOURCES += painting/qdrawhelper_sse4.cpp painting/qimagescale_sse4.cpp } - arm64-v8a { + arm64-v8a | armeabi-v7a { SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp HEADERS += painting/qdrawhelper_neon_p.h } diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 0a49269c36..2147d9d61d 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -281,7 +281,7 @@ QSize QBackingStore::size() const bool QBackingStore::scroll(const QRegion &area, int dx, int dy) { // Disable scrolling for non-integer scroll deltas. For this case - // the the existing rendered pixels can't be re-used, and we return + // the existing rendered pixels can't be re-used, and we return // false to signal that a repaint is needed. const qreal nativeDx = QHighDpi::toNativePixels(qreal(dx), d_ptr->window); const qreal nativeDy = QHighDpi::toNativePixels(qreal(dy), d_ptr->window); diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index d4fdff2930..f0bf19bd91 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -1652,7 +1652,7 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(const QRhiTextureUplo Constructs a texture upload description with the specified \a list of entries. \note \a list can also contain multiple QRhiTextureUploadEntry elements - with the the same layer and level. This makes sense when those uploads are + with the same layer and level. This makes sense when those uploads are partial, meaning their subresource description has a source size or image smaller than the subresource dimensions, and can be more efficient than issuing separate uploadTexture()'s. @@ -3505,7 +3505,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const \l{QSurfaceFormat::sRGBColorSpace}{sRGBColorSpace} on the QSurfaceFormat of the QWindow in addition. - \value UsedAsTransferSource Indicates the the swapchain will be used as the + \value UsedAsTransferSource Indicates the swapchain will be used as the source of a readback in QRhiResourceUpdateBatch::readBackTexture(). \value NoVSync Requests disabling waiting for vertical sync, also avoiding @@ -3622,7 +3622,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const \fn QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget() \return a render target that can used with beginPass() in order to render - the the swapchain's current backbuffer. Only valid within a + the swapchain's current backbuffer. Only valid within a QRhi::beginFrame() - QRhi::endFrame() block where beginFrame() was called with this swapchain. @@ -4448,7 +4448,7 @@ void QRhiResourceUpdateBatch::generateMips(QRhiTexture *tex, int layer) recorded. \note the return value is not owned by the caller and must never be - destroyed. Instead, the batch is returned the the pool for reuse by passing + destroyed. Instead, the batch is returned the pool for reuse by passing it to QRhiCommandBuffer::beginPass(), QRhiCommandBuffer::endPass(), or QRhiCommandBuffer::resourceUpdate(), or by calling QRhiResourceUpdateBatch::release() on it. diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index 88965046ce..7e18a10895 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -397,10 +397,12 @@ int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det) break; case MD_SPAN_A: { MD_SPAN_A_DETAIL *detail = static_cast<MD_SPAN_A_DETAIL *>(det); - QString url = QString::fromLatin1(detail->href.text, int(detail->href.size)); - QString title = QString::fromLatin1(detail->title.text, int(detail->title.size)); + QString url = QString::fromUtf8(detail->href.text, int(detail->href.size)); + QString title = QString::fromUtf8(detail->title.text, int(detail->title.size)); + charFmt.setAnchor(true); charFmt.setAnchorHref(url); - charFmt.setAnchorNames(QStringList(title)); + if (!title.isEmpty()) + charFmt.setToolTip(title); charFmt.setForeground(m_palette.link()); qCDebug(lcMD) << "anchor" << url << title; } break; diff --git a/src/gui/text/qtextmarkdownwriter.cpp b/src/gui/text/qtextmarkdownwriter.cpp index c9a63920c3..7bd321becc 100644 --- a/src/gui/text/qtextmarkdownwriter.cpp +++ b/src/gui/text/qtextmarkdownwriter.cpp @@ -56,10 +56,13 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcMDW, "qt.text.markdown.writer") static const QChar Space = QLatin1Char(' '); +static const QChar Tab = QLatin1Char('\t'); static const QChar Newline = QLatin1Char('\n'); +static const QChar CarriageReturn = QLatin1Char('\r'); static const QChar LineBreak = QChar(0x2028); static const QChar DoubleQuote = QLatin1Char('"'); static const QChar Backtick = QLatin1Char('`'); +static const QChar Backslash = QLatin1Char('\\'); static const QChar Period = QLatin1Char('.'); QTextMarkdownWriter::QTextMarkdownWriter(QTextStream &stream, QTextDocument::MarkdownFeatures features) @@ -291,6 +294,72 @@ static void maybeEscapeFirstChar(QString &s) } } +struct LineEndPositions { + const QChar *lineEnd; + const QChar *nextLineBegin; +}; + +static LineEndPositions findLineEnd(const QChar *begin, const QChar *end) +{ + LineEndPositions result{ end, end }; + + while (begin < end) { + if (*begin == Newline) { + result.lineEnd = begin; + result.nextLineBegin = begin + 1; + break; + } else if (*begin == CarriageReturn) { + result.lineEnd = begin; + result.nextLineBegin = begin + 1; + if (((begin + 1) < end) && begin[1] == Newline) + ++result.nextLineBegin; + break; + } + + ++begin; + } + + return result; +} + +static bool isBlankLine(const QChar *begin, const QChar *end) +{ + while (begin < end) { + if (*begin != Space && *begin != Tab) + return false; + ++begin; + } + return true; +} + +static QString createLinkTitle(const QString &title) +{ + QString result; + result.reserve(title.size() + 2); + result += DoubleQuote; + + const QChar *data = title.data(); + const QChar *end = data + title.size(); + + while (data < end) { + const auto lineEndPositions = findLineEnd(data, end); + + if (!isBlankLine(data, lineEndPositions.lineEnd)) { + while (data < lineEndPositions.nextLineBegin) { + if (*data == DoubleQuote) + result += Backslash; + result += *data; + ++data; + } + } + + data = lineEndPositions.nextLineBegin; + } + + result += DoubleQuote; + return result; +} + int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat, bool ignoreEmpty) { if (block.text().isEmpty() && ignoreEmpty) @@ -445,7 +514,12 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign col += s.length(); } else if (fmt.hasProperty(QTextFormat::AnchorHref)) { QString s = QLatin1Char('[') + fragmentText + QLatin1String("](") + - fmt.property(QTextFormat::AnchorHref).toString() + QLatin1Char(')'); + fmt.property(QTextFormat::AnchorHref).toString(); + if (fmt.hasProperty(QTextFormat::TextToolTip)) { + s += Space; + s += createLinkTitle(fmt.property(QTextFormat::TextToolTip).toString()); + } + s += QLatin1Char(')'); if (wrap && col + s.length() > ColumnLimit) { m_stream << Newline << wrapIndentString; col = m_wrappedLineIndent; |