From 8b42e57fe2946f2cd17f538d0dec2ba6edc06a11 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 11 Jan 2010 10:44:55 +0100 Subject: QTreeView::selectAll() wouldn't work when first column hidden QTreeView::selectAll() called QTreeView::select() on the first column, first and last rows, and rows selection flags. As the first row was hidden, this range spanned to void. We now pass the upper-left and lower-right indices to select(). Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-6450 --- src/gui/itemviews/qtreeview.cpp | 7 +++++-- tests/auto/qtreeview/tst_qtreeview.cpp | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index bf88a75..f25d648 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2644,10 +2644,13 @@ void QTreeView::selectAll() return; SelectionMode mode = d->selectionMode; d->executePostedLayout(); //make sure we lay out the items - if (mode != SingleSelection && !d->viewItems.isEmpty()) - d->select(d->viewItems.first().index, d->viewItems.last().index, + if (mode != SingleSelection && !d->viewItems.isEmpty()) { + const QModelIndex &idx = d->viewItems.last().index; + QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1); + d->select(d->viewItems.first().index, lastItemIndex, QItemSelectionModel::ClearAndSelect |QItemSelectionModel::Rows); + } } /*! diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 4fc6dd3..06bc93e 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -236,6 +236,7 @@ private slots: void task248022_changeSelection(); void task245654_changeModelAndExpandAll(); void doubleClickedWithSpans(); + void taskQTBUG_6450_selectAllWith1stColumnHidden(); }; class QtTestModel: public QAbstractItemModel @@ -3678,5 +3679,26 @@ void tst_QTreeView::doubleClickedWithSpans() QTRY_COMPARE(spy.count(), 2); } +void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() +{ + QTreeWidget tree; + tree.setSelectionMode(QAbstractItemView::MultiSelection); + tree.setColumnCount(2); + QList items; + const int nrRows = 10; + for (int i = 0; i < nrRows; ++i) { + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + items.last()->setText(1, QString("is an item")); + } + tree.insertTopLevelItems(0, items); + + tree.hideColumn(0); + tree.selectAll(); + + QVERIFY(tree.selectionModel()->hasSelection()); + for (int i = 0; i < nrRows; ++i) + QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex())); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" -- cgit v0.12 From 45fedfeb405807453e94958808c2f1d48bb846ca Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 8 Jan 2010 15:51:59 +0100 Subject: Track the glVertexAttribPointer and only update it if it's changed This removes a lot of unnecessary GL state changes resulting in an 18% performance boost on desktop and 5% on SGX for the 25920 3x3 solid rectangle test case. Reviewed-By: Samuel --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 48 +++++++++------------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 20 +++++++++ .../gl2paintengineex/qtextureglyphcache_gl.cpp | 27 +++++++++--- 3 files changed, 61 insertions(+), 34 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ff096c2..f8f0347 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -580,19 +580,19 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) } if (newMode == TextDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); } if (newMode == ImageDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticVertexCoordinateArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticTextureCoordinateArray); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); } if (newMode == ImageArrayDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); - glVertexAttribPointer(QT_OPACITY_ATTR, 1, GL_FLOAT, GL_FALSE, 0, opacityArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); + setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); } // This needs to change when we implement high-quality anti-aliasing... @@ -707,9 +707,9 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); #ifdef QT_OPENGL_CACHE_AS_VBOS glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, 0); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); #else - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, cache->vertices); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); #endif glDrawArrays(cache->primitiveType, 0, cache->vertexCount); @@ -829,7 +829,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, glStencilMask(GL_STENCIL_HIGH_BIT); #if 0 glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #else @@ -840,7 +840,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, } else { glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); } - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #endif } @@ -954,15 +954,8 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect) { - // Setup a vertex array for the bounding rect: - GLfloat rectVerts[] = { - boundingRect.left, boundingRect.top, - boundingRect.left, boundingRect.bottom, - boundingRect.right, boundingRect.bottom, - boundingRect.right, boundingRect.top - }; - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, rectVerts); + setCoords(staticVertexCoordinateArray, boundingRect); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -971,7 +964,7 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i GLenum primitive) { // Now setup the pointer to the vertex array: - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)data); int previousStop = 0; for (int i=0; iwidth(); GLfloat dy = 1.0 / cache->height(); - QGLPoint *oldVertexCoordinateDataPtr = vertexCoordinateArray.data(); - QGLPoint *oldTextureCoordinateDataPtr = textureCoordinateArray.data(); - vertexCoordinateArray.clear(); textureCoordinateArray.clear(); @@ -1306,10 +1296,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly textureCoordinateArray.addRect(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); } - if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr) - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - if (textureCoordinateArray.data() != oldTextureCoordinateDataPtr) - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); if (addOffset) { addOffset = false; @@ -1641,6 +1629,8 @@ void QGL2PaintEngineEx::ensureActive() d->shaderManager->setDirty(); d->ctx->d_func()->syncGlState(); setState(state()); + for (int i = 0; i < 3; ++i) + d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered } } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index eaae187..f745196 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -196,6 +196,9 @@ public: void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); void drawCachedGlyphs(const QPointF &p, QFontEngineGlyphCache::Type glyphType, const QTextItemInt &ti); + // Calls glVertexAttributePointer if the pointer has changed + inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer); + // draws whatever is in the vertex array: void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive); void drawVertexArrays(QGL2PEXVertexArray &vertexArray, GLenum primitive) { @@ -230,6 +233,7 @@ public: void regenerateClip(); void systemStateChanged(); + static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; } static QGL2PaintEngineExPrivate *getData(QGL2PaintEngineEx *engine) { return engine->d_func(); } static void cleanupVectorPath(QPaintEngineEx *engine, void *data); @@ -291,8 +295,24 @@ public: QSet pathCaches; QVector unusedVBOSToClean; + + const GLfloat *vertexAttribPointers[3]; }; + +void QGL2PaintEngineExPrivate::setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer) +{ + Q_ASSERT(arrayIndex < 3); + if (pointer == vertexAttribPointers[arrayIndex]) + return; + + vertexAttribPointers[arrayIndex] = pointer; + if (arrayIndex == QT_OPACITY_ATTR) + glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, pointer); + else + glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, pointer); +} + QT_END_NAMESPACE #endif diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 047876f..4034448 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -127,11 +127,28 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glViewport(0, 0, oldWidth, oldHeight); - float vertexCoordinateArray[] = { -1, -1, 1, -1, 1, 1, -1, 1 }; - float textureCoordinateArray[] = { 0, 0, 1, 0, 1, 1, 0, 1 }; - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray); + GLfloat* vertexCoordinateArray = pex->staticVertexCoordinateArray; + vertexCoordinateArray[0] = -1.0f; + vertexCoordinateArray[1] = -1.0f; + vertexCoordinateArray[2] = 1.0f; + vertexCoordinateArray[3] = -1.0f; + vertexCoordinateArray[4] = 1.0f; + vertexCoordinateArray[5] = 1.0f; + vertexCoordinateArray[6] = -1.0f; + vertexCoordinateArray[7] = 1.0f; + + GLfloat* textureCoordinateArray = pex->staticTextureCoordinateArray; + textureCoordinateArray[0] = 0.0f; + textureCoordinateArray[1] = 0.0f; + textureCoordinateArray[2] = 1.0f; + textureCoordinateArray[3] = 0.0f; + textureCoordinateArray[4] = 1.0f; + textureCoordinateArray[5] = 1.0f; + textureCoordinateArray[6] = 0.0f; + textureCoordinateArray[7] = 1.0f; + + pex->setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertexCoordinateArray); + pex->setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, textureCoordinateArray); pex->shaderManager->useBlitProgram(); pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); -- cgit v0.12 From 820db2b2c5a0fc470fa5759d95ea49305ec98654 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 11 Jan 2010 11:39:19 +0100 Subject: Fix incorrect drawing of the hovered row on QTreeView with some styles. Some styles such as oxygen, or gtk, require the whole row to be redrawn in case of mouse hover the items. There was special code that handle that in the MouseMove event of the QTreeView, but that did not covered all the case (such as scrolling with the mouse wheel) Reviewed-by: Gabriel --- src/gui/itemviews/qabstractitemview.cpp | 11 +++++++++-- src/gui/itemviews/qtreeview.cpp | 9 --------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index f447989..f852e67 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -146,9 +146,16 @@ void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) if (hover == index) return; - q->update(hover); //update the old one + if (selectionBehavior != QAbstractItemView::SelectRows) { + q->update(hover); //update the old one + q->update(index); //update the new one + } else { + QRect oldHoverRect = q->visualRect(hover); + QRect newHoverRect = q->visualRect(index); + viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height())); + viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height())); + } hover = index; - q->update(hover); //update the new one } void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index f25d648..24b448c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1241,15 +1241,6 @@ bool QTreeView::viewportEvent(QEvent *event) viewport()->update(newRect); } } - if (selectionBehavior() == QAbstractItemView::SelectRows) { - QModelIndex newHoverIndex = indexAt(he->pos()); - if (d->hover != newHoverIndex) { - QRect oldHoverRect = visualRect(d->hover); - QRect newHoverRect = visualRect(newHoverIndex); - viewport()->update(QRect(0, newHoverRect.y(), viewport()->width(), newHoverRect.height())); - viewport()->update(QRect(0, oldHoverRect.y(), viewport()->width(), oldHoverRect.height())); - } - } break; } default: break; -- cgit v0.12 From a34d372b45d75a32dcc300dbb7f8151e15df4294 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 11 Jan 2010 14:49:39 +0100 Subject: Fixes warning in the QMacStyle Warning such as QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0 because the font size might be specified in pixel, and pointSizeF returns -1 if the font size is in pixel (as documented) Reviewed-by: jbache Task-number: QTBUG-7263 --- src/gui/styles/qcleanlooksstyle.cpp | 2 +- src/gui/styles/qmacstyle_mac.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index b08847d..78beb5b 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -2069,7 +2069,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o // This is mainly to handle cases where someone sets the font on the window // and then the combo inherits it and passes it onward. At that point the resolve mask // is very, very weak. This makes it stonger. - font.setPointSizeF(menuItem->font.pointSizeF()); + font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF()); if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 4075cf7..25e3028 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3996,7 +3996,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // This is mainly to handle cases where someone sets the font on the window // and then the combo inherits it and passes it onward. At that point the resolve mask // is very, very weak. This makes it stonger. - myFont.setPointSizeF(mi->font.pointSizeF()); + myFont.setPointSizeF(QFontInfo(mi->font).pointSizeF()); p->setFont(myFont); p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1, contentRect.height(), text_flags ^ Qt::AlignRight, s); -- cgit v0.12 From eb84acd899aee992f5631ee0b9c0d992c8fbbd5a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 11 Jan 2010 15:05:20 +0100 Subject: Fixed subpixel antialiased text drawing with the GL2 engine. Fixed bug where drawing subpixel antialiased glyphs on a translucent surface would cause all the pixels in the glyphs' bounding box to become opaque. Task-number: QTBUG-7190 Reviewed-by: Trond --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 4034448..0720170 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -81,7 +81,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) data[i] = 0; if (m_type == QFontEngineGlyphCache::Raster_RGBMask) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); else glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); @@ -196,8 +196,20 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) for (int x = 0; x < maskWidth; ++x) src[x] = -src[x]; // convert 0 and 1 into 0 and 255 } - } - + } else if (mask.format() == QImage::Format_RGB32) { + // Make the alpha component equal to the average of the RGB values. + // This is needed when drawing sub-pixel antialiased text on translucent targets. + for (int y = 0; y < maskHeight; ++y) { + quint32 *src = (quint32 *) mask.scanLine(y); + for (int x = 0; x < maskWidth; ++x) { + uchar r = src[x] >> 16; + uchar g = src[x] >> 8; + uchar b = src[x]; + quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. + src[x] = (src[x] & 0x00ffffff) | (avg << 24); + } + } + } glBindTexture(GL_TEXTURE_2D, m_texture); if (mask.format() == QImage::Format_RGB32) { -- cgit v0.12 From dfcc48e9201dd64cce696248a9938d541a1a8cad Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 11 Jan 2010 15:13:58 +0100 Subject: Add odf-writer benchmark. --- tests/benchmarks/qtext/main.cpp | 79 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/qtext/main.cpp b/tests/benchmarks/qtext/main.cpp index 3c973b6..4bd2bee 100644 --- a/tests/benchmarks/qtext/main.cpp +++ b/tests/benchmarks/qtext/main.cpp @@ -41,19 +41,36 @@ #include #include +#include #include +#include #include +#include #include +Q_DECLARE_METATYPE(QTextDocument*) + class tst_QText: public QObject { Q_OBJECT +public: + tst_QText() { + m_lorem = QString::fromLatin1("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."); + } + private slots: void loadHtml_data(); void loadHtml(); void shaping_data(); void shaping(); + + void odfWriting_empty(); + void odfWriting_text(); + void odfWriting_images(); + +private: + QString m_lorem; }; void tst_QText::loadHtml_data() @@ -63,7 +80,7 @@ void tst_QText::loadHtml_data() QTest::newRow("simple") << QString::fromLatin1("Foo"); QTest::newRow("simple2") << QString::fromLatin1("Foo"); - QString parag = QString::fromLatin1("

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

"); + QString parag = QString::fromLatin1("

%1

").arg(m_lorem); QString header = QString::fromLatin1("test"); QTest::newRow("long") << QString::fromLatin1("test") + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag @@ -87,7 +104,7 @@ void tst_QText::shaping_data() { QTest::addColumn("parag"); QTest::newRow("empty") << QString(); - QTest::newRow("lorem") << QString::fromLatin1("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."); + QTest::newRow("lorem") << m_lorem; QTest::newRow("short") << QString::fromLatin1("Lorem ipsum dolor sit amet"); QFile file(QString::fromLatin1(SRCDIR) + QLatin1String("/bidi.txt")); @@ -120,6 +137,64 @@ void tst_QText::shaping() } } +void tst_QText::odfWriting_empty() +{ + QVERIFY(QTextDocumentWriter::supportedDocumentFormats().contains("ODF")); // odf compiled in + QTextDocument *doc = new QTextDocument(); + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +void tst_QText::odfWriting_text() +{ + QTextDocument *doc = new QTextDocument(); + QTextCursor cursor(doc); + QTextBlockFormat bf; + bf.setIndent(2); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + bf.setTopMargin(10); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + bf.setRightMargin(30); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +void tst_QText::odfWriting_images() +{ + QTextDocument *doc = new QTextDocument(); + QTextCursor cursor(doc); + cursor.insertText(m_lorem); + QImage image(400, 200, QImage::Format_ARGB32_Premultiplied); + cursor.insertImage(image); + cursor.insertText(m_lorem); + + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + QTEST_MAIN(tst_QText) #include "main.moc" -- cgit v0.12 From f9a6458f4abf8327354d227b3dd87bbab50d44e9 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 11 Jan 2010 15:43:52 +0100 Subject: Fixed justify aligned text drawing with the GL1 engine. The text was blurry because it wasn't pixel aligned. Fixed by using nearest-neighbour texture filtering when using only translations on the painter. Reviewed-by: Trond --- src/opengl/qpaintengine_opengl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 8dae02a..d20f96c 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4931,7 +4931,8 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - bool antialias = !(ti.fontEngine->fontDef.styleStrategy & QFont::NoAntialias); + bool antialias = !(ti.fontEngine->fontDef.styleStrategy & QFont::NoAntialias) + && (d->matrix.type() > QTransform::TxTranslate); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST); -- cgit v0.12 From 8798b36880d1387d2d27f7fb35ccbf02af6232a0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Jan 2010 17:48:23 +0100 Subject: fix release mode crash in qfont.cpp initFontSubst() on Windows mobile Since we've disabled LTCG for Windows CE by default, the code in initFontSubst() crashes on Windows mobile. Adding the extra const solves this problem. Task-number: QTBUG-6641 Reviewed-by: ossi --- src/gui/text/qfont.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index f1cd6bb..b414263 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1780,7 +1780,7 @@ Q_GLOBAL_STATIC(QFontSubst, globalFontSubst) static void initFontSubst() { // default substitutions - static const char *initTbl[] = { + static const char * const initTbl[] = { #if defined(Q_WS_X11) "arial", "helvetica", @@ -1812,7 +1812,6 @@ static void initFontSubst() } } - /*! Returns the first family name to be used whenever \a familyName is specified. The lookup is case insensitive. -- cgit v0.12 From dd68d100e08a6e58fce1d15a5f6db5f054bafd31 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Jan 2010 18:04:34 +0100 Subject: warning fixes for platforms, where qreal == float Reviewed-by: thartman --- src/corelib/kernel/qmath.cpp | 512 +++++++++++++++++++++---------------------- 1 file changed, 256 insertions(+), 256 deletions(-) diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp index 7c1e726..efa064d 100644 --- a/src/corelib/kernel/qmath.cpp +++ b/src/corelib/kernel/qmath.cpp @@ -44,262 +44,262 @@ QT_BEGIN_NAMESPACE const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = { - 0.0, - 0.024541228522912288, - 0.049067674327418015, - 0.073564563599667426, - 0.098017140329560604, - 0.1224106751992162, - 0.14673047445536175, - 0.17096188876030122, - 0.19509032201612825, - 0.2191012401568698, - 0.24298017990326387, - 0.26671275747489837, - 0.29028467725446233, - 0.31368174039889152, - 0.33688985339222005, - 0.35989503653498811, - 0.38268343236508978, - 0.40524131400498986, - 0.42755509343028208, - 0.44961132965460654, - 0.47139673682599764, - 0.49289819222978404, - 0.51410274419322166, - 0.53499761988709715, - 0.55557023301960218, - 0.57580819141784534, - 0.59569930449243336, - 0.61523159058062682, - 0.63439328416364549, - 0.65317284295377676, - 0.67155895484701833, - 0.68954054473706683, - 0.70710678118654746, - 0.72424708295146689, - 0.74095112535495911, - 0.75720884650648446, - 0.77301045336273699, - 0.78834642762660623, - 0.80320753148064483, - 0.81758481315158371, - 0.83146961230254524, - 0.84485356524970701, - 0.85772861000027212, - 0.87008699110871135, - 0.88192126434835494, - 0.89322430119551532, - 0.90398929312344334, - 0.91420975570353069, - 0.92387953251128674, - 0.93299279883473885, - 0.94154406518302081, - 0.94952818059303667, - 0.95694033573220894, - 0.96377606579543984, - 0.97003125319454397, - 0.97570213003852857, - 0.98078528040323043, - 0.98527764238894122, - 0.98917650996478101, - 0.99247953459870997, - 0.99518472667219682, - 0.99729045667869021, - 0.99879545620517241, - 0.99969881869620425, - 1.0, - 0.99969881869620425, - 0.99879545620517241, - 0.99729045667869021, - 0.99518472667219693, - 0.99247953459870997, - 0.98917650996478101, - 0.98527764238894122, - 0.98078528040323043, - 0.97570213003852857, - 0.97003125319454397, - 0.96377606579543984, - 0.95694033573220894, - 0.94952818059303667, - 0.94154406518302081, - 0.93299279883473885, - 0.92387953251128674, - 0.91420975570353069, - 0.90398929312344345, - 0.89322430119551521, - 0.88192126434835505, - 0.87008699110871146, - 0.85772861000027212, - 0.84485356524970723, - 0.83146961230254546, - 0.81758481315158371, - 0.80320753148064494, - 0.78834642762660634, - 0.7730104533627371, - 0.75720884650648468, - 0.74095112535495899, - 0.72424708295146689, - 0.70710678118654757, - 0.68954054473706705, - 0.67155895484701855, - 0.65317284295377664, - 0.63439328416364549, - 0.61523159058062693, - 0.59569930449243347, - 0.57580819141784545, - 0.55557023301960218, - 0.53499761988709715, - 0.51410274419322177, - 0.49289819222978415, - 0.47139673682599786, - 0.44961132965460687, - 0.42755509343028203, - 0.40524131400498992, - 0.38268343236508989, - 0.35989503653498833, - 0.33688985339222033, - 0.31368174039889141, - 0.29028467725446239, - 0.26671275747489848, - 0.24298017990326407, - 0.21910124015687005, - 0.19509032201612861, - 0.17096188876030122, - 0.1467304744553618, - 0.12241067519921635, - 0.098017140329560826, - 0.073564563599667732, - 0.049067674327417966, - 0.024541228522912326, - 0.0, - -0.02454122852291208, - -0.049067674327417724, - -0.073564563599667496, - -0.09801714032956059, - -0.1224106751992161, - -0.14673047445536158, - -0.17096188876030097, - -0.19509032201612836, - -0.2191012401568698, - -0.24298017990326382, - -0.26671275747489825, - -0.29028467725446211, - -0.31368174039889118, - -0.33688985339222011, - -0.35989503653498811, - -0.38268343236508967, - -0.40524131400498969, - -0.42755509343028181, - -0.44961132965460665, - -0.47139673682599764, - -0.49289819222978393, - -0.51410274419322155, - -0.53499761988709693, - -0.55557023301960196, - -0.57580819141784534, - -0.59569930449243325, - -0.61523159058062671, - -0.63439328416364527, - -0.65317284295377653, - -0.67155895484701844, - -0.68954054473706683, - -0.70710678118654746, - -0.72424708295146678, - -0.74095112535495888, - -0.75720884650648423, - -0.77301045336273666, - -0.78834642762660589, - -0.80320753148064505, - -0.81758481315158382, - -0.83146961230254524, - -0.84485356524970701, - -0.85772861000027201, - -0.87008699110871135, - -0.88192126434835494, - -0.89322430119551521, - -0.90398929312344312, - -0.91420975570353047, - -0.92387953251128652, - -0.93299279883473896, - -0.94154406518302081, - -0.94952818059303667, - -0.95694033573220882, - -0.96377606579543984, - -0.97003125319454397, - -0.97570213003852846, - -0.98078528040323032, - -0.98527764238894111, - -0.9891765099647809, - -0.99247953459871008, - -0.99518472667219693, - -0.99729045667869021, - -0.99879545620517241, - -0.99969881869620425, - -1.0, - -0.99969881869620425, - -0.99879545620517241, - -0.99729045667869021, - -0.99518472667219693, - -0.99247953459871008, - -0.9891765099647809, - -0.98527764238894122, - -0.98078528040323043, - -0.97570213003852857, - -0.97003125319454397, - -0.96377606579543995, - -0.95694033573220894, - -0.94952818059303679, - -0.94154406518302092, - -0.93299279883473907, - -0.92387953251128663, - -0.91420975570353058, - -0.90398929312344334, - -0.89322430119551532, - -0.88192126434835505, - -0.87008699110871146, - -0.85772861000027223, - -0.84485356524970723, - -0.83146961230254546, - -0.81758481315158404, - -0.80320753148064528, - -0.78834642762660612, - -0.77301045336273688, - -0.75720884650648457, - -0.74095112535495911, - -0.724247082951467, - -0.70710678118654768, - -0.68954054473706716, - -0.67155895484701866, - -0.65317284295377709, - -0.63439328416364593, - -0.61523159058062737, - -0.59569930449243325, - -0.57580819141784523, - -0.55557023301960218, - -0.53499761988709726, - -0.51410274419322188, - -0.49289819222978426, - -0.47139673682599792, - -0.44961132965460698, - -0.42755509343028253, - -0.40524131400499042, - -0.38268343236509039, - -0.359895036534988, - -0.33688985339222, - -0.31368174039889152, - -0.2902846772544625, - -0.26671275747489859, - -0.24298017990326418, - -0.21910124015687016, - -0.19509032201612872, - -0.17096188876030177, - -0.14673047445536239, - -0.12241067519921603, - -0.098017140329560506, - -0.073564563599667412, - -0.049067674327418091, - -0.024541228522912448 + qreal(0.0), + qreal(0.024541228522912288), + qreal(0.049067674327418015), + qreal(0.073564563599667426), + qreal(0.098017140329560604), + qreal(0.1224106751992162), + qreal(0.14673047445536175), + qreal(0.17096188876030122), + qreal(0.19509032201612825), + qreal(0.2191012401568698), + qreal(0.24298017990326387), + qreal(0.26671275747489837), + qreal(0.29028467725446233), + qreal(0.31368174039889152), + qreal(0.33688985339222005), + qreal(0.35989503653498811), + qreal(0.38268343236508978), + qreal(0.40524131400498986), + qreal(0.42755509343028208), + qreal(0.44961132965460654), + qreal(0.47139673682599764), + qreal(0.49289819222978404), + qreal(0.51410274419322166), + qreal(0.53499761988709715), + qreal(0.55557023301960218), + qreal(0.57580819141784534), + qreal(0.59569930449243336), + qreal(0.61523159058062682), + qreal(0.63439328416364549), + qreal(0.65317284295377676), + qreal(0.67155895484701833), + qreal(0.68954054473706683), + qreal(0.70710678118654746), + qreal(0.72424708295146689), + qreal(0.74095112535495911), + qreal(0.75720884650648446), + qreal(0.77301045336273699), + qreal(0.78834642762660623), + qreal(0.80320753148064483), + qreal(0.81758481315158371), + qreal(0.83146961230254524), + qreal(0.84485356524970701), + qreal(0.85772861000027212), + qreal(0.87008699110871135), + qreal(0.88192126434835494), + qreal(0.89322430119551532), + qreal(0.90398929312344334), + qreal(0.91420975570353069), + qreal(0.92387953251128674), + qreal(0.93299279883473885), + qreal(0.94154406518302081), + qreal(0.94952818059303667), + qreal(0.95694033573220894), + qreal(0.96377606579543984), + qreal(0.97003125319454397), + qreal(0.97570213003852857), + qreal(0.98078528040323043), + qreal(0.98527764238894122), + qreal(0.98917650996478101), + qreal(0.99247953459870997), + qreal(0.99518472667219682), + qreal(0.99729045667869021), + qreal(0.99879545620517241), + qreal(0.99969881869620425), + qreal(1.0), + qreal(0.99969881869620425), + qreal(0.99879545620517241), + qreal(0.99729045667869021), + qreal(0.99518472667219693), + qreal(0.99247953459870997), + qreal(0.98917650996478101), + qreal(0.98527764238894122), + qreal(0.98078528040323043), + qreal(0.97570213003852857), + qreal(0.97003125319454397), + qreal(0.96377606579543984), + qreal(0.95694033573220894), + qreal(0.94952818059303667), + qreal(0.94154406518302081), + qreal(0.93299279883473885), + qreal(0.92387953251128674), + qreal(0.91420975570353069), + qreal(0.90398929312344345), + qreal(0.89322430119551521), + qreal(0.88192126434835505), + qreal(0.87008699110871146), + qreal(0.85772861000027212), + qreal(0.84485356524970723), + qreal(0.83146961230254546), + qreal(0.81758481315158371), + qreal(0.80320753148064494), + qreal(0.78834642762660634), + qreal(0.7730104533627371), + qreal(0.75720884650648468), + qreal(0.74095112535495899), + qreal(0.72424708295146689), + qreal(0.70710678118654757), + qreal(0.68954054473706705), + qreal(0.67155895484701855), + qreal(0.65317284295377664), + qreal(0.63439328416364549), + qreal(0.61523159058062693), + qreal(0.59569930449243347), + qreal(0.57580819141784545), + qreal(0.55557023301960218), + qreal(0.53499761988709715), + qreal(0.51410274419322177), + qreal(0.49289819222978415), + qreal(0.47139673682599786), + qreal(0.44961132965460687), + qreal(0.42755509343028203), + qreal(0.40524131400498992), + qreal(0.38268343236508989), + qreal(0.35989503653498833), + qreal(0.33688985339222033), + qreal(0.31368174039889141), + qreal(0.29028467725446239), + qreal(0.26671275747489848), + qreal(0.24298017990326407), + qreal(0.21910124015687005), + qreal(0.19509032201612861), + qreal(0.17096188876030122), + qreal(0.1467304744553618), + qreal(0.12241067519921635), + qreal(0.098017140329560826), + qreal(0.073564563599667732), + qreal(0.049067674327417966), + qreal(0.024541228522912326), + qreal(0.0), + qreal(-0.02454122852291208), + qreal(-0.049067674327417724), + qreal(-0.073564563599667496), + qreal(-0.09801714032956059), + qreal(-0.1224106751992161), + qreal(-0.14673047445536158), + qreal(-0.17096188876030097), + qreal(-0.19509032201612836), + qreal(-0.2191012401568698), + qreal(-0.24298017990326382), + qreal(-0.26671275747489825), + qreal(-0.29028467725446211), + qreal(-0.31368174039889118), + qreal(-0.33688985339222011), + qreal(-0.35989503653498811), + qreal(-0.38268343236508967), + qreal(-0.40524131400498969), + qreal(-0.42755509343028181), + qreal(-0.44961132965460665), + qreal(-0.47139673682599764), + qreal(-0.49289819222978393), + qreal(-0.51410274419322155), + qreal(-0.53499761988709693), + qreal(-0.55557023301960196), + qreal(-0.57580819141784534), + qreal(-0.59569930449243325), + qreal(-0.61523159058062671), + qreal(-0.63439328416364527), + qreal(-0.65317284295377653), + qreal(-0.67155895484701844), + qreal(-0.68954054473706683), + qreal(-0.70710678118654746), + qreal(-0.72424708295146678), + qreal(-0.74095112535495888), + qreal(-0.75720884650648423), + qreal(-0.77301045336273666), + qreal(-0.78834642762660589), + qreal(-0.80320753148064505), + qreal(-0.81758481315158382), + qreal(-0.83146961230254524), + qreal(-0.84485356524970701), + qreal(-0.85772861000027201), + qreal(-0.87008699110871135), + qreal(-0.88192126434835494), + qreal(-0.89322430119551521), + qreal(-0.90398929312344312), + qreal(-0.91420975570353047), + qreal(-0.92387953251128652), + qreal(-0.93299279883473896), + qreal(-0.94154406518302081), + qreal(-0.94952818059303667), + qreal(-0.95694033573220882), + qreal(-0.96377606579543984), + qreal(-0.97003125319454397), + qreal(-0.97570213003852846), + qreal(-0.98078528040323032), + qreal(-0.98527764238894111), + qreal(-0.9891765099647809), + qreal(-0.99247953459871008), + qreal(-0.99518472667219693), + qreal(-0.99729045667869021), + qreal(-0.99879545620517241), + qreal(-0.99969881869620425), + qreal(-1.0), + qreal(-0.99969881869620425), + qreal(-0.99879545620517241), + qreal(-0.99729045667869021), + qreal(-0.99518472667219693), + qreal(-0.99247953459871008), + qreal(-0.9891765099647809), + qreal(-0.98527764238894122), + qreal(-0.98078528040323043), + qreal(-0.97570213003852857), + qreal(-0.97003125319454397), + qreal(-0.96377606579543995), + qreal(-0.95694033573220894), + qreal(-0.94952818059303679), + qreal(-0.94154406518302092), + qreal(-0.93299279883473907), + qreal(-0.92387953251128663), + qreal(-0.91420975570353058), + qreal(-0.90398929312344334), + qreal(-0.89322430119551532), + qreal(-0.88192126434835505), + qreal(-0.87008699110871146), + qreal(-0.85772861000027223), + qreal(-0.84485356524970723), + qreal(-0.83146961230254546), + qreal(-0.81758481315158404), + qreal(-0.80320753148064528), + qreal(-0.78834642762660612), + qreal(-0.77301045336273688), + qreal(-0.75720884650648457), + qreal(-0.74095112535495911), + qreal(-0.724247082951467), + qreal(-0.70710678118654768), + qreal(-0.68954054473706716), + qreal(-0.67155895484701866), + qreal(-0.65317284295377709), + qreal(-0.63439328416364593), + qreal(-0.61523159058062737), + qreal(-0.59569930449243325), + qreal(-0.57580819141784523), + qreal(-0.55557023301960218), + qreal(-0.53499761988709726), + qreal(-0.51410274419322188), + qreal(-0.49289819222978426), + qreal(-0.47139673682599792), + qreal(-0.44961132965460698), + qreal(-0.42755509343028253), + qreal(-0.40524131400499042), + qreal(-0.38268343236509039), + qreal(-0.359895036534988), + qreal(-0.33688985339222), + qreal(-0.31368174039889152), + qreal(-0.2902846772544625), + qreal(-0.26671275747489859), + qreal(-0.24298017990326418), + qreal(-0.21910124015687016), + qreal(-0.19509032201612872), + qreal(-0.17096188876030177), + qreal(-0.14673047445536239), + qreal(-0.12241067519921603), + qreal(-0.098017140329560506), + qreal(-0.073564563599667412), + qreal(-0.049067674327418091), + qreal(-0.024541228522912448) }; QT_END_NAMESPACE -- cgit v0.12 From 7abb2cfdea14fa71aabcd79635aa8f407ed96186 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 12 Jan 2010 08:36:29 +1000 Subject: Update changes file with Rhys Weatherley's work. --- dist/changes-4.6.1 | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 145e09e..65b865a 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -73,6 +73,39 @@ QtOpenGL * bindTexture(QString) now supports DDS, ETC1, PVRTC2, and PVRTC4 compressed textures if the appropriate extensions are present in the GL implementation. + * bindTexture(QImage): Reduce double-copying of textures when flipping. + * [QTBUG-6454] Better EGL extension checking to avoid prefix problems + with EGL_foo matching EGL_foo_bar. + * [QTBUG-6217] Work around problems with glColor4ub() on Intel Q45/Q43 + Express by consistently using glColor4f() everywhere. + * bindTexture(QImage): Fix GL_BGRA formats under OpenGL/ES by using + the same value for both internal and external texture formats. + * [QTBUG-5041] Disable depth testing while in renderText(). + - QGLPaintDevice + * [QTBUG-6204] Rebind window surface fbo after native GL rendering. + - QGLEngineSelector + * [QTBUG-5638] Detect GL2 based on fragment shaders, not programs. + Fragment programs are a GL1 feature. + - QGLFramebufferObject + * [QTBUG-6712] Update docs to better explain how QPainter changes + the GL state when used on an FBO. + - QGLPixmapData + * [QTBUG-6902] Align GL_RGB data on a 4-byte line boundary. + - QTriangulatingStroker + * [QTBUG-6045] Crash in dashed line handling in the GL stroker. + - QGLGlyphCache + * [QTBUG-6936] Fix memory leak of QGLGlyphCoord objects. + +QtOpenVG +-------- + + - [QT-2555] Automatically destroy VG pixmaps when the last window surface + goes away to reduce memory consumption of backgrounded applications. + - [QTBUG-6639] Recover from out-of-memory when creating VGImage's. + - [QT-2554] Add a VGImage allocation pool to support reclaiming older + images when the GPU runs out of memory. + - [QTBUG-7051] Reset the OpenVG scissor after a native painting call-out. + - [QTBUG-7015] Avoid deep copies of QImage in QImage::bits() calls. QtScript -------- @@ -95,8 +128,16 @@ QtXml Qt Plugins ---------- - - foo - * bar + - JPEG plugin + * Remove obsolete parameter string handling. + * [QT-2023] Re-implement ScaledSize, ClipRect, ScaledClipRect with + libjpeg features for greater performance. + - PBM plugin + * [QTBUG-6937] Use Mono instead of MonoLSB when writing pbm files. + - TIFF plugin + * [QTBUG-6870] BitsPerSample should default to 1 in TIFF files. + - PNG plugin + * [QTBUG-7161] Avoid a deep copy of QImage::bits() in the png writer. Third party components ---------------------- -- cgit v0.12 From 54044ee128f0e2e2ecdbffd03de7241702fd4ba7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 7 Jan 2010 10:14:06 +0100 Subject: Fix point drawing on raster engine for flat and square caps Task: http://bugreports.qt.nokia.com/browse/QTBUG-6721 Reviewed-by: Samuel --- src/gui/painting/qpaintengineex.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 9a0e319..67c4998 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -860,7 +860,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) for (int i=0; i Date: Tue, 12 Jan 2010 10:35:26 +0100 Subject: Fix completion in QFileDialog. Completing under the root directory was "eating" the first letter. On windows under C:\ the completion was not working at all. Task-number: QTBUG-4933 Reviewed-by:janarve Reviewed-by:gabi --- src/gui/dialogs/qfiledialog.cpp | 8 ++++++ tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 42 +++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 3c388de..ab44fe7 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3245,6 +3245,10 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { +#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) + if (currentLocation == QDir::separator()) + return path.mid(currentLocation.length()); +#endif return path.mid(currentLocation.length() + 1); } return index.data(QFileSystemModel::FilePathRole).toString(); @@ -3300,6 +3304,10 @@ QStringList QFSCompleter::splitPath(const QString &path) const else dirModel = sourceModel; QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath()); +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + if (currentLocation.endsWith(QLatin1Char(':'))) + currentLocation.append(sep); +#endif if (currentLocation.contains(sep) && path != currentLocation) { QStringList currentLocationList = splitPath(currentLocation); while (!currentLocationList.isEmpty() diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index c3f88c4..f1fac17 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -116,6 +116,7 @@ private slots: #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void task226366_lowerCaseHardDriveWindows(); #endif + void completionOnLevelAfterRoot(); void task233037_selectingDirectory(); void task235069_hideOnEscape(); void task236402_dontWatchDeletedDir(); @@ -202,7 +203,7 @@ void tst_QFiledialog::heapCorruption() qDeleteAll(dialogs); } -struct FriendlyQFileDialog : public QFileDialog +struct FriendlyQFileDialog : public QNonNativeFileDialog { friend class tst_QFileDialog; Q_DECLARE_PRIVATE(QFileDialog) @@ -552,6 +553,45 @@ void tst_QFiledialog::task226366_lowerCaseHardDriveWindows() } #endif +void tst_QFiledialog::completionOnLevelAfterRoot() +{ + QNonNativeFileDialog fd; +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + fd.setDirectory("C:"); + QDir current = fd.directory(); + current.mkdir("completionOnLevelAfterRootTest"); +#else + fd.setFilter(QDir::Hidden | QDir::AllDirs | QDir::Files | QDir::System); + fd.setDirectory("/"); + QDir etc("/etc"); + if (!etc.exists()) + QSKIP("This test requires to have an etc directory under /", SkipAll); +#endif + fd.show(); + QLineEdit *edit = qFindChild(&fd, "fileNameEdit"); + QTest::qWait(2000); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + //I love testlib :D + QTest::keyClick(edit, Qt::Key_C); + QTest::keyClick(edit, Qt::Key_O); + QTest::keyClick(edit, Qt::Key_M); + QTest::keyClick(edit, Qt::Key_P); + QTest::keyClick(edit, Qt::Key_L); +#else + QTest::keyClick(edit, Qt::Key_E); + QTest::keyClick(edit, Qt::Key_T); +#endif + QTest::qWait(200); + QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); + QTest::qWait(200); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + QCOMPARE(edit->text(), QString("completionOnLevelAfterRootTest")); + current.rmdir("completionOnLevelAfterRootTest"); +#else + QCOMPARE(edit->text(), QString("etc")); +#endif +} + void tst_QFiledialog::task233037_selectingDirectory() { QDir current = QDir::currentPath(); -- cgit v0.12 From 81e1d9a9e9ff6649727bd26ea0c3be971813866d Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 12 Jan 2010 12:32:09 +0100 Subject: Update change log with Yoann Lopes work. --- dist/changes-4.6.1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 65b865a..d35a4c1 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -53,6 +53,25 @@ QtGui GL implementation. - QGraphicsObject * 'id' property was removed. Use the 'objectName' property instead. + - QPrinter + * [QTBUG-3412] QGraphicsProxyWidgets are now rendered correctly when + printing a QGraphicsScene to PDF format. + - QPainter + * [QTBUG-5939] Fixed incorrect redirection matrix that was causing + wrong transformation for QGraphicsProxyWidgets. + - QGraphicsView + * [QTBUG-6935] When using CacheBackground, the background is now + correctly repainted after the QGraphicsView is shown after being + hidden. + * [QTBUG-6835] Mouse tracking is now automatically enabled when using + AnchorUnderMouse for view transformation. + - QGraphicsItem + * [QTBUG-5917] Fixed memory leaks when removing a QGraphicsEffect from + a QGraphicsItem or QWidget with setGraphicsEffect(0). + * [QTBUG-5859] Fixes incorrect rounding of the exposed rectangle of the + QGraphicsItem causing painting issues when scaling the QGraphicsView. + * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping + the item with a QGraphicsItemGroup. QtDBus ------ -- cgit v0.12 From 48b4a790b94acab1000c0e3bb3c6780bf6b9ba0b Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 12 Jan 2010 13:29:11 +0100 Subject: Fixed bug where QGLPixmapData::toImage() returned too dark image. QGLPixmapData::toImage() called qt_gl_read_texture() which didn't take into account that the texture was in a premultiplied format. Task-number: QTBUG-7190 Reviewed-by: Trond --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4a79427..602c14d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1555,7 +1555,7 @@ QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha) { - QImage img(size, alpha_format ? QImage::Format_ARGB32 : QImage::Format_RGB32); + QImage img(size, alpha_format ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); int w = size.width(); int h = size.height(); #if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) -- cgit v0.12 From ea24edbf74d29cfa128b651e41fde14a0d2a79f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Jan 2010 14:55:01 +0100 Subject: 4.6.1 changes --- dist/changes-4.6.1 | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index d35a4c1..b3c076e 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -51,16 +51,20 @@ QtGui in the DDS, ETC1, PVRTC2, and PVRTC4 formats if the OpenGL graphics system is active and the appropriate extensions are present in the GL implementation. + * [QTBUG-6840] Fixed load() to not modify referenced copies. + * [QTBUG-5840] Fixed a crash in fromImage() when passing in a null image. + - QRasterPixmapData + * [QTBUG-6985] Fixed metric() to return the correct height in mm. - QGraphicsObject * 'id' property was removed. Use the 'objectName' property instead. - QPrinter * [QTBUG-3412] QGraphicsProxyWidgets are now rendered correctly when printing a QGraphicsScene to PDF format. - QPainter - * [QTBUG-5939] Fixed incorrect redirection matrix that was causing + * [QTBUG-5939] Fixed incorrect redirection matrix that was causing wrong transformation for QGraphicsProxyWidgets. - QGraphicsView - * [QTBUG-6935] When using CacheBackground, the background is now + * [QTBUG-6935] When using CacheBackground, the background is now correctly repainted after the QGraphicsView is shown after being hidden. * [QTBUG-6835] Mouse tracking is now automatically enabled when using @@ -73,6 +77,9 @@ QtGui * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping the item with a QGraphicsItemGroup. + - QTextDocument + * [QTBUG-6051] Fixed an endless loop when printing a QTextDocument. + QtDBus ------ @@ -114,6 +121,8 @@ QtOpenGL * [QTBUG-6045] Crash in dashed line handling in the GL stroker. - QGLGlyphCache * [QTBUG-6936] Fix memory leak of QGLGlyphCoord objects. + - QGLWidget + * [QTBUG-5002, QTBUG-6931] Fixed QGLWidget::renderText(). QtOpenVG -------- @@ -173,12 +182,15 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- - - + - QGL + * [QTBUG-5732] Fixed querying of GLX extensions under X11. + - QPrintDialog + * [QTBUG-5547] Fixed handling of the "..." button. Qt for Windows -------------- @@ -188,7 +200,9 @@ Qt for Windows Qt for Mac OS X --------------- - - + - QPixmap + * [QTBUG-5070] Fixed a crash on Mac that could occur when loading + pixmaps of different sizes into the same QPixmap object. Qt for Embedded Linux --------------------- -- cgit v0.12 From c186438710bb0f5a09ba6168a5b35d8b485da41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 12 Jan 2010 14:52:38 +0100 Subject: Update changelog with my 4.6.1 changes. --- dist/changes-4.6.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index b3c076e..e2ec649 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -46,6 +46,8 @@ QtCore QtGui ----- + - QPixmapCache + * Fixed a small leak when using the new QPixmapCAche::Key based API. - QPixmap * load() and loadFromData() can now support compressed GL textures in the DDS, ETC1, PVRTC2, and PVRTC4 formats if the OpenGL graphics @@ -63,6 +65,11 @@ QtGui - QPainter * [QTBUG-5939] Fixed incorrect redirection matrix that was causing wrong transformation for QGraphicsProxyWidgets. + * [QTBUG-6684] Added optimizations of 32-bit blend functions + for ARM platforms with NEON support. + - QGraphicsEffect + * [QTBUG-5918] Fixed redraw bugs when using graphics effects on + items while animating them by transformations. - QGraphicsView * [QTBUG-6935] When using CacheBackground, the background is now correctly repainted after the QGraphicsView is shown after being @@ -76,6 +83,9 @@ QtGui QGraphicsItem causing painting issues when scaling the QGraphicsView. * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping the item with a QGraphicsItemGroup. + - QTextDocument + * [QTBUG-5397] Fixed printing of QTextDocuments not including custom + text objects. - QTextDocument * [QTBUG-6051] Fixed an endless loop when printing a QTextDocument. -- cgit v0.12 From d4e81805ff47a266890f9638cf29647889d5c730 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 12 Jan 2010 15:13:46 +0100 Subject: Avoid coordinate limitations in the raster engine. Lines that are longer than 2^15 will overflow in qgrayraster.c so we need to clip them. Also, we need to clip the bounding rectangle to avoid an endless clip-loop Task: http://bugreports.qt.nokia.com/browse/QTBUG-6198 Reviewed-by: Samuel --- src/gui/painting/qoutlinemapper.cpp | 9 ++++++--- src/gui/painting/qpaintengine_raster.cpp | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index ee33024..078d002 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -225,9 +225,10 @@ void QOutlineMapper::endOutline() controlPointRect = boundingRect(elements, element_count); #ifdef QT_DEBUG_CONVERT - printf(" - control point rect (%.2f, %.2f) %.2f x %.2f\n", + printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n", controlPointRect.x(), controlPointRect.y(), - controlPointRect.width(), controlPointRect.height()); + controlPointRect.width(), controlPointRect.height(), + m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height()); #endif @@ -235,7 +236,9 @@ void QOutlineMapper::endOutline() const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT || controlPointRect.right() > QT_RASTER_COORD_LIMIT || controlPointRect.top() < -QT_RASTER_COORD_LIMIT - || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT); + || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT + || controlPointRect.width() > QT_RASTER_COORD_LIMIT + || controlPointRect.height() > QT_RASTER_COORD_LIMIT); if (do_clip) { clipElements(elements, elementTypes(), element_count); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index aa3b89e..eeb90e5 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -475,8 +475,10 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) QRasterPaintEngineState *s = state(); ensureOutlineMapper(); d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10); + + // This is the upp QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT, - 2*QT_RASTER_COORD_LIMIT, 2*QT_RASTER_COORD_LIMIT); + QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1); d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect); -- cgit v0.12 From 1595d8594782321de9d92659e2a0cd03148c7ff5 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 12 Jan 2010 15:21:32 +0100 Subject: Update changes file for 4.6.1 --- dist/changes-4.6.1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index e2ec649..e9e5922 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -133,6 +133,15 @@ QtOpenGL * [QTBUG-6936] Fix memory leak of QGLGlyphCoord objects. - QGLWidget * [QTBUG-5002, QTBUG-6931] Fixed QGLWidget::renderText(). + * Fixed WA_TranslucentBackground for QGLWidgets on X11/EGL + * Fix EGL surface leaks when re-parenting on X11/EGL + - QGL2PaintEngineEx + * Performance: Don't mark brush as dirty if it hasn't changed + * Performance: Use 3x3 PMV matrices rather than 4x4 + * Performance: Move the 0.5 offset we add for aliased rendering to updateMatrix() + * Performance: Remove superfluous enable/disable vertex arrtib arrays + * Performance: Track the glVertexAttribPointer and only update it if it's changed + * [QTBUG-7094] Introduce new "snapToPixelGrid" flag for drawText QtOpenVG -------- @@ -197,10 +206,10 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - - QGL - * [QTBUG-5732] Fixed querying of GLX extensions under X11. - - QPrintDialog - * [QTBUG-5547] Fixed handling of the "..." button. + - [QTBUG-5732] Fixed querying of GLX extensions under X11. + - [QTBUG-5547] Fixed handling of the "..." button. + - Added new mkspec for Maemo targets (linux-g++-maemo) + - Added new mkspec for Scratchbox host compiler (unsupported/linux-host-g++) Qt for Windows -------------- -- cgit v0.12 From 2a4a76767849b1325927db17383679a46c16d38d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 12 Jan 2010 15:24:18 +0100 Subject: Put LinesHint into QVectorPath hints to enable further optimizations Reviewed-by: Samuel --- src/gui/painting/qpainterpath_p.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 54b9392..4cd8a1a 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -97,6 +97,7 @@ public: flags(0) { int ptsPos = 0; + bool isLines = true; for (int i=0; i elements; QVarLengthArray points; -- cgit v0.12 From bc62c67c08a9c03d237f63c87f743a08a3dc9d14 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 12 Jan 2010 15:09:56 +0100 Subject: Added my changes to the 4.6.1 change log. --- dist/changes-4.6.1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index e9e5922..15f1fad 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -55,6 +55,8 @@ QtGui GL implementation. * [QTBUG-6840] Fixed load() to not modify referenced copies. * [QTBUG-5840] Fixed a crash in fromImage() when passing in a null image. + * [QTBUG-6116] Fixed memory leak where a global object was not destroyed + at program exit. - QRasterPixmapData * [QTBUG-6985] Fixed metric() to return the correct height in mm. - QGraphicsObject @@ -166,6 +168,15 @@ QtSql - foo * bar +QtSvg +----- + + - QSvgRenderer + * [QTBUG-6867] Fixed regression in the parsing of paths with relative + offsets. + * [QTBUG-6899] Fixed crash when parsing invalid coordinate list. + + QtXml ----- -- cgit v0.12 From 4c85bf275c9d472a17cc9210aebf6eb880be740a Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 12 Jan 2010 15:30:36 +0100 Subject: My changelog for 4.6.1. --- dist/changes-4.6.1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 15f1fad..513cace 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -78,6 +78,9 @@ QtGui hidden. * [QTBUG-6835] Mouse tracking is now automatically enabled when using AnchorUnderMouse for view transformation. + * [QTBUG-6958] Fix speed regression in _q_polishItems() + * [QTBUG-6544] Fix a crash on the focus chain when removing items from the scene. + * Fix a crash in KDE/Plasma with QGraphicsView with topLevels. - QGraphicsItem * [QTBUG-5917] Fixed memory leaks when removing a QGraphicsEffect from a QGraphicsItem or QWidget with setGraphicsEffect(0). @@ -85,6 +88,8 @@ QtGui QGraphicsItem causing painting issues when scaling the QGraphicsView. * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping the item with a QGraphicsItemGroup. + - QGraphicsWidget + * [QTBUG-6272] Only call updateFont if the font have changed. - QTextDocument * [QTBUG-5397] Fixed printing of QTextDocuments not including custom text objects. -- cgit v0.12 From 12e320a7a3a5ca93dd5287315571db1d1728e322 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 12 Jan 2010 15:09:42 +0100 Subject: Significant digits were lost in QDoubleSpinBox range when changing precision When setting the range, the actual value precision was lost because the min and max were saved after being formatted to the current precison (decimals property), thus losing information. We now keep the user original values, and use these whenever the decimals property is changed. Auto-test included. Reviewed-by: leo Task-number: QTBUG-6496 --- src/gui/widgets/qspinbox.cpp | 16 +++++++++++++--- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 13 +++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index 50b225c..f382f96 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -99,6 +99,10 @@ public: Q_Q(QDoubleSpinBox); q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); } + + // When fiddling with the decimals property, we may lose precision in these properties. + double actualMin; + double actualMax; }; @@ -762,6 +766,7 @@ double QDoubleSpinBox::minimum() const void QDoubleSpinBox::setMinimum(double minimum) { Q_D(QDoubleSpinBox); + d->actualMin = minimum; const QVariant m(d->round(minimum)); d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m)); } @@ -792,6 +797,7 @@ double QDoubleSpinBox::maximum() const void QDoubleSpinBox::setMaximum(double maximum) { Q_D(QDoubleSpinBox); + d->actualMax = maximum; const QVariant m(d->round(maximum)); d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m); } @@ -813,6 +819,8 @@ void QDoubleSpinBox::setMaximum(double maximum) void QDoubleSpinBox::setRange(double minimum, double maximum) { Q_D(QDoubleSpinBox); + d->actualMin = minimum; + d->actualMax = maximum; d->setRange(QVariant(d->round(minimum)), QVariant(d->round(maximum))); } @@ -843,7 +851,7 @@ void QDoubleSpinBox::setDecimals(int decimals) Q_D(QDoubleSpinBox); d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG); - setRange(minimum(), maximum()); // make sure values are rounded + setRange(d->actualMin, d->actualMax); // make sure values are rounded setValue(value()); } @@ -1051,8 +1059,10 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() { - minimum = QVariant(0.0); - maximum = QVariant(99.99); + actualMin = 0.0; + actualMax = 99.99; + minimum = QVariant(actualMin); + maximum = QVariant(actualMax); value = minimum; singleStep = QVariant(1.0); decimals = 2; diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index a3f0915..35cffd6 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -149,6 +149,7 @@ private slots: void taskQTBUG_5008_textFromValueAndValidate(); void taskQTBUG_6670_selectAllWithPrefix(); + void taskQTBUG_6496_fiddlingWithPrecision(); public slots: void valueChangedHelper(const QString &); @@ -1096,5 +1097,17 @@ void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix() QCOMPARE(spin.value(), 12.); } +void tst_QDoubleSpinBox::taskQTBUG_6496_fiddlingWithPrecision() +{ + QDoubleSpinBox dsb; + dsb.setRange(0, 0.991); + dsb.setDecimals(1); + QCOMPARE(dsb.maximum(), 1.0); + dsb.setDecimals(2); + QCOMPARE(dsb.maximum(), 0.99); + dsb.setDecimals(3); + QCOMPARE(dsb.maximum(), 0.991); +} + QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" -- cgit v0.12 From a902d9e486a0e2460f4888ce610bac269abc5563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 12 Jan 2010 15:53:27 +0100 Subject: My changes --- dist/changes-4.6.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 513cace..ff1f7fe 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -229,7 +229,7 @@ Qt for Linux/X11 Qt for Windows -------------- - + - [QTBUG-5145] Compile fixes for win32-icc. - Qt for Mac OS X -- cgit v0.12 From f8621acaffff3a466e92d121c44f142116bb7373 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 13 Jan 2010 14:21:45 +1000 Subject: SQL 4.6.1 changelog --- dist/changes-4.6.1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 7813cbe..0971f40 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -208,8 +208,11 @@ QtScript QtSql ----- - - foo - * bar + - [QTBUG-5373] Fixed QSqlRelationalTableModel doesn't correctly work with relation in other database schema. + - [QTBUG-5298] (OCI) Fixed QSqlDatabase.tables() does not work with system tables. + - [QTBUG-6421] Fixed setForwardOnly() for both OCI and SQLite + - [QTBUG-6618] (ODBC) Fixed segfault when error string is larger than 256 chars. + - [QTBUG-4461] (OCI) Fixed problem with clobs being handled as binary QtSvg ----- -- cgit v0.12 From 58be75dec90afbda3c9640266708a7d5b30a1f50 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 13 Jan 2010 15:04:55 +1000 Subject: Update autotest database connection settings --- tests/auto/qsqldatabase/tst_databases.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index 4176122..4e99f18 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -221,7 +221,8 @@ public: // addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3309, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 5.0.18 Linux // addDb( "QMYSQL3", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // MySQL 5.1.36 Windows // addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql4-nokia.trolltech.com.au" ); // MySQL 4.1.22-2.el4 linux -// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux +// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql50.apac.nokia.com" ); // MySQL 5.0.45-7.el5 linux +// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql51.apac.nokia.com" ); // MySQL 5.1.36-6.7.2.i586 linux // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no" ); // V7.2 NOT SUPPORTED! // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5434 ); // V7.2 NOT SUPPORTED! Multi-byte @@ -230,7 +231,8 @@ public: // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5437 ); // V8.0.3 // addDb( "QPSQL7", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // V8.2.1, UTF-8 // addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres74-nokia.trolltech.com.au" ); // Version 7.4.19-1.el4_6.1 -// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres81-nokia.trolltech.com.au" ); // Version 8.1.11-1.el5_1.1 +// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql81.apac.nokia.com" ); // Version 8.1.11-1.el5_1.1 +// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql84.apac.nokia.com" ); // Version 8.4.1-2.1.i586 // addDb( "QDB2", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // DB2 v9.1 on silence @@ -248,7 +250,7 @@ public: // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.nokia.troll.no\\ICEBLINK", "troll", "trond", "" ); // addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" ); -// addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql4-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" ); @@ -259,6 +261,7 @@ public: // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\dbs\\access\\testdb.mdb", "", "", "" ); +// addDb( "QODBC", "DRIVER={Postgresql};SERVER=postgres81-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); } void open() @@ -335,7 +338,10 @@ public: foreach(const QString &table2, dbtables.filter(table, Qt::CaseInsensitive)) { if(table2.compare(table.section('.', -1, -1), Qt::CaseInsensitive) == 0) { table=db.driver()->escapeIdentifier(table2, QSqlDriver::TableName); - wasDropped = q.exec( "drop table " + table); + if(db.driverName().startsWith( "QPSQL" )) + wasDropped = q.exec( "drop table " + table + " cascade"); + else + wasDropped = q.exec( "drop table " + table); dbtables.removeAll(table2); } } -- cgit v0.12 From 826d995ff48a01fffc22eafe7b3127e44ed60496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 13 Jan 2010 10:31:38 +0100 Subject: Fixed tst_qgl multipleFBOInterleavedRendering. We need to clobber the vertex attribute pointers _before_ we call setState() to regenerate the clip, or we'll use invalid vertex pointers when writing the clip. Reviewed-by: Paul --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2a33255..caa679b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1628,9 +1628,9 @@ void QGL2PaintEngineEx::ensureActive() d->needsSync = false; d->shaderManager->setDirty(); d->ctx->d_func()->syncGlState(); - setState(state()); for (int i = 0; i < 3; ++i) d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered + setState(state()); } } -- cgit v0.12