diff options
author | Jerome Pasion <jerome.pasion@digia.com> | 2012-11-02 14:41:27 +0100 |
---|---|---|
committer | Jerome Pasion <jerome.pasion@digia.com> | 2012-11-02 14:41:27 +0100 |
commit | c808dd27459e030fde0577feb8ba06e3bd465526 (patch) | |
tree | 4bf898dc4a88e2b03c9716f940638a2e01c6c0ce /src/gui | |
parent | d9d8845d507a6bdbc9c9f24c0d9d86dca513461d (diff) | |
parent | 300534fc214f2547a63594ce0891e9a54c8f33ca (diff) |
Merge branch 'master' of ssh://codereview.qt-project.org/qt/qtbase into newdocs
Change-Id: I7e6cee190a341901dfbf8effb54ebccb91bf7a17
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 3 | ||||
-rw-r--r-- | src/gui/accessible/qaccessible.h | 4 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 10 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 7 | ||||
-rw-r--r-- | src/gui/itemmodels/qstandarditemmodel.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 11 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 54 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 19 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 1 | ||||
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 7 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 29 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 |
19 files changed, 127 insertions, 73 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index feaf468c54..61f1773d70 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -41,8 +41,6 @@ #include "qaccessible.h" -#ifndef QT_NO_ACCESSIBILITY - #include "qaccessibleplugin.h" #include "qaccessibleobject.h" #include "qaccessiblebridge.h" @@ -1265,4 +1263,3 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) QT_END_NAMESPACE -#endif diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 08c0952a5a..1fb6c65482 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -58,8 +58,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - class QAccessibleInterface; class QAccessibleEvent; class QWindow; @@ -678,8 +676,6 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r } #endif -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 25999b7d06..9da360bc26 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4915,43 +4915,33 @@ int QImage::metric(PaintDeviceMetric metric) const switch (metric) { case PdmWidth: return d->width; - break; case PdmHeight: return d->height; - break; case PdmWidthMM: return qRound(d->width * 1000 / d->dpmx); - break; case PdmHeightMM: return qRound(d->height * 1000 / d->dpmy); - break; case PdmNumColors: return d->colortable.size(); - break; case PdmDepth: return d->depth; - break; case PdmDpiX: return qRound(d->dpmx * 0.0254); - break; case PdmDpiY: return qRound(d->dpmy * 0.0254); - break; case PdmPhysicalDpiX: return qRound(d->dpmx * 0.0254); - break; case PdmPhysicalDpiY: return qRound(d->dpmy * 0.0254); - break; default: qWarning("QImage::metric(): Unhandled metric type %d", metric); diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 2307ceb7ae..8434282178 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -849,13 +849,6 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, vo png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); } - png_color_8 sig_bit; - sig_bit.red = 8; - sig_bit.green = 8; - sig_bit.blue = 8; - sig_bit.alpha = image.hasAlphaChannel() ? 8 : 0; - png_set_sBIT(png_ptr, info_ptr, &sig_bit); - if (image.format() == QImage::Format_MonoLSB) png_set_packswap(png_ptr); diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 6e919eb0b2..fdd00fe980 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2935,7 +2935,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const return data; QByteArray encoded; QDataStream stream(&encoded, QIODevice::WriteOnly); - + QSet<QStandardItem*> itemsSet; QStack<QStandardItem*> stack; itemsSet.reserve(indexes.count()); @@ -2945,7 +2945,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const itemsSet << item; stack.push(item); } - + //remove duplicates childrens { QSet<QStandardItem *> seen; @@ -2954,7 +2954,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const if (seen.contains(itm)) continue; seen.insert(itm); - + const QVector<QStandardItem*> &childList = itm->d_func()->children; for (int i = 0; i < childList.count(); ++i) { QStandardItem *chi = childList.at(i); @@ -2968,17 +2968,17 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const } } } - + stack.reserve(itemsSet.count()); foreach (QStandardItem *item, itemsSet) { stack.push(item); } - + //stream everything recursively while (!stack.isEmpty()) { QStandardItem *item = stack.pop(); if(itemsSet.contains(item)) { //if the item is selection 'top-level', strem its position - stream << item->row() << item->column(); + stream << item->row() << item->column(); } if(item) { stream << *item << item->columnCount() << item->d_ptr->children.count(); @@ -2996,7 +2996,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const /* \internal Used by QStandardItemModel::dropMimeData - stream out an item and his children + stream out an item and his children */ void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item) { @@ -3004,9 +3004,9 @@ void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStanda stream >> *item; stream >> colCount >> childCount; item->setColumnCount(colCount); - + int childPos = childCount; - + while(childPos > 0) { childPos--; QStandardItem *child = createItem(); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 64d2f8001f..efb34ffe9f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -105,6 +105,7 @@ QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0); bool QGuiApplicationPrivate::tabletState = false; QWindow *QGuiApplicationPrivate::tabletPressTarget = 0; +QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; @@ -455,7 +456,19 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal) { self->modalWindowList.prepend(modal); - QEvent e(QEvent::WindowBlocked); + // Send leave for currently entered window if it should be blocked + if (currentMouseWindow && (currentMouseWindow->windowType() & Qt::Popup) != Qt::Popup) { + bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow); + if (shouldBeBlocked) { + // Remove the new window from modalWindowList temporarily so leave can go through + self->modalWindowList.removeFirst(); + QEvent e(QEvent::Leave); + QGuiApplication::sendEvent(currentMouseWindow, &e); + currentMouseWindow = 0; + self->modalWindowList.prepend(modal); + } + } + QWindowList windows = QGuiApplication::topLevelWindows(); for (int i = 0; i < windows.count(); ++i) { QWindow *window = windows.at(i); @@ -470,7 +483,6 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window) { self->modalWindowList.removeAll(window); - QEvent e(QEvent::WindowUnblocked); QWindowList windows = QGuiApplication::topLevelWindows(); for (int i = 0; i < windows.count(); ++i) { QWindow *window = windows.at(i); @@ -1410,6 +1422,8 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En return; } + currentMouseWindow = e->enter; + QEvent event(QEvent::Enter); QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event); } @@ -1423,6 +1437,8 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le return; } + currentMouseWindow = 0; + QEvent event(QEvent::Leave); QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); } diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 44a9275688..c9eb672220 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -189,6 +189,7 @@ public: static QPointF lastCursorPosition; static bool tabletState; static QWindow *tabletPressTarget; + static QWindow *currentMouseWindow; #ifndef QT_NO_CLIPBOARD static QClipboard *qt_clipboard; diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index cf55c59bab..5259ed9164 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -195,6 +195,10 @@ QPlatformServices *QPlatformIntegration::services() const \value BufferQueueingOpenGL The OpenGL implementation on the platform will queue up buffers when swapBuffers() is called and block only when its buffer pipeline is full, rather than block immediately. + + \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind + of compositing either client or server side. Some platforms might only support a + single fullscreen window. */ diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 7e8888407c..b4c8ebff5a 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -83,11 +83,12 @@ class Q_GUI_EXPORT QPlatformIntegration public: enum Capability { ThreadedPixmaps = 1, - OpenGL = 2, - ThreadedOpenGL = 3, - SharedGraphicsCache = 4, - BufferQueueingOpenGL = 5, - WindowMasks = 6 + OpenGL, + ThreadedOpenGL, + SharedGraphicsCache, + BufferQueueingOpenGL, + WindowMasks, + MultipleWindows }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 64f738b331..7e7ccdb294 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -102,6 +102,7 @@ public: virtual void setText(const QString &text) = 0; virtual void setEnabled(bool enabled) = 0; + virtual void setVisible(bool visible) = 0; virtual QPlatformMenuItem *menuItemAt(int position) const = 0; virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0; diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4f1610cb21..d845be3d01 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -214,6 +214,8 @@ QWindow::~QWindow() { if (QGuiApplicationPrivate::focus_window == this) QGuiApplicationPrivate::focus_window = 0; + if (QGuiApplicationPrivate::currentMouseWindow == this) + QGuiApplicationPrivate::currentMouseWindow = 0; QGuiApplicationPrivate::window_list.removeAll(this); destroy(); } @@ -939,9 +941,24 @@ void QWindow::setMinimumSize(const QSize &size) QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); if (d->minimumSize == adjustedSize) return; + QSize oldSize = d->minimumSize; d->minimumSize = adjustedSize; if (d->platformWindow && isTopLevel()) d->platformWindow->propagateSizeHints(); + if (d->minimumSize.width() != oldSize.width()) + emit minimumWidthChanged(d->minimumSize.width()); + if (d->minimumSize.height() != oldSize.height()) + emit minimumHeightChanged(d->minimumSize.height()); +} + +void QWindow::setMinimumWidth(int w) +{ + setMinimumSize(QSize(w, minimumHeight())); +} + +void QWindow::setMinimumHeight(int h) +{ + setMinimumSize(QSize(minimumWidth(), h)); } /*! @@ -957,9 +974,24 @@ void QWindow::setMaximumSize(const QSize &size) QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); if (d->maximumSize == adjustedSize) return; + QSize oldSize = d->maximumSize; d->maximumSize = adjustedSize; if (d->platformWindow && isTopLevel()) d->platformWindow->propagateSizeHints(); + if (d->maximumSize.width() != oldSize.width()) + emit maximumWidthChanged(d->maximumSize.width()); + if (d->maximumSize.height() != oldSize.height()) + emit maximumHeightChanged(d->maximumSize.height()); +} + +void QWindow::setMaximumWidth(int w) +{ + setMaximumSize(QSize(w, maximumHeight())); +} + +void QWindow::setMaximumHeight(int h) +{ + setMaximumSize(QSize(maximumWidth(), h)); } /*! @@ -1058,6 +1090,26 @@ void QWindow::setGeometry(const QRect &rect) */ /*! + \property QWindow::minimumWidth + \brief the minimum width of the window's geometry +*/ + +/*! + \property QWindow::minimumHeight + \brief the minimum height of the window's geometry +*/ + +/*! + \property QWindow::maximumWidth + \brief the maximum width of the window's geometry +*/ + +/*! + \property QWindow::maximumHeight + \brief the maximum height of the window's geometry +*/ + +/*! Returns the geometry of the window, excluding its window frame. \sa frameMargins(), frameGeometry() @@ -1445,6 +1497,8 @@ bool QWindow::close() if (QGuiApplicationPrivate::focus_window == this) QGuiApplicationPrivate::focus_window = 0; + if (QGuiApplicationPrivate::currentMouseWindow == this) + QGuiApplicationPrivate::currentMouseWindow = 0; QGuiApplicationPrivate::window_list.removeAll(this); destroy(); diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 62268cd88a..4832adfb63 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -104,6 +104,10 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_PROPERTY(QPoint pos READ pos WRITE setPos) Q_PROPERTY(QSize size READ size WRITE resize) Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) + Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged) + Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged) + Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged) + Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged) Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged) #ifndef QT_NO_CURSOR @@ -170,6 +174,11 @@ public: bool isExposed() const; + int minimumWidth() const { return minimumSize().width(); } + int minimumHeight() const { return minimumSize().height(); } + int maximumWidth() const { return maximumSize().width(); } + int maximumHeight() const { return maximumSize().height(); } + QSize minimumSize() const; QSize maximumSize() const; QSize baseSize() const; @@ -273,6 +282,11 @@ public Q_SLOTS: setGeometry(QRect(x(), y(), width(), arg)); } + void setMinimumWidth(int w); + void setMinimumHeight(int h); + void setMaximumWidth(int w); + void setMaximumHeight(int h); + Q_SIGNALS: void screenChanged(QScreen *screen); void windowModalityChanged(Qt::WindowModality windowModality); @@ -283,6 +297,11 @@ Q_SIGNALS: void widthChanged(int arg); void heightChanged(int arg); + void minimumWidthChanged(int arg); + void minimumHeightChanged(int arg); + void maximumWidthChanged(int arg); + void maximumHeightChanged(int arg); + void visibleChanged(bool arg); void contentOrientationChanged(Qt::ScreenOrientation orientation); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 159f05d1a5..bce6a4ff04 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -80,6 +80,7 @@ public: , positionPolicy(WindowFrameExclusive) , contentOrientation(Qt::PrimaryOrientation) , windowOrientation(Qt::PrimaryOrientation) + , minimumSize(0, 0) , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) , modality(Qt::NonModal) , blockedByModalWindow(false) diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index ef8e420c27..380ada37e0 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -349,7 +349,6 @@ bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus(QOpenGLContext *ctx case GL_NO_ERROR: case GL_FRAMEBUFFER_COMPLETE: return true; - break; case GL_FRAMEBUFFER_UNSUPPORTED: qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format."); break; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 7070e5732d..0cfe953e43 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7498,8 +7498,11 @@ start_lengthVariant: l.setLineWidth(lineWidth); height += leading; + + // Make sure lines are positioned on whole pixels + height = qCeil(height); l.setPosition(QPointF(0., height)); - height += l.height(); + height += textLayout.engine()->lines[l.lineNumber()].height().toReal(); width = qMax(width, l.naturalTextWidth()); if (!dontclip && !brect && height >= r.height()) break; diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 8cf57a8987..4b53257832 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1630,7 +1630,6 @@ QPainterPath QPathClipper::clip(Operation operation) result.addRect(subjectBounds); return result; } - break; case BoolAnd: return clipPath; case BoolOr: diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index bdcf166243..fa4e7a75bc 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1370,7 +1370,9 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode(); if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { - QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos); + QGlyphLayoutInstance tmp; + if (!(flags & GlyphIndicesOnly)) + tmp = glyphs->instance(glyph_pos); for (int x=1; x < engines.size(); ++x) { if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4)) continue; @@ -1400,9 +1402,8 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, } // ensure we use metrics from the 1st font when we use the fallback image. - if (!glyphs->glyphs[glyph_pos]) { + if (!(flags & GlyphIndicesOnly) && !glyphs->glyphs[glyph_pos]) glyphs->setInstance(glyph_pos, tmp); - } } if (surrogate) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 7baf55caea..f183e1eb20 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -119,18 +119,14 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() formatsChanged = true; } - QTextCharFormat emptyFormat; - - QTextLayout::FormatRange r; - r.start = -1; - int i = 0; while (i < formatChanges.count()) { + QTextLayout::FormatRange r; - while (i < formatChanges.count() && formatChanges.at(i) == emptyFormat) + while (i < formatChanges.count() && formatChanges.at(i) == r.format) ++i; - if (i >= formatChanges.count()) + if (i == formatChanges.count()) break; r.start = i; @@ -139,9 +135,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() while (i < formatChanges.count() && formatChanges.at(i) == r.format) ++i; - if (i >= formatChanges.count()) - break; - + Q_ASSERT(i <= formatChanges.count()); r.length = i - r.start; if (preeditAreaLength != 0) { @@ -153,21 +147,6 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() ranges << r; formatsChanged = true; - r.start = -1; - } - - if (r.start != -1) { - r.length = formatChanges.count() - r.start; - - if (preeditAreaLength != 0) { - if (r.start >= preeditAreaStart) - r.start += preeditAreaLength; - else if (r.start + r.length >= preeditAreaStart) - r.length += preeditAreaLength; - } - - ranges << r; - formatsChanged = true; } if (formatsChanged) { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a0a92897c5..0ca8e8d9a6 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -916,7 +916,7 @@ QRectF QTextLayout::boundingRect() const QFixed lineWidth = si.width < QFIXED_MAX ? qMax(si.width, si.textWidth) : si.textWidth; xmax = qMax(xmax, si.x+lineWidth); // ### shouldn't the ascent be used in ymin??? - ymax = qMax(ymax, si.y+si.height()); + ymax = qMax(ymax, si.y+si.height().ceil()); } return QRectF(xmin.toReal(), ymin.toReal(), (xmax-xmin).toReal(), (ymax-ymin).toReal()); } @@ -1466,7 +1466,7 @@ qreal QTextLine::descent() const */ qreal QTextLine::height() const { - return eng->lines[index].height().toReal(); + return eng->lines[index].height().ceil().toReal(); } /*! |