diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp | 8 | ||||
-rw-r--r-- | src/gui/doc/snippets/transform/main.cpp | 19 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qxpmhandler.cpp | 33 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 3 | ||||
-rw-r--r-- | src/gui/math3d/qquaternion.cpp | 6 | ||||
-rw-r--r-- | src/gui/opengl/qopenglpaintdevice.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qcolorspace.cpp | 14 | ||||
-rw-r--r-- | src/gui/painting/qicc.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpagesize.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 21 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 29 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 13 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 18 | ||||
-rw-r--r-- | src/gui/util/qvalidator.cpp | 4 |
19 files changed, 140 insertions, 66 deletions
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp b/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp index 4acc2f12b7..149265c083 100644 --- a/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp +++ b/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp @@ -51,7 +51,7 @@ //! [0] x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy -if (is not affine) { +if (!isAffine()) { w' = m13*x + m23*y + m33 x' /= w' y' /= w' @@ -62,7 +62,7 @@ if (is not affine) { //! [1] x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy -if (is not affine) { +if (!isAffine()) { w' = m13*x + m23*y + m33 x' /= w' y' /= w' @@ -73,7 +73,7 @@ if (is not affine) { //! [2] x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy -if (is not affine) { +if (!isAffine()) { w' = m13*x + m23*y + m33 x' /= w' y' /= w' @@ -84,7 +84,7 @@ if (is not affine) { //! [3] x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy -if (is not affine) { +if (!isAffine()) { w' = m13*x + m23*y + m33 x' /= w' y' /= w' diff --git a/src/gui/doc/snippets/transform/main.cpp b/src/gui/doc/snippets/transform/main.cpp index e30a3b63bf..5120709aef 100644 --- a/src/gui/doc/snippets/transform/main.cpp +++ b/src/gui/doc/snippets/transform/main.cpp @@ -47,8 +47,12 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include <QApplication> +#include <QMath> +#include <QPainter> +#include <QVBoxLayout> +#include <QWidget> -#include <QtGui> #include <cmath> class SimpleTransformation : public QWidget @@ -103,18 +107,15 @@ class BasicOperations : public QWidget //! [2] void BasicOperations::paintEvent(QPaintEvent *) { - double pi = 3.14; - - double a = pi/180 * 45.0; + const double a = qDegreesToRadians(45.0); double sina = sin(a); double cosa = cos(a); - QTransform translationTransform(1, 0, 0, 1, 50.0, 50.0); - QTransform rotationTransform(cosa, sina, -sina, cosa, 0, 0); - QTransform scalingTransform(0.5, 0, 0, 1.0, 0, 0); + QTransform scale(0.5, 0, 0, 1.0, 0, 0); + QTransform rotate(cosa, sina, -sina, cosa, 0, 0); + QTransform translate(1, 0, 0, 1, 50.0, 50.0); - QTransform transform; - transform = scalingTransform * rotationTransform * translationTransform; + QTransform transform = scale * rotate * translate; QPainter painter(this); painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index bbf44a484f..2811d2e049 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -649,10 +649,10 @@ bool QPngHandlerPrivate::readPngHeader() } if (primaries.areValid()) { colorSpace = QColorSpace(primaries.whitePoint, primaries.redPoint, primaries.greenPoint, primaries.bluePoint, - QColorSpace::TransferFunction::Gamma, fileGamma); + QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma); } else { colorSpace = QColorSpace(QColorSpace::Primaries::SRgb, - QColorSpace::TransferFunction::Gamma, fileGamma); + QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma); } colorSpaceState = GammaChrm; } diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 16fd78f25f..f78a7fee81 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -50,6 +50,7 @@ #include <qvariant.h> #include <algorithm> +#include <array> QT_BEGIN_NAMESPACE @@ -1056,15 +1057,23 @@ bool qt_read_xpm_image_or_array(QIODevice *device, const char * const * source, return read_xpm_body(device, source, index, state, cpp, ncols, w, h, image); } -static const char* xpm_color_name(int cpp, int index) +namespace { +template <size_t N> +struct CharBuffer : std::array<char, N> +{ + CharBuffer() {} // avoid value-initializing the whole array +}; +} + +static const char* xpm_color_name(int cpp, int index, CharBuffer<5> && returnable = {}) { - static char returnable[5]; static const char code[] = ".#abcdefghijklmnopqrstuvwxyzABCD" "EFGHIJKLMNOPQRSTUVWXYZ0123456789"; // cpp is limited to 4 and index is limited to 64^cpp if (cpp > 1) { if (cpp > 2) { if (cpp > 3) { + returnable[4] = '\0'; returnable[3] = code[index % 64]; index /= 64; } else @@ -1084,7 +1093,7 @@ static const char* xpm_color_name(int cpp, int index) returnable[1] = '\0'; returnable[0] = code[index]; - return returnable; + return returnable.data(); } @@ -1121,8 +1130,11 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const ++cpp; // limit to 4 characters per pixel // 64^4 colors is enough for a 4096x4096 image - if (cpp > 4) - break; + if (cpp > 4) { + qWarning("Qt does not support writing XPM images with more than " + "64^4 colors (requested: %d colors).", ncolors); + return false; + } } // write header @@ -1150,16 +1162,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y)); for(x=0; x<w; x++) { int color = (int)(*(yp + x)); - const QByteArray chars(xpm_color_name(cpp, colorMap[color])); - line.append(chars[0]); - if (cpp > 1) { - line.append(chars[1]); - if (cpp > 2) { - line.append(chars[2]); - if (cpp > 3) - line.append(chars[3]); - } - } + line.append(xpm_color_name(cpp, colorMap[color])); } s << ',' << Qt::endl << '\"' << line << '\"'; } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a95331e246..439b1127a2 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1316,7 +1316,10 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString } #endif - fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal(); + const auto platformIntegration = QGuiApplicationPrivate::platformIntegration(); + fontSmoothingGamma = platformIntegration->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal(); + QCoreApplication::setAttribute(Qt::AA_DontShowShortcutsInContextMenus, + !platformIntegration->styleHint(QPlatformIntegration::ShowShortcutsInContextMenus).toBool()); } static void init_plugins(const QList<QByteArray> &pluginList) @@ -2156,7 +2159,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo processMouseEvent(e); // the original mouse event return; } - if (mouseMove && !positionChanged) { + if (type == QEvent::MouseMove && !positionChanged) { // On Windows, and possibly other platforms, a touchpad can send a mouse move // that does not change position, between a press and a release. This may // confuse applications, so we always filter out these mouse events for diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 927e9cb94a..2291bfe70f 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1031,7 +1031,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) || qstrcmp(rendererString, "GC800 core") == 0 || qstrcmp(rendererString, "GC1000 core") == 0 || strstr(rendererString, "GC2000") != nullptr - || qstrcmp(rendererString, "Immersion.16") == 0; + || qstrcmp(rendererString, "Immersion.16") == 0 + || qstrncmp(rendererString, "Apple Mx", 7) == 0; } needsWorkaroundSet = true; } diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 5f15949c5b..67f013c82e 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -534,7 +534,11 @@ void QQuaternion::getEulerAngles(float *pitch, float *yaw, float *roll) const zw /= lengthSquared; } - *pitch = std::asin(-2.0f * (yz - xw)); + const float sinp = -2.0f * (yz - xw); + if (std::abs(sinp) >= 1.0f) + *pitch = std::copysign(M_PI_2, sinp); + else + *pitch = std::asin(sinp); if (*pitch < M_PI_2) { if (*pitch > -M_PI_2) { *yaw = std::atan2(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy)); diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index 3920a10467..9e7d2861fd 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -331,7 +331,7 @@ void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx) void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy) { - d_ptr->dpmx = dpmy; + d_ptr->dpmy = dpmy; } /*! diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp index 8b2ea4e04d..5977f8f8c5 100644 --- a/src/gui/painting/qcolorspace.cpp +++ b/src/gui/painting/qcolorspace.cpp @@ -146,13 +146,17 @@ QColorMatrix QColorSpacePrimaries::toXyzMatrix() const QColorVector srcCone = abrad.map(wXyz); QColorVector dstCone = abrad.map(wXyzD50); - QColorMatrix wToD50 = { { dstCone.x / srcCone.x, 0, 0 }, - { 0, dstCone.y / srcCone.y, 0 }, - { 0, 0, dstCone.z / srcCone.z } }; + if (srcCone.x && srcCone.y && srcCone.z) { + QColorMatrix wToD50 = { { dstCone.x / srcCone.x, 0, 0 }, + { 0, dstCone.y / srcCone.y, 0 }, + { 0, 0, dstCone.z / srcCone.z } }; - QColorMatrix chromaticAdaptation = abradinv * (wToD50 * abrad); - toXyz = chromaticAdaptation * toXyz; + QColorMatrix chromaticAdaptation = abradinv * (wToD50 * abrad); + toXyz = chromaticAdaptation * toXyz; + } else { + toXyz.r = {0, 0, 0}; // set to invalid value + } } return toXyz; diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp index 15e236ac9e..4651adbd2a 100644 --- a/src/gui/painting/qicc.cpp +++ b/src/gui/painting/qicc.cpp @@ -750,7 +750,7 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace) QColorVector whitePoint; if (!parseXyzData(data, tagIndex[Tag::wtpt], whitePoint)) return false; - if (!qFuzzyCompare(whitePoint.y, 1.0f) || (1.0f + whitePoint.z - whitePoint.x) == 0.0f) { + if (!qFuzzyCompare(whitePoint.y, 1.0f) || (1.0f + whitePoint.z + whitePoint.x) == 0.0f) { qCWarning(lcIcc) << "fromIccProfile: Invalid ICC profile - gray white-point not normalized"; return false; } diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h index 133274760f..5b53eae458 100644 --- a/src/gui/painting/qpagesize.h +++ b/src/gui/painting/qpagesize.h @@ -228,7 +228,7 @@ public: }; QPageSize(); - explicit QPageSize(PageSizeId pageSizeId); + /*implicit*/ QPageSize(PageSizeId pageSizeId); explicit QPageSize(const QSize &pointSize, const QString &name = QString(), SizeMatchPolicy matchPolicy = FuzzyMatch); diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 5a6a2d84e9..6d887717b9 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -415,15 +415,15 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &inPen) clipRect = xf.inverted().mapRect(QRectF(d->exDeviceRect)); } // Check to avoid generating unwieldy amount of dashes that will not be visible anyway - QRectF extentRect = cpRect & clipRect; + qreal pw = pen.widthF() ? pen.widthF() : 1; + QRectF extentRect = cpRect.adjusted(-pw, -pw, pw, pw) & clipRect; qreal extent = qMax(extentRect.width(), extentRect.height()); qreal patternLength = 0; const QVector<qreal> pattern = pen.dashPattern(); const int patternSize = qMin(pattern.size(), 32); for (int i = 0; i < patternSize; i++) patternLength += qMax(pattern.at(i), qreal(0)); - if (pen.widthF()) - patternLength *= pen.widthF(); + patternLength *= pw; if (qFuzzyIsNull(patternLength)) { pen.setStyle(Qt::NoPen); } else if (extent / patternLength > 10000) { diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 0952bd22fb..e86aff1cae 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -222,6 +222,7 @@ static void nanWarning(const char *func) transformation is achieved by setting both the projection factors and the scaling factors. + \section2 Combining Transforms Here's the combined transformations example using basic matrix operations: @@ -232,6 +233,26 @@ static void nanWarning(const char *func) \snippet transform/main.cpp 2 \endtable + The combined transform first scales each operand, then rotates it, and + finally translates it, just as in the order in which the product of its + factors is written. This means the point to which the transforms are + applied is implicitly multiplied on the left with the transform + to its right. + + \section2 Relation to Matrix Notation + The matrix notation in QTransform is the transpose of a commonly-taught + convention which represents transforms and points as matrices and vectors. + That convention multiplies its matrix on the left and column vector to the + right. In other words, when several transforms are applied to a point, the + right-most matrix acts directly on the vector first. Then the next matrix + to the left acts on the result of the first operation - and so on. As a + result, that convention multiplies the matrices that make up a composite + transform in the reverse of the order in QTransform, as you can see in + \l {Combining Transforms}. Transposing the matrices, and combining them to + the right of a row vector that represents the point, lets the matrices of + transforms appear, in their product, in the order in which we think of the + transforms being applied to the point. + \sa QPainter, {Coordinate System}, {painting/affine}{Affine Transformations Example}, {Transformations Example} */ diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index bdbfcd7af4..b9095d45f6 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -414,6 +414,25 @@ void QtFontFamily::ensurePopulated() Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name)); } +/*! + \internal + + Tests if the given family \a family supports writing system \a writingSystem, + including the special case for Han script mapping to several subsequent writing systems +*/ +static bool familySupportsWritingSystem(QtFontFamily *family, size_t writingSystem) +{ + Q_ASSERT(family != nullptr); + Q_ASSERT(writingSystem != QFontDatabase::Any && writingSystem < QFontDatabase::WritingSystemsCount); + + size_t ws = writingSystem; + do { + if ((family->writingSystems[ws] & QtFontFamily::Supported) != 0) + return true; + } while (writingSystem >= QFontDatabase::SimplifiedChinese && writingSystem <= QFontDatabase::Japanese && ++ws <= QFontDatabase::Japanese); + + return false; +} struct FallbacksCacheKey { QString family; @@ -828,7 +847,7 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo f->ensurePopulated(); - if (writingSystem > QFontDatabase::Any && f->writingSystems[writingSystem] != QtFontFamily::Supported) + if (writingSystem > QFontDatabase::Any && !familySupportsWritingSystem(f, writingSystem)) continue; for (int j = 0; j < f->count; ++j) { @@ -1273,8 +1292,10 @@ static int match(int script, const QFontDef &request, test.family->ensurePopulated(); // Check if family is supported in the script we want - if (writingSystem != QFontDatabase::Any && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported)) + if (writingSystem != QFontDatabase::Any + && !familySupportsWritingSystem(test.family, writingSystem)) { continue; + } // as we know the script is supported, we can be sure // to find a matching font here. @@ -2895,10 +2916,8 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script } uint order = i; - if (testFamily == nullptr - || (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) { + if (testFamily == nullptr || !familySupportsWritingSystem(testFamily, writingSystem)) order |= 1u << 31; - } supported.insert(order, family); } diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index d7bc707491..2fdfcaa2d2 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -1296,5 +1296,6 @@ QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &html, const return res; } -QT_END_NAMESPACE #endif // QT_NO_TEXTHTMLPARSER + +QT_END_NAMESPACE diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 9d70873590..ba72e26c3f 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2186,9 +2186,11 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p painter->setRenderHint(QPainter::Antialiasing); + const bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker; if (selectionFormat) { painter->setPen(QPen(selectionFormat->foreground(), 0)); - painter->fillRect(r, selectionFormat->background()); + if (!marker) + painter->fillRect(r, selectionFormat->background()); } else { QBrush fg = charFormat.foreground(); if (fg == Qt::NoBrush) @@ -2198,19 +2200,21 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p QBrush brush = context.palette.brush(QPalette::Text); - bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker; if (marker) { int adj = fontMetrics.lineSpacing() / 6; r.adjust(-adj, 0, -adj, 0); + const QRectF outer = r.adjusted(-adj, -adj, adj, adj); + if (selectionFormat) + painter->fillRect(outer, selectionFormat->background()); if (bl.blockFormat().marker() == QTextBlockFormat::MarkerType::Checked) { - // ### Qt6: render with QStyle / PE_IndicatorCheckBox. We don't currently + // ### Qt7: render with QStyle / PE_IndicatorCheckBox. We don't currently // have access to that here, because it would be a widget dependency. painter->setPen(QPen(painter->pen().color(), 2)); painter->drawLine(r.topLeft(), r.bottomRight()); painter->drawLine(r.topRight(), r.bottomLeft()); painter->setPen(QPen(painter->pen().color(), 0)); } - painter->drawRect(r.adjusted(-adj, -adj, adj, adj)); + painter->drawRect(outer); } switch (style) { diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3edd8b4cc5..805ab87dd6 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2190,10 +2190,15 @@ void QTextEngine::itemize() const : formatCollection()->defaultFont().capitalization(); if (s) { for (const auto &range : qAsConst(s->formats)) { - if (range.start >= prevPosition && range.start < position && range.format.hasProperty(QTextFormat::FontCapitalization)) { - itemizer.generate(prevPosition, range.start - prevPosition, capitalization); - itemizer.generate(range.start, range.length, range.format.fontCapitalization()); - prevPosition = range.start + range.length; + if (range.start + range.length <= prevPosition || range.start >= position) + continue; + if (range.format.hasProperty(QTextFormat::FontCapitalization)) { + if (range.start > prevPosition) + itemizer.generate(prevPosition, range.start - prevPosition, capitalization); + int newStart = std::max(prevPosition, range.start); + int newEnd = std::min(position, range.start + range.length); + itemizer.generate(newStart, newEnd - newStart, range.format.fontCapitalization()); + prevPosition = newEnd; } } } diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 5ae41d9459..26ac37b016 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1173,10 +1173,17 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang QRectF fullLineRect(tl.rect()); fullLineRect.translate(position); fullLineRect.setRight(QFIXED_MAX); - if (!selectionEndInLine) - region.addRect(clipIfValid(QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip)); - if (!selectionStartInLine) - region.addRect(clipIfValid(QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip)); + + const bool rightToLeft = d->isRightToLeft(); + + if (!selectionEndInLine) { + region.addRect(clipIfValid(rightToLeft ? QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()) + : QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip)); + } + if (!selectionStartInLine) { + region.addRect(clipIfValid(rightToLeft ? QRectF(lineRect.topRight(), fullLineRect.bottomRight()) + : QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip)); + } } else if (!selectionEndInLine && isLastLineInBlock &&!(d->option.flags() & QTextOption::ShowLineAndParagraphSeparators)) { @@ -1980,7 +1987,8 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.currentPosition >= eng->layoutData->string.length() || isBreakableSpace - || attributes[lbh.currentPosition].lineBreak) { + || attributes[lbh.currentPosition].lineBreak + || lbh.tmpData.textWidth >= QFIXED_MAX) { sb_or_ws = true; break; } else if (attributes[lbh.currentPosition].graphemeBoundary) { diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 86f4db5dbd..70ed6cca3d 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -84,8 +84,8 @@ QT_BEGIN_NAMESPACE \list \li For a line edit that accepts integers from 10 to 1000 inclusive, - 42 and 123 are \l Acceptable, the empty string and 5 are \l - Intermediate, and "asdf" and 1114 is \l Invalid. + 42 and 123 are \l Acceptable, the empty string, 5, or 1234 are \l + Intermediate, and "asdf" and 10114 is \l Invalid. \li For an editable combobox that accepts URLs, any well-formed URL is \l Acceptable, "http://example.com/," is \l Intermediate |