diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-20 17:41:48 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-20 17:41:48 (GMT) |
commit | 185388c0bf0f258d070376a2a3e50b9e89e1a249 (patch) | |
tree | 609422b6a448e3670956686442fe574335507db4 | |
parent | 304c70a03406eb16b9a08719769655b75bf6d8e3 (diff) | |
parent | e7b0998325a66ecb9f979f253d732db85e1f43d1 (diff) | |
download | Qt-185388c0bf0f258d070376a2a3e50b9e89e1a249.zip Qt-185388c0bf0f258d070376a2a3e50b9e89e1a249.tar.gz Qt-185388c0bf0f258d070376a2a3e50b9e89e1a249.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
QGraphicsItem::hasFocus() performance regression.
Fix crashes in QByteArray
Move the labels a bit down so that they align better vertically with the field.
Add command to qmake to do symbian-uid generation
Fixed QBitmap::load to load into bitmap format again.
Fixed a crash under X11 when drawing QPixmaps to QGLPixelBuffers.
Text drawing is not fast currently
-rw-r--r-- | qmake/project.cpp | 14 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 4 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 9 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 21 | ||||
-rw-r--r-- | src/gui/kernel/qformlayout.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 3 | ||||
-rw-r--r-- | src/opengl/qgl_x11.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 38 |
8 files changed, 83 insertions, 18 deletions
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<QString, ExpandFunc> qmake_expandFunctions() { static QMap<QString, ExpandFunc> *qmake_expand_functions = 0; @@ -111,6 +111,7 @@ QMap<QString, ExpandFunc> 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<QStringList> args_list, QMap<QString, QStringList> &place) @@ -2301,6 +2305,14 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> 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, 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<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc)))); + d.reset(q_check_ptr(static_cast<QByteArray::Data *>(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<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len)))); + d.reset(q_check_ptr(static_cast<QByteArray::Data *>(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"); 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; } /*! diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 674d5da..f823fdc 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<QPixmapData> 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/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<QLayoutStruct>& 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())); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a9dcea0..31132d9 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. 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"); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 2340ef5..8bcd5e8 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" |