From 7127f5ba2cc5729cfa12f5705e2dcfdcb99e1b91 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 15 Jan 2010 13:04:04 +0100 Subject: Text drawing is not fast currently --- src/gui/painting/qpainter.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fd67f96..a917e0d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1374,9 +1374,6 @@ void QPainterPrivate::updateState(QPainterState *newState) opacity with non-smooth transformation mode (\c QPainter::SmoothPixmapTransform not enabled as a render hint). - \o Text drawing with regular font sizes with simple - transformations with solid colors using no or 8-bit antialiasing. - \o Rectangle fills with solid color, two-color linear gradients and simple transforms. -- cgit v0.12 From 092cfe31463146c17f99543e36cdd7da85961afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 20 Jan 2010 09:34:47 +0100 Subject: Fixed a crash under X11 when drawing QPixmaps to QGLPixelBuffers. Task-number: QTBUG-7476 Reviewed-by: Kim --- src/opengl/qgl_x11.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index f4cc7c7..61a16be 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1651,8 +1651,12 @@ static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice) { return false; // Can't use TFP without NPOT } + const QX11Info *xinfo = qt_x11Info(paintDevice); - QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); + Display *display = xinfo ? xinfo->display() : X11->display; + int screen = xinfo ? xinfo->screen() : X11->defaultScreen; + + QGLExtensionMatcher extensions(glXQueryExtensionsString(display, screen)); if (extensions.match("GLX_EXT_texture_from_pixmap")) { glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT"); glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT"); -- cgit v0.12 From 8721d060a67a01ac891cab9d3d17aacf7373bcf0 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 20 Jan 2010 09:29:08 +0100 Subject: Fixed QBitmap::load to load into bitmap format again. Task: http://bugreports.qt.nokia.com/browse/QTBUG-7468 Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 21 ++++++++++++++------- tests/auto/qpixmap/tst_qpixmap.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 7b522f5..5a43de7 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -833,14 +833,21 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers if (QPixmapCache::find(key, *this)) return true; - QPixmapData *tmp = QPixmapData::create(0, 0, QPixmapData::PixmapType); - if (tmp->fromFile(fileName, format, flags)) { - data = tmp; - QPixmapCache::insert(key, *this); - return true; + bool ok; + + if (data) { + ok = data->fromFile(fileName, format, flags); + } else { + QScopedPointer tmp(QPixmapData::create(0, 0, QPixmapData::PixmapType)); + ok = tmp->fromFile(fileName, format, flags); + if (ok) + data = tmp.take(); } - delete tmp; - return false; + + if (ok) + QPixmapCache::insert(key, *this); + + return ok; } /*! diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 0164c9d..0d60ed0 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -171,6 +171,8 @@ private slots: void preserveDepth(); void splash_crash(); + + void loadAsBitmapOrPixmap(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1510,5 +1512,41 @@ void tst_QPixmap::preserveDepth() QCOMPARE(depth, source.depth()); } +void tst_QPixmap::loadAsBitmapOrPixmap() +{ + QImage tmp(10, 10, QImage::Format_RGB32); + tmp.save("tmp.png"); + + bool ok; + + // Check that we can load the pixmap as a pixmap and that it then turns into a pixmap + QPixmap pixmap("tmp.png"); + QVERIFY(!pixmap.isNull()); + QVERIFY(pixmap.depth() > 1); + QVERIFY(!pixmap.isQBitmap()); + + pixmap = QPixmap(); + ok = pixmap.load("tmp.png"); + QVERIFY(ok); + QVERIFY(!pixmap.isNull()); + QVERIFY(pixmap.depth() > 1); + QVERIFY(!pixmap.isQBitmap()); + + // The do the same check for bitmaps.. + QBitmap bitmap("tmp.png"); + QVERIFY(!bitmap.isNull()); + QVERIFY(bitmap.depth() == 1); + QVERIFY(bitmap.isQBitmap()); + + bitmap = QBitmap(); + ok = bitmap.load("tmp.png"); + QVERIFY(ok); + QVERIFY(!bitmap.isNull()); + QVERIFY(bitmap.depth() == 1); + QVERIFY(bitmap.isQBitmap()); +} + + + QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" -- cgit v0.12 From baf0f7a203281e3e1184cdfe327fb1dfa6df03ea Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 19 Jan 2010 19:09:14 +0100 Subject: Add command to qmake to do symbian-uid generation The UID3 as required by symbian has to be auto-generated when the user doesn't supply one. To allow this to be done in a mkspec we need a function to do the hashing. This method adds that. Reviewed-By: Marius Storm-Olsen --- qmake/project.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 2ad6112..c2e033e 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -79,7 +79,7 @@ enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION, E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND, E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE, - E_SIZE }; + E_SIZE, E_GENERATE_UID }; QMap qmake_expandFunctions() { static QMap *qmake_expand_functions = 0; @@ -111,6 +111,7 @@ QMap qmake_expandFunctions() qmake_expand_functions->insert("prompt", E_PROMPT); qmake_expand_functions->insert("replace", E_REPLACE); qmake_expand_functions->insert("size", E_SIZE); + qmake_expand_functions->insert("generate_uid", E_GENERATE_UID); } return *qmake_expand_functions; } @@ -1864,6 +1865,9 @@ QMakeProject::doProjectExpand(QString func, QStringList args, return doProjectExpand(func, args_list, place); } +// defined in symbian generator +extern QString generate_test_uid(const QString& target); + QStringList QMakeProject::doProjectExpand(QString func, QList args_list, QMap &place) @@ -2301,6 +2305,14 @@ QMakeProject::doProjectExpand(QString func, QList args_list, ret += QString::number(size); } break; } + case E_GENERATE_UID: + if (args.count() != 1) { + fprintf(stderr, "%s:%d: generate_uid(var) requires one argument.\n", + parser.file.toLatin1().constData(), parser.line_no); + } else { + ret += generate_test_uid(args.first()); + } + break; default: { fprintf(stderr, "%s:%d: Unknown replace function: %s\n", parser.file.toLatin1().constData(), parser.line_no, -- cgit v0.12 From 67fbf535e50a0e92ff237f9ad23bf065821ba2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 20 Jan 2010 14:12:56 +0100 Subject: Move the labels a bit down so that they align better vertically with the field. This was a "showstopper" for QFormLayout being used in Qt Creator. Task-number: QT-958 Reviewed-by: Michael Goddard --- src/gui/kernel/qformlayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp index b44cd50..aebc3a5 100644 --- a/src/gui/kernel/qformlayout.cpp +++ b/src/gui/kernel/qformlayout.cpp @@ -1925,11 +1925,11 @@ void QFormLayoutPrivate::arrangeWidgets(const QVector& layouts, Q /* If the field on the right-hand side is tall, we want the label to be top-aligned, but not too - much. So we introduce a 5 / 4 factor so that it - gets a few extra pixels at the top. + much. So we introduce a 7 / 4 factor so that it + gets some extra pixels at the top. */ height = qMin(height, - qMin(label->sizeHint.height() * 5 / 4, + qMin(label->sizeHint.height() * 7 / 4, label->maxSize.height())); } -- cgit v0.12 From 29423dcc76970253fd5bca43d0abba4876b85b85 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 20 Jan 2010 14:12:49 +0100 Subject: Fix crashes in QByteArray tst_QByteArray is was crashing on linux 64bit. The memory was freed twice, once by qRealloc, and one by QScopePointer::reset This patch will leak if qRealloc fails because of OutOfMemory. But we do not care as it is a corner case. Reviewed-by: Harald Fernengel Reviewed-by: Robert Griebl --- src/corelib/tools/qbytearray.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d2fbf5a..4049925 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -538,7 +538,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) forever { ulong alloc = len; - d.reset(q_check_ptr(static_cast(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc)))); + d.reset(q_check_ptr(static_cast(qRealloc(d.take(), sizeof(QByteArray::Data) + alloc)))); if (!d) { // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS qWarning("qUncompress: could not allocate enough memory to uncompress data"); @@ -551,7 +551,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) switch (res) { case Z_OK: if (len != alloc) { - d.reset(q_check_ptr(static_cast(qRealloc(d.data(), sizeof(QByteArray::Data) + len)))); + d.reset(q_check_ptr(static_cast(qRealloc(d.take(), sizeof(QByteArray::Data) + len)))); if (!d) { // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS qWarning("qUncompress: could not allocate enough memory to uncompress data"); -- cgit v0.12 From e7b0998325a66ecb9f979f253d732db85e1f43d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 19 Jan 2010 16:52:22 +0100 Subject: QGraphicsItem::hasFocus() performance regression. Problem was that we always climbed the parent chain to look for a panel item (QGraphicsItem::isActive()) before checking the scene's focus item. Task-number: QTBUG-6749 Reviewed-by: alexis --- src/gui/graphicsview/qgraphicsitem.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index cae9660..1361a89 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2997,9 +2997,16 @@ void QGraphicsItem::setActive(bool active) */ bool QGraphicsItem::hasFocus() const { + if (!d_ptr->scene || !d_ptr->scene->isActive()) + return false; + if (d_ptr->focusProxy) return d_ptr->focusProxy->hasFocus(); - return isActive() && (d_ptr->scene && d_ptr->scene->focusItem() == this); + + if (d_ptr->scene->d_func()->focusItem != this) + return false; + + return panel() == d_ptr->scene->d_func()->activePanel; } /*! -- cgit v0.12