From 08e2216a5157c5de30a65674051b08df6f2a1bf6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 22 Jun 2010 15:26:24 +0200 Subject: Fixed crash in the fast blend functions for raster The blend functions don't work when the scaling factor goes beyond 65536, so abort early. Strictly speaking the scale factor comes from targetWidth / sourceWidth, so this catches a bit more cases. Reviewed-by: Kim Task: http://bugreports.qt.nokia.com/browse/QTBUG-9437 --- src/gui/painting/qpaintengine_raster.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a212718..94e5cbc 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2688,7 +2688,11 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) { - if (s->flags.fast_images) { + QRectF targetBounds = s->matrix.mapRect(r); + bool exceedsPrecision = targetBounds.width() > 0xffff + || targetBounds.height() > 0xffff; + + if (s->flags.fast_images && !exceedsPrecision) { if (s->matrix.type() > QTransform::TxScale) { SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; if (func && (!clip || clip->hasRectClip)) { -- cgit v0.12 From fb76a872e20bd0df8e7bbe9c039b7f20423c6f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 22 Jun 2010 13:24:26 +0200 Subject: Optimized sub-rect copying / painting of QPixmaps. Prevented downloading of the whole XImage by introducing new QPixmapData::toImage() overload taking a sub-rect. Also avoid an additional copy by simply taking ownership of the XImage data when the XImage format matches the QImage format. Reviewed-by: Trond --- src/gui/image/qpixmap_raster.cpp | 14 +++ src/gui/image/qpixmap_raster_p.h | 1 + src/gui/image/qpixmap_x11.cpp | 172 ++++++++++++++++++++----------- src/gui/image/qpixmap_x11_p.h | 8 ++ src/gui/image/qpixmapdata.cpp | 10 +- src/gui/image/qpixmapdata_p.h | 1 + src/gui/painting/qpaintengine_raster.cpp | 8 +- 7 files changed, 152 insertions(+), 62 deletions(-) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 13c03a1..13e95c7 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -289,6 +289,20 @@ QImage QRasterPixmapData::toImage() const return image; } +QImage QRasterPixmapData::toImage(const QRect &rect) const +{ + if (rect.isNull()) + return image; + + QRect clipped = rect.intersected(QRect(0, 0, w, h)); + if (d % 8 == 0) + return QImage(image.scanLine(clipped.y()) + clipped.x() * (d / 8), + clipped.width(), clipped.height(), + image.bytesPerLine(), image.format()); + else + return image.copy(clipped); +} + void QRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel) { image.setAlphaChannel(alphaChannel.toImage()); diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index d7e3f85..42ceeca 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -81,6 +81,7 @@ public: bool hasAlphaChannel() const; void setAlphaChannel(const QPixmap &alphaChannel); QImage toImage() const; + QImage toImage(const QRect &rect) const; QPaintEngine* paintEngine() const; QImage* buffer(); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index e8dc5ae..604dbf5 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1458,6 +1458,95 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const } } +struct QXImageWrapper +{ + XImage *xi; +}; + +bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const +{ + XImage *xi = xiWrapper.xi; + + // ARGB32_Premultiplied + if (picture && depth() == 32) + return true; + + Visual *visual = (Visual *)xinfo.visual(); + + // RGB32 + if (depth() == 24 && xi->bits_per_pixel == 32 && visual->red_mask == 0xff0000 + && visual->green_mask == 0xff00 && visual->blue_mask == 0xff) + return true; + + // RGB16 + if (depth() == 16 && xi->bits_per_pixel == 16 && visual->red_mask == 0xf800 + && visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f) + return true; + + return false; +} + +QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const +{ + XImage *xi = xiWrapper.xi; + + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (depth() == 24) + format = QImage::Format_RGB32; + else if (depth() == 16) + format = QImage::Format_RGB16; + + QImage image((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format); + // take ownership + image.data_ptr()->own_data = true; + xi->data = 0; + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (depth() == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + XDestroyImage(xi); + return image; +} + +QImage QX11PixmapData::toImage(const QRect &rect) const +{ + QXImageWrapper xiWrapper; + xiWrapper.xi = XGetImage(X11->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), + AllPlanes, (depth() == 1) ? XYPixmap : ZPixmap); + + Q_CHECK_PTR(xiWrapper.xi); + if (!xiWrapper.xi) + return QImage(); + + if (canTakeQImageFromXImage(xiWrapper)) + return takeQImageFromXImage(xiWrapper); + + QImage image = toImage(xiWrapper, rect); + qSafeXDestroyImage(xiWrapper.xi); + return image; +} + /*! Converts the pixmap to a QImage. Returns a null image if the conversion fails. @@ -1475,6 +1564,13 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const QImage QX11PixmapData::toImage() const { + return toImage(QRect(0, 0, w, h)); +} + +QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const +{ + XImage *xi = xiWrapper.xi; + int d = depth(); Visual *visual = (Visual *)xinfo.visual(); bool trucol = (visual->c_class >= TrueColor) && d > 1; @@ -1492,59 +1588,21 @@ QImage QX11PixmapData::toImage() const format = QImage::Format_RGB32; } - XImage *xi = XGetImage(X11->display, hd, 0, 0, w, h, AllPlanes, - (d == 1) ? XYPixmap : ZPixmap); - - Q_CHECK_PTR(xi); - if (!xi) - return QImage(); - - if (picture && depth() == 32) { - QImage image(w, h, QImage::Format_ARGB32_Premultiplied); - memcpy(image.bits(), xi->data, xi->bytes_per_line * xi->height); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) - { - for (int i=0; i < image.height(); i++) { - uint *p = (uint*)image.scanLine(i); - uint *end = p + image.width(); - if ((xi->byte_order == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) - || (xi->byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) { - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } else if (xi->byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) { - while (p < end) { - *p = ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff) - | ((*p ) & 0xff00ff00); - p++; - } - } - } - } - - // throw away image data - qSafeXDestroyImage(xi); - - return image; - } - if (d == 1 && xi->bitmap_bit_order == LSBFirst) format = QImage::Format_MonoLSB; if (x11_mask && format == QImage::Format_RGB32) format = QImage::Format_ARGB32; - QImage image(w, h, format); + QImage image(xi->width, xi->height, format); if (image.isNull()) // could not create image return image; QImage alpha; if (x11_mask) { - alpha = mask().toImage(); + if (rect.contains(QRect(0, 0, w, h))) + alpha = mask().toImage(); + else + alpha = mask().toImage().copy(rect); } bool ale = alpha.format() == QImage::Format_MonoLSB; @@ -1587,11 +1645,11 @@ QImage QX11PixmapData::toImage() const if (bppc > 8 && xi->byte_order == LSBFirst) bppc++; - for (int y = 0; y < h; ++y) { + for (int y = 0; y < xi->height; ++y) { uchar* asrc = x11_mask ? alpha.scanLine(y) : 0; dst = (QRgb *)image.scanLine(y); src = (uchar *)xi->data + xi->bytes_per_line*y; - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { switch (bppc) { case 8: pixel = *src++; @@ -1621,8 +1679,8 @@ QImage QX11PixmapData::toImage() const src += 4; break; default: // should not really happen - x = w; // leave loop - y = h; + x = xi->width; // leave loop + y = xi->height; pixel = 0; // eliminate compiler warning qWarning("QPixmap::convertToImage: Invalid depth %d", bppc); } @@ -1660,7 +1718,7 @@ QImage QX11PixmapData::toImage() const } else if (xi->bits_per_pixel == d) { // compatible depth char *xidata = xi->data; // copy each scanline int bpl = qMin(image.bytesPerLine(),xi->bytes_per_line); - for (int y=0; yheight; y++) { memcpy(image.scanLine(y), xidata, bpl); xidata += xi->bytes_per_line; } @@ -1686,17 +1744,17 @@ QImage QX11PixmapData::toImage() const bpl = image.bytesPerLine(); if (x11_mask) { // which pixels are used? - for (int i = 0; i < h; i++) { + for (int i = 0; i < xi->height; i++) { uchar* asrc = alpha.scanLine(i); p = image.scanLine(i); if (ale) { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (asrc[x >> 3] & (1 << (x & 7))) use[*p] = 1; ++p; } } else { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (asrc[x >> 3] & (0x80 >> (x & 7))) use[*p] = 1; ++p; @@ -1704,7 +1762,7 @@ QImage QX11PixmapData::toImage() const } } } else { - for (int i = 0; i < h; i++) { + for (int i = 0; i < xi->height; i++) { p = image.scanLine(i); end = p + bpl; while (p < end) @@ -1716,7 +1774,7 @@ QImage QX11PixmapData::toImage() const if (use[i]) pix[i] = ncols++; } - for (int i = 0; i < h; i++) { // translate pixels + for (int i = 0; i < xi->height; i++) { // translate pixels p = image.scanLine(i); end = p + bpl; while (p < end) { @@ -1736,17 +1794,17 @@ QImage QX11PixmapData::toImage() const // use first pixel in image (as good as any). trans = image.scanLine(0)[0]; } - for (int i = 0; i < h; i++) { + for (int i = 0; i < xi->height; i++) { uchar* asrc = alpha.scanLine(i); p = image.scanLine(i); if (ale) { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (!(asrc[x >> 3] & (1 << (x & 7)))) *p = trans; ++p; } } else { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (!(asrc[x >> 3] & (1 << (7 -(x & 7))))) *p = trans; ++p; @@ -1764,8 +1822,6 @@ QImage QX11PixmapData::toImage() const } } - qSafeXDestroyImage(xi); - return image; } diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index 7575838..821fb69 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -62,6 +62,8 @@ QT_BEGIN_NAMESPACE class QX11PaintEngine; +struct QXImageWrapper; + class Q_GUI_EXPORT QX11PixmapData : public QPixmapData { public: @@ -87,6 +89,7 @@ public: QPixmap transformed(const QTransform &transform, Qt::TransformationMode mode) const; QImage toImage() const; + QImage toImage(const QRect &rect) const; QPaintEngine* paintEngine() const; Qt::HANDLE handle() const { return hd; } @@ -116,10 +119,15 @@ private: void release(); + QImage toImage(const QXImageWrapper &xi, const QRect &rect) const; + QBitmap mask_to_bitmap(int screen) const; static Qt::HANDLE bitmap_to_mask(const QBitmap &, int screen); void bitmapFromImage(const QImage &image); + bool canTakeQImageFromXImage(const QXImageWrapper &xi) const; + QImage takeQImageFromXImage(const QXImageWrapper &xi) const; + Qt::HANDLE hd; enum Flag { diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 31ca909..345e3cf 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -146,7 +146,7 @@ bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::I void QPixmapData::copy(const QPixmapData *data, const QRect &rect) { - fromImage(data->toImage().copy(rect), Qt::NoOpaqueDetection); + fromImage(data->toImage(rect), Qt::NoOpaqueDetection); } bool QPixmapData::scroll(int dx, int dy, const QRect &rect) @@ -255,6 +255,14 @@ void QPixmapData::setSerialNumber(int serNo) ser_no = serNo; } +QImage QPixmapData::toImage(const QRect &rect) const +{ + if (rect.contains(QRect(0, 0, w, h))) + return toImage(); + else + return toImage().copy(rect); +} + QImage* QPixmapData::buffer() { return 0; diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 60ed26a..9a1505a 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -102,6 +102,7 @@ public: virtual void setAlphaChannel(const QPixmap &alphaChannel); virtual QPixmap alphaChannel() const; virtual QImage toImage() const = 0; + virtual QImage toImage(const QRect &rect) const; virtual QPaintEngine* paintEngine() const = 0; inline int serialNumber() const { return ser_no; } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 94e5cbc..84b36c7 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2419,7 +2419,9 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons drawImage(r, image, sr); } } else { - const QImage image = pixmap.toImage(); + QRect clippedSource = sr.toAlignedRect().intersected(pixmap.rect()); + const QImage image = pd->toImage(clippedSource); + QRectF translatedSource = sr.translated(-clippedSource.topLeft()); if (image.depth() == 1) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2430,10 +2432,10 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); return; } else { - drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); + drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), translatedSource); } } else { - drawImage(r, image, sr); + drawImage(r, image, translatedSource); } } } -- cgit v0.12 From 0c0eac000ecbe8c0bdcb8c6d914854b1a09a720b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 23 Jun 2010 13:33:20 +0200 Subject: Fixed QPixmap::toImage() bug introduced in fb76a872e20bd. The alpha channel we get from XGetImage might not be saturated for opaque pixmaps. Reviewed-by: Trond --- src/gui/image/qpixmap_x11.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 604dbf5..3d9c363 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1525,6 +1525,16 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con } } + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + XDestroyImage(xi); return image; } -- cgit v0.12 From 5817f04060f5a545a71a1f9e9dfa167f92a4ab93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 23 Jun 2010 13:55:20 +0200 Subject: Fixed missing copy of raster pixmap data after change fb76a872e20bd. It's expected that copy actually does a deep copy of the image data. Because QRasterPixmapData::fromImage() will just use the source image as is in this case we need to do a deep copy of the QImage. Reviewed-by: Trond --- src/gui/image/qpixmap_raster.cpp | 5 +++++ src/gui/image/qpixmap_raster_p.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 13e95c7..e188745 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -155,6 +155,11 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); +void QRasterPixmapData::copy(const QPixmapData *data, const QRect &rect) +{ + fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); +} + bool QRasterPixmapData::scroll(int dx, int dy, const QRect &rect) { if (!image.isNull()) diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index 42ceeca..a46e054 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -75,6 +75,7 @@ public: bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void copy(const QPixmapData *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); void setMask(const QBitmap &mask); -- cgit v0.12 From 98d9083f87feb3d78af509db43685a148aa0766e Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Jun 2010 18:18:45 +0200 Subject: Add a SSE2 version of comp_func_SourceOver() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement a version of comp_func_SourceOver() with SSE2. This gives a performance boost of 11% on some WebKit animations. Two new macros were added to simplify the implementation of the different blending primitives: BLEND_SOURCE_OVER_ARGB32_SSE2() and BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2() Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 7 +- src/gui/painting/qdrawhelper_sse2.cpp | 170 ++++++++++++++++++++++------------ 2 files changed, 116 insertions(+), 61 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index bfa1136..d088499 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7817,6 +7817,12 @@ void qInitDrawhelperAsm() #ifdef QT_HAVE_SSE2 if (features & SSE2) { + extern void comp_func_SourceOver_sse2(uint *destPixels, + const uint *srcPixels, + int length, + uint const_alpha); + functionForModeAsm[0] = comp_func_SourceOver_sse2; + extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, @@ -7826,7 +7832,6 @@ void qInitDrawhelperAsm() int w, int h, int const_alpha); - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 6ac64d3..b650aac 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -126,6 +126,93 @@ QT_BEGIN_NAMESPACE result = _mm_or_si128(finalAG, finalRB); \ } +// Basically blend src over dst with the const alpha defined as constAlphaVector. +// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +//const __m128i nullVector = _mm_set1_epi32(0); +//const __m128i half = _mm_set1_epi16(0x80); +//const __m128i one = _mm_set1_epi16(0xff); +//const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); +//const __m128i alphaMask = _mm_set1_epi32(0xff000000); +// +// The computation being done is: +// result = s + d * (1-alpha) +// with shortcuts if fully opaque or fully transparent. +#define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ + int x = 0; \ + for (; x < length-3; x += 4) { \ + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ + /* all opaque */ \ + _mm_storeu_si128((__m128i *)&dst[x], srcVector); \ + } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ + /* not fully transparent */ \ + /* extract the alpha channel on 2 x 16 bits */ \ + /* so we have room for the multiplication */ \ + /* each 32 bits will be in the form 0x00AA00AA */ \ + /* with A being the 1 - alpha */ \ + __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); \ + alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + \ + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + \ + /* result = s + d * (1-alpha) */\ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_storeu_si128((__m128i *)&dst[x], result); \ + } \ + } \ + for (; x < length; ++x) { \ + uint s = src[x]; \ + if (s >= 0xff000000) \ + dst[x] = s; \ + else if (s != 0) \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ +} + +// Basically blend src over dst with the const alpha defined as constAlphaVector. +// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +//const __m128i nullVector = _mm_set1_epi32(0); +//const __m128i half = _mm_set1_epi16(0x80); +//const __m128i one = _mm_set1_epi16(0xff); +//const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); +// +// The computation being done is: +// dest = (s + d * sia) * ca + d * cia +// = s * ca + d * (sia * ca + cia) +// = s * ca + d * (1 - sa*ca) +#define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \ +{ \ + int x = 0; \ + for (; x < length-3; x += 4) { \ + __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \ + BYTE_MUL_SSE2(srcVector, srcVector, constAlphaVector, colorMask, half); \ +\ + __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); \ + alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + \ + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + \ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_storeu_si128((__m128i *)&dst[x], result); \ + } \ + } \ + for (; x < length; ++x) { \ + quint32 s = src[x]; \ + if (s != 0) { \ + s = BYTE_MUL(s, const_alpha); \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ + } \ +} + void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, @@ -140,41 +227,7 @@ void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const __m128i one = _mm_set1_epi16(0xff); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); for (int y = 0; y < h; ++y) { - int x = 0; - for (; x < w-3; x += 4) { - const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); - const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); - if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { - // all opaque - _mm_storeu_si128((__m128i *)&dst[x], srcVector); - } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { - // not fully transparent - // result = s + d * (1-alpha) - - // extract the alpha channel on 2 x 16 bits - // so we have room for the multiplication - // each 32 bits will be in the form 0x00AA00AA - // with A being the 1 - alpha - __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); - alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); - alphaChannel = _mm_sub_epi16(one, alphaChannel); - - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); - __m128i destMultipliedByOneMinusAlpha; - BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); - - // result = s + d * (1-alpha) - const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); - _mm_storeu_si128((__m128i *)&dst[x], result); - } - } - for (; x= 0xff000000) - dst[x] = s; - else if (s != 0) - dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); - } + BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, w, nullVector, half, one, colorMask, alphaMask); dst = (quint32 *)(((uchar *) dst) + dbpl); src = (const quint32 *)(((const uchar *) src) + sbpl); } @@ -189,31 +242,7 @@ void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); for (int y = 0; y < h; ++y) { - int x = 0; - for (; x < w-3; x += 4) { - __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); - if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { - BYTE_MUL_SSE2(srcVector, srcVector, constAlphaVector, colorMask, half); - - __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); - alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); - alphaChannel = _mm_sub_epi16(one, alphaChannel); - - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); - __m128i destMultipliedByOneMinusAlpha; - BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); - - const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); - _mm_storeu_si128((__m128i *)&dst[x], result); - } - } - for (; x 0); // if const_alpha == 0, this should never be called + Q_ASSERT(const_alpha < 256); + + const quint32 *src = (const quint32 *) srcPixels; + quint32 *dst = (uint *) destPixels; + + const __m128i nullVector = _mm_set1_epi32(0); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i one = _mm_set1_epi16(0xff); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + if (const_alpha == 255) { + const __m128i alphaMask = _mm_set1_epi32(0xff000000); + BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask); + } else { + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector); + } +} + void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) { if (count < 7) { -- cgit v0.12 From a922a304ae9115d04f3bbcb3bd13c8e374bb16f1 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Jun 2010 22:06:02 +0200 Subject: Add a SSE2 implementation of comp_func_solid_SourceOver() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function is used quite a lot by WebKit animations, the SSE2 implementation is twice as fast in those uses cases. Reviewed-by: Andreas Kling Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 5 ++++- src/gui/painting/qdrawhelper_sse2.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index d088499..f08c090 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7817,11 +7817,14 @@ void qInitDrawhelperAsm() #ifdef QT_HAVE_SSE2 if (features & SSE2) { - extern void comp_func_SourceOver_sse2(uint *destPixels, + extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha); + extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha); + functionForModeAsm[0] = comp_func_SourceOver_sse2; + functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2; extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index b650aac..7d542d6 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -297,7 +297,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, } } -void comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) { Q_ASSERT(const_alpha > 0); // if const_alpha == 0, this should never be called Q_ASSERT(const_alpha < 256); @@ -362,6 +362,34 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) } } +void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha) +{ + if ((const_alpha & qAlpha(color)) == 255) { + qt_memfill32_sse2(destPixels, length, color); + } else { + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + + const quint32 minusAlphaOfColor = qAlpha(~color); + int x = 0; + + quint32 *dst = (uint *) destPixels; + const __m128i colorVector = _mm_set1_epi32(color); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i minusAlphaOfColorVector = _mm_set1_epi16(minusAlphaOfColor); + + for (; x < length-3; x += 4) { + __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); + BYTE_MUL_SSE2(dstVector, dstVector, minusAlphaOfColorVector, colorMask, half); + dstVector = _mm_add_epi8(colorVector, dstVector); + _mm_storeu_si128((__m128i *)&dst[x], dstVector); + } + for (;x < length; ++x) + destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); + } +} + void qt_memfill16_sse2(quint16 *dest, quint16 value, int count) { if (count < 3) { -- cgit v0.12 From 86f375e91c2b1162a75f86c9b8f041ae1d4747de Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Jun 2010 23:48:54 +0200 Subject: Fix the casts of qdrawhelper_sse2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I did erroneous cast by mistake, the code should ensure the pointer are on 32 bits integers. Reviewed-by: Andreas Kling Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_sse2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 7d542d6..e2a69ec 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -219,7 +219,7 @@ void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, int const_alpha) { const quint32 *src = (const quint32 *) srcPixels; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; if (const_alpha == 256) { const __m128i alphaMask = _mm_set1_epi32(0xff000000); const __m128i nullVector = _mm_set1_epi32(0); @@ -261,7 +261,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, int const_alpha) { const quint32 *src = (const quint32 *) srcPixels; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; if (const_alpha != 256) { if (const_alpha != 0) { const __m128i nullVector = _mm_set1_epi32(0); @@ -303,7 +303,7 @@ void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixe Q_ASSERT(const_alpha < 256); const quint32 *src = (const quint32 *) srcPixels; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; const __m128i nullVector = _mm_set1_epi32(0); const __m128i half = _mm_set1_epi16(0x80); @@ -373,7 +373,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u const quint32 minusAlphaOfColor = qAlpha(~color); int x = 0; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; const __m128i colorVector = _mm_set1_epi32(color); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); const __m128i half = _mm_set1_epi16(0x80); -- cgit v0.12 From 5cfa764466be6ec2b987e0694b99f1d343d55048 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 23 Jun 2010 22:22:56 +0200 Subject: Add an implementation of comp_func_solid_SourceOver_neon() with Neon. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function comp_func_solid_SourceOver_neon() is use extensively by WebKit via the calls to fillRect() of QPainter(). Implementing the function with Neon provides some performance improvement (around 175% of the previous speed). Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 1 + src/gui/painting/qdrawhelper_neon.cpp | 43 +++++++++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_p.h | 2 ++ 3 files changed, 46 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index f08c090..5727b3c 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7898,6 +7898,7 @@ void qInitDrawhelperAsm() qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; } diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index ee5f24a..3ce90d2 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -579,6 +579,49 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int } } +void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha) +{ + if ((const_alpha & qAlpha(color)) == 255) { + QT_MEMFILL_UINT(destPixels, length, color); + } else { + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + + const quint32 minusAlphaOfColor = qAlpha(~color); + int x = 0; + + uint32_t *dst = (uint32_t *) destPixels; + const uint32x4_t colorVector = vdupq_n_u32(color); + uint16x8_t half = vdupq_n_u16(0x80); + const uint16x8_t minusAlphaOfColorVector = vdupq_n_u16(minusAlphaOfColor); + + for (; x < length-3; x += 4) { + uint32x4_t dstVector = vld1q_u32(&dst[x]); + + const uint8x16_t dst8 = vreinterpretq_u8_u32(dstVector); + + const uint8x8_t dst8_low = vget_low_u8(dst8); + const uint8x8_t dst8_high = vget_high_u8(dst8); + + const uint16x8_t dst16_low = vmovl_u8(dst8_low); + const uint16x8_t dst16_high = vmovl_u8(dst8_high); + + const uint16x8_t result16_low = qvbyte_mul_u16(dst16_low, minusAlphaOfColorVector, half); + const uint16x8_t result16_high = qvbyte_mul_u16(dst16_high, minusAlphaOfColorVector, half); + + const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low)); + const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high)); + + uint32x4_t blendedPixels = vcombine_u32(result32_low, result32_high); + uint32x4_t colorPlusBlendedPixels = vaddq_u32(colorVector, blendedPixels); + vst1q_u32(&dst[x], colorPlusBlendedPixels); + } + + for (;x < length; ++x) + destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); + } +} + QT_END_NAMESPACE #endif // QT_HAVE_NEON diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index d6a4509..c054a1e 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -127,6 +127,8 @@ uint * QT_FASTCALL qt_destFetchRGB16_neon(uint *buffer, void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length); +void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha); + #endif // QT_HAVE_NEON QT_END_NAMESPACE -- cgit v0.12 From 9de452bba5b592402ced6f20fbdc6d0b5c075416 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 24 Jun 2010 11:23:57 +1000 Subject: Normalize integers when calling glVertexAttribPointer() When QGLShaderProgram::setAttributeArray() is used with a type like GL_UNSIGNED_BYTE, it is normally going to be a value that should be normalized to the range 0..1. But the function wasn't normalizing, which led to errors in programs that used per-vertex colors with the 4ub representation. Reviewed-by: Sarah Smith --- src/opengl/qglshaderprogram.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 83b4b21..c7689b8 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -1490,7 +1490,7 @@ void QGLShaderProgram::setAttributeArray Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - glVertexAttribPointer(location, tupleSize, type, GL_FALSE, + glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride, values); } } @@ -1634,7 +1634,7 @@ void QGLShaderProgram::setAttributeBuffer Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - glVertexAttribPointer(location, tupleSize, type, GL_FALSE, stride, + glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride, reinterpret_cast(offset)); } } -- cgit v0.12 From a7d6605dd3e3419eb2c0ec96c3bb69b686c8ea42 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 24 Jun 2010 10:17:30 +0200 Subject: Added a note to desupport VC2010 64-bit VC2010 has a bug that makes optimized 64-bit code crash. Task-Number: QTBUG-11445 --- doc/src/platforms/compiler-notes.qdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 7eb92e0..c6ecd68 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -237,8 +237,6 @@ Qt works with the Standard Edition, the Professional Edition and Team System Edition of Visual Studio 2005. - We also test Qt 4 on Windows XP with Visual Studio .NET and Visual Studio 2003. - In order to use Qt with the Visual Studio 2005/2008 Express Edition you need to download and install the platform SDK. Due to limitations in the Express Edition it is not possible for us to install the Qt Visual @@ -266,6 +264,10 @@ from Microsoft. See this \l{http://qt.nokia.com/developer/faqs/faq.2006-12-18.3281869860}{Knowledge Base entry} for more information. + + There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. + Its optimizer causes trouble and crashes for the release builds and it is not supported + in that configuration. See task http://bugreports.qt.nokia.com/browse/QTBUG-11445. \section1 IBM xlC (AIX) -- cgit v0.12 From e9a2f4d6d0186962b0833a53882e472bfe262bb9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 24 Jun 2010 12:03:22 +0200 Subject: Adding a known issue for VC2010 64 bit Task-Number: QTBUG-11445 --- doc/src/getting-started/known-issues.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index b2c39c4..0fa23f6 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -129,6 +129,14 @@ will not compile. See \l{http://bugreports.qt.nokia.com/browse/QTBUG-6297} for a workaround for QtScript. + + \o Compile errors with Microsoft Visual C++ compiler. \br + There seems to be a bug in the Microsoft compiler when compiling with O2 + optimization level in 64 bit. + This problem will result in crashes in QAbstractItemView::viewOptions(). + See \l{http://bugreports.qt.nokia.com/browse/QTBUG-11445} for updates on this + bug. + \endlist -- cgit v0.12 From 6f006b105978f53b7c5bd3d17637239f308ad20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 24 Jun 2010 12:41:26 +0200 Subject: Fixed autotest failure in fillRect_stretchToDeviceMode Swapping the length and color arguments to qt_memfill is a bad idea. Reviewed-by: Benjamin Poulain --- src/gui/painting/qdrawhelper_sse2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index e2a69ec..04fe825 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -365,7 +365,7 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha) { if ((const_alpha & qAlpha(color)) == 255) { - qt_memfill32_sse2(destPixels, length, color); + qt_memfill32_sse2(destPixels, color, length); } else { if (const_alpha != 255) color = BYTE_MUL(color, const_alpha); -- cgit v0.12 From 20a3d8c889df2338f6edd209ca4952b9045ffb00 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 24 Jun 2010 13:07:45 +0200 Subject: Fixed some potential index-out-of-bounds issues in QImage. Added color table bounds checks when converting a color indexed image to a different pixel format. Fixed an off-by-one error in the color table bounds check in QImage::setPixel(). Fixed an autotest that was setting pixel values out of bounds. Reviewed-by: Gunnar --- src/gui/image/qimage.cpp | 26 ++++++++++++++++++++++---- tests/auto/qimage/tst_qimage.cpp | 4 ++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index bb8a994..79f266d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2338,6 +2338,12 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve const int width = data->width; const int src_pad = data->bytes_per_line - width; const int dest_pad = (dst_bytes_per_line >> 2) - width; + if (data->colortable.size() == 0) { + data->colortable.resize(256); + for (int i = 0; i < 256; ++i) + data->colortable[i] = qRgb(i, i, i); + } + const int tableSize = data->colortable.size() - 1; for (int i = 0; i < data->height; ++i) { src_data -= src_pad; @@ -2345,7 +2351,7 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve for (int pixI = 0; pixI < width; ++pixI) { --src_data; --dest_data; - const uint pixel = data->colortable[*src_data]; + const uint pixel = data->colortable[qMin(tableSize, *src_data)]; *dest_data = (quint32) PREMUL(pixel); } } @@ -2377,6 +2383,12 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio const int width = data->width; const int src_pad = data->bytes_per_line - width; const int dest_pad = (dst_bytes_per_line >> 2) - width; + if (data->colortable.size() == 0) { + data->colortable.resize(256); + for (int i = 0; i < 256; ++i) + data->colortable[i] = qRgb(i, i, i); + } + const int tableSize = data->colortable.size() - 1; for (int i = 0; i < data->height; ++i) { src_data -= src_pad; @@ -2384,7 +2396,7 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio for (int pixI = 0; pixI < width; ++pixI) { --src_data; --dest_data; - *dest_data = (quint32) data->colortable[*src_data]; + *dest_data = (quint32) data->colortable[qMin(tableSize, *src_data)]; } } @@ -2415,6 +2427,12 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers const int width = data->width; const int src_pad = data->bytes_per_line - width; const int dest_pad = (dst_bytes_per_line >> 1) - width; + if (data->colortable.size() == 0) { + data->colortable.resize(256); + for (int i = 0; i < 256; ++i) + data->colortable[i] = qRgb(i, i, i); + } + const int tableSize = data->colortable.size() - 1; for (int i = 0; i < data->height; ++i) { src_data -= src_pad; @@ -2422,7 +2440,7 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers for (int pixI = 0; pixI < width; ++pixI) { --src_data; --dest_data; - const uint pixel = data->colortable[*src_data]; + const uint pixel = data->colortable[qMin(tableSize, *src_data)]; *dest_data = qt_colorConvert(pixel, 0); } } @@ -4061,7 +4079,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb) } break; case Format_Indexed8: - if (index_or_rgb > (uint)d->colortable.size()) { + if (index_or_rgb >= (uint)d->colortable.size()) { qWarning("QImage::setPixel: Index %d out of range", index_or_rgb); return; } diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 16deb03..5052114 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -945,11 +945,11 @@ void tst_QImage::rotate() const int n = original.colorTable().size(); for (int x = 0; x < w; ++x) { original.setPixel(x, 0, x % n); - original.setPixel(x,h - 1, n - (x % n)); + original.setPixel(x, h - 1, n - (x % n) - 1); } for (int y = 0; y < h; ++y) { original.setPixel(0, y, y % n); - original.setPixel(w - 1, y, n - (y % n)); + original.setPixel(w - 1, y, n - (y % n) - 1); } } -- cgit v0.12 From 7bc00632dde1b718cbe1412e988ad006dc3d125f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 24 Jun 2010 15:11:05 +0200 Subject: Add a new (internal) flag QGraphicsItem::ItemStopsClickFocusPropagation. This flag allows you to create a non-focusable item that can be clicked on without changing the focus. This is also possible to achieve by using focus scopes / panels, however the implementation is then way more complex. Thew new flag is tailored for simple uses cases where you simply want to stop the propagation and nothing more. Auto test included. Task-number: QT-3499 Reviewed-by: yoann --- src/gui/graphicsview/qgraphicsitem.cpp | 8 ++++ src/gui/graphicsview/qgraphicsitem.h | 3 +- src/gui/graphicsview/qgraphicsitem_p.h | 6 +-- src/gui/graphicsview/qgraphicsscene.cpp | 2 + tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 54 ++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2de3638..61285d2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -411,6 +411,11 @@ these notifications are disabled by default. You must enable this flag to receive notifications for scene position changes. This flag was introduced in Qt 4.6. + + \omitvalue ItemStopsClickFocusPropagation \omit The item stops propagating + click focus to items underneath when being clicked on. This flag + allows you create a non-focusable item that can be clicked on without + changing the focus. \endomit */ /*! @@ -11432,6 +11437,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemSendsScenePositionChanges: str = "ItemSendsScenePositionChanges"; break; + case QGraphicsItem::ItemStopsClickFocusPropagation: + str = "ItemStopsClickFocusPropagation"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index d7d5332..3c193cd 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -106,7 +106,8 @@ public: ItemNegativeZStacksBehindParent = 0x2000, ItemIsPanel = 0x4000, ItemIsFocusScope = 0x8000, // internal - ItemSendsScenePositionChanges = 0x10000 + ItemSendsScenePositionChanges = 0x10000, + ItemStopsClickFocusPropagation = 0x20000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index bde6e7d..f9f5d3d 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -556,7 +556,7 @@ public: quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 flags : 17; + quint32 flags : 18; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -571,9 +571,9 @@ public: quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; quint32 mouseSetsFocus : 1; - quint32 explicitActivate : 1; // New 32 bits + quint32 explicitActivate : 1; quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; @@ -582,7 +582,7 @@ public: quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; quint32 isDeclarativeItem : 1; - quint32 padding : 24; + quint32 padding : 23; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ca3b56f..d04074a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1336,6 +1336,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou break; } } + if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) + break; if (item->isPanel()) break; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index fe68c8e..31a6845 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -442,6 +442,7 @@ private slots: void updateMicroFocus(); void textItem_shortcuts(); void scroll(); + void stopClickFocusPropagation(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -10268,6 +10269,59 @@ void tst_QGraphicsItem::scroll() QCOMPARE(item2->lastExposedRect, expectedItem2Expose); } +void tst_QGraphicsItem::stopClickFocusPropagation() +{ + class MyItem : public QGraphicsRectItem + { + public: + MyItem() : QGraphicsRectItem(0, 0, 100, 100) {} + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->fillRect(boundingRect(), hasFocus() ? QBrush(Qt::red) : brush()); + } + }; + + QGraphicsScene scene(-50, -50, 400, 400); + scene.setStickyFocus(true); + + QGraphicsRectItem *noFocusOnTop = new MyItem; + noFocusOnTop->setBrush(Qt::yellow); + noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation); + + QGraphicsRectItem *focusableUnder = new MyItem; + focusableUnder->setBrush(Qt::blue); + focusableUnder->setFlag(QGraphicsItem::ItemIsFocusable); + focusableUnder->setPos(50, 50); + + QGraphicsRectItem *itemWithFocus = new MyItem; + itemWithFocus->setBrush(Qt::black); + itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable); + itemWithFocus->setPos(250, 10); + + scene.addItem(noFocusOnTop); + scene.addItem(focusableUnder); + scene.addItem(itemWithFocus); + focusableUnder->stackBefore(noFocusOnTop); + itemWithFocus->setFocus(); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QApplication::setActiveWindow(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); + QVERIFY(itemWithFocus->hasFocus()); + + QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF()); + mousePressPoint.rx() += 60; + mousePressPoint.ry() += 60; + const QList itemsAtMousePressPosition = scene.items(mousePressPoint); + QVERIFY(itemsAtMousePressPosition.contains(focusableUnder)); + + sendMousePress(&scene, mousePressPoint); + QVERIFY(itemWithFocus->hasFocus()); +} + void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() { struct Item : public QGraphicsTextItem -- cgit v0.12 From 3b7ae67fe2715838c32ff28694761e57e4f79537 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 25 Jun 2010 09:36:50 +0200 Subject: Fix compilation when configured with -no-xrender Reviewed-by: Eskil --- src/gui/kernel/qapplication_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 3664743..e4d9848 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2155,7 +2155,7 @@ void qt_init(QApplicationPrivate *priv, int, X11->fc_scale = fc_scale; for (int s = 0; s < ScreenCount(X11->display); ++s) { int subpixel = FC_RGBA_UNKNOWN; -#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 +#if !defined(QT_NO_XRENDER) && (RENDER_MAJOR > 0 || RENDER_MINOR >= 6) if (X11->use_xrender) { int rsp = XRenderQuerySubpixelOrder(X11->display, s); switch (rsp) { -- cgit v0.12 From 1223f3f3d32bdc394a0fcd8d034fb3ad0afab0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 24 Jun 2010 15:15:56 +0200 Subject: Fixed autotest failure in QPainter::setOpacity when NEON is used. Be more lenient in the comparison, rounding errors might lead to slightly different values. Reviewed-by: Trond --- tests/auto/qpainter/tst_qpainter.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 701dc2e..27ee6e7 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -2648,12 +2648,16 @@ void tst_QPainter::setOpacity() p.drawImage(imageRect, src, imageRect); p.end(); - QImage expected(imageSize, destFormat); - p.begin(&expected); - p.fillRect(imageRect, QColor(127, 127, 127)); - p.end(); - - QCOMPARE(dest, expected); + QImage actual = dest.convertToFormat(QImage::Format_RGB32); + + for (int y = 0; y < actual.height(); ++y) { + QRgb *p = (QRgb *)actual.scanLine(y); + for (int x = 0; x < actual.width(); ++x) { + QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf); + } + } } void tst_QPainter::drawhelper_blend_untransformed_data() -- cgit v0.12 From a179ae5dd94d0c51ebbf7d5c5b8eef5b3099c163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Jun 2010 14:11:44 +0200 Subject: Fixed autotest failure in QPathClipper on N900. We need to use double precision for the angle computations, as they are crucial to build correct winged edge structures. Reviewed-by: Trond --- src/gui/painting/qpathclipper.cpp | 48 +++++++++++++-------------------------- src/gui/painting/qpathclipper_p.h | 4 ++-- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 78553c9..a17b7c1 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -86,9 +86,11 @@ static qreal dot(const QPointF &a, const QPointF &b) return a.x() * b.x() + a.y() * b.y(); } -static QPointF normalize(const QPointF &p) +static void normalize(double &x, double &y) { - return p / qSqrt(p.x() * p.x() + p.y() * p.y()); + double reciprocal = 1 / qSqrt(x * x + y * y); + x *= reciprocal; + y *= reciprocal; } struct QIntersection @@ -1017,8 +1019,8 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const const QPathEdge *ap = edge(a); const QPathEdge *bp = edge(b); - qreal a_angle = ap->angle; - qreal b_angle = bp->angle; + double a_angle = ap->angle; + double b_angle = bp->angle; if (vertex == ap->second) a_angle = ap->invAngle; @@ -1026,7 +1028,7 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const if (vertex == bp->second) b_angle = bp->invAngle; - qreal result = b_angle - a_angle; + double result = b_angle - a_angle; if (result >= 128.) return result - 128.; @@ -1036,26 +1038,6 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const return result; } -static inline QPointF tangentAt(const QWingedEdge &list, int vi, int ei) -{ - const QPathEdge *ep = list.edge(ei); - Q_ASSERT(ep); - - qreal sign; - - if (ep->first == vi) { - sign = 1; - } else { - sign = -1; - } - - const QPointF a = *list.vertex(ep->first); - const QPointF b = *list.vertex(ep->second); - QPointF normal = b - a; - - return normalize(sign * normal); -} - static inline QPointF midPoint(const QWingedEdge &list, int ei) { const QPathEdge *ep = list.edge(ei); @@ -1191,7 +1173,7 @@ static int commonEdge(const QWingedEdge &list, int a, int b) return -1; } -static qreal computeAngle(const QPointF &v) +static double computeAngle(const QPointF &v) { #if 1 if (v.x() == 0) { @@ -1200,15 +1182,17 @@ static qreal computeAngle(const QPointF &v) return v.x() <= 0 ? 32. : 96.; } - QPointF nv = normalize(v); - if (nv.y() < 0) { - if (nv.x() < 0) { // 0 - 32 - return -32. * nv.x(); + double vx = v.x(); + double vy = v.y(); + normalize(vx, vy); + if (vy < 0) { + if (vx < 0) { // 0 - 32 + return -32. * vx; } else { // 96 - 128 - return 128. - 32. * nv.x(); + return 128. - 32. * vx; } } else { // 32 - 96 - return 64. + 32 * nv.x(); + return 64. + 32. * vx; } #else // doesn't seem to be robust enough diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index fab618d..bdad4e1 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -148,8 +148,8 @@ public: int first; int second; - qreal angle; - qreal invAngle; + double angle; + double invAngle; int next(Traversal traversal, Direction direction) const; -- cgit v0.12 From 02e44e7d93dd5336ab9415af98f2021e542eff31 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 25 Jun 2010 16:22:50 +0200 Subject: Export the QGLPixmapData so that we can override it in a custom graphics system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/opengl/qpixmapdata_gl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index c239bcb..736a28e 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -96,7 +96,7 @@ private: }; -class QGLPixmapData : public QPixmapData +class Q_OPENGL_EXPORT QGLPixmapData : public QPixmapData { public: QGLPixmapData(PixelType type); -- cgit v0.12 From 535adbb4954caff9d88dc57bdb57bd09b872ddf1 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 25 Jun 2010 16:22:51 +0200 Subject: Export QGLWindowSurface too. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 8ea714c..624236c 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -77,7 +77,7 @@ public: QGLWindowSurfacePrivate* d; }; -class QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice +class Q_OPENGL_EXPORT QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice { Q_OBJECT public: -- cgit v0.12 From c5aa53243bca8261d55d81cfeb525739a68b7703 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 25 Jun 2010 16:22:52 +0200 Subject: Need to access extensionFuncs in subclasses too. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/opengl/qgl.cpp | 7 +++++++ src/opengl/qgl_p.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b4c85ac..71db7a8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2220,6 +2220,13 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu } } +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *) +{ + return qt_extensionFuncs; +} +#endif + QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_premul, GLenum texture_format) { diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 1727a41..c7fd111 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -415,7 +415,7 @@ public: #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) static QGLExtensionFuncs qt_extensionFuncs; - static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } + static QGLExtensionFuncs& extensionFuncs(const QGLContext *); #endif static void setCurrentContext(QGLContext *context); -- cgit v0.12 From cc75093e3b300a37d05a81921d7811caabbfb449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 25 Jun 2010 17:21:26 +0200 Subject: EGL plane levels are the same as all other GL backends. Qt has never used level 1 for the main plane, it's always been 0 and will always be 0. Reviewed-by: Harald Fernengel --- src/opengl/qgl_egl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 0a19531..58d3b0a 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -138,7 +138,7 @@ void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) format.setDepthBufferSize(depthSize); format.setStencilBufferSize(stencilSize); format.setSamples(sampleCount); - format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" + format.setPlane(level); format.setDirectRendering(true); // All EGL contexts are direct-rendered format.setRgba(true); // EGL doesn't support colour index rendering format.setStereo(false); // EGL doesn't support stereo buffers -- cgit v0.12 From fd8e9eadd087d11b0a01d598132ccbb19667fa5a Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Mon, 28 Jun 2010 12:55:02 +0200 Subject: New variant of ::createPixmapData with origin for QGraphicsSystem. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 705 Reviewed-by: Samuel Rødal --- src/gui/painting/qgraphicssystem.cpp | 4 ++++ src/gui/painting/qgraphicssystem_p.h | 1 + src/gui/painting/qgraphicssystem_runtime.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 2ea3d33..69ce47e 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -79,5 +79,9 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return 0; } +QPixmapData *QGraphicsSystem::createPixmapData(QPixmapData *origin) +{ + return createPixmapData(origin->pixelType()); +} QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index ddca788..1211505 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -64,6 +64,7 @@ class Q_GUI_EXPORT QGraphicsSystem { public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; + virtual QPixmapData *createPixmapData(QPixmapData *origin); virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; virtual ~QGraphicsSystem() = 0; diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 32a8578..1c3ae10 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -416,7 +416,7 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) for (int i = 0; i < m_pixmapDatas.size(); ++i) { QRuntimePixmapData *proxy = m_pixmapDatas.at(i); - QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data->pixelType()); + QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. newData->fromImage(proxy->m_data->toImage(), Qt::AutoColor | Qt::OrderedAlphaDither); delete proxy->m_data; -- cgit v0.12 From 7d0f824e023e8b4b45d67c1d3556c73d296bb5bd Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 28 Jun 2010 14:31:57 +0200 Subject: Add a manual test for regular widget interaction with the table. The code paths are different if the tablet event is accepted or not. This manuel test show the events received from tablet and mouse to make sure we get the right events in the right order. --- tests/manual/qtabletevent/regular_widgets/main.cpp | 109 +++++++++++++++++++++ .../regular_widgets/regular_widgets.pro | 3 + 2 files changed, 112 insertions(+) create mode 100644 tests/manual/qtabletevent/regular_widgets/main.cpp create mode 100644 tests/manual/qtabletevent/regular_widgets/regular_widgets.pro diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp new file mode 100644 index 0000000..e0c53f5 --- /dev/null +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include + +class EventReportWidget : public QWidget +{ +public: + EventReportWidget(); +protected: + void mouseDoubleClickEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mouseMoveEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mousePressEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mouseReleaseEvent(QMouseEvent *event) { outputMouseEvent(event); } + + void tabletEvent(QTabletEvent *); + +private: + void outputMouseEvent(QMouseEvent *event); + + bool m_lastIsMouseMove; + bool m_lastIsTabletMove; +}; + +EventReportWidget::EventReportWidget() + : m_lastIsMouseMove(false) + , m_lastIsTabletMove(false) +{ } + +void EventReportWidget::tabletEvent(QTabletEvent *event) +{ + QWidget::tabletEvent(event); + + QString type; + switch (event->type()) { + case QEvent::TabletEnterProximity: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletEnterProximity"); + break; + case QEvent::TabletLeaveProximity: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletLeaveProximity"); + break; + case QEvent::TabletMove: + if (m_lastIsTabletMove) + return; + + m_lastIsTabletMove = true; + type = QString::fromLatin1("TabletMove"); + break; + case QEvent::TabletPress: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletPress"); + break; + case QEvent::TabletRelease: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletRelease"); + break; + default: + Q_ASSERT(false); + break; + } + + qDebug() << "Tablet event, type = " << type + << " position = " << event->pos() + << " global position = " << event->globalPos(); +} + +void EventReportWidget::outputMouseEvent(QMouseEvent *event) +{ + QString type; + switch (event->type()) { + case QEvent::MouseButtonDblClick: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonDblClick"); + break; + case QEvent::MouseButtonPress: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonPress"); + break; + case QEvent::MouseButtonRelease: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonRelease"); + break; + case QEvent::MouseMove: + if (m_lastIsMouseMove) + return; // only show one move to keep things readable + + m_lastIsMouseMove = true; + type = QString::fromLatin1("MouseMove"); + break; + default: + Q_ASSERT(false); + break; + } + + qDebug() << "Mouse event, type = " << type + << " position = " << event->pos() + << " global position = " << event->globalPos(); +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + EventReportWidget widget; + widget.show(); + return app.exec(); +} diff --git a/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro new file mode 100644 index 0000000..9f0da76 --- /dev/null +++ b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro @@ -0,0 +1,3 @@ +TEMPLATE = app + +SOURCES += main.cpp -- cgit v0.12 From b1b46a21ea4aae5711130850e1bb19b0728a22ec Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 28 Jun 2010 15:42:20 +0200 Subject: Fix an assertion in comp_func_SourceOver_sse2() if const_alpha == 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Const_alpha == 0 is a corner case that can happen if the painter draw with zero opacity or if the multiplication of alphas is below 1. The assertion was failing for one of the test of QPainter. Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_sse2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 04fe825..6cd8688 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -299,7 +299,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) { - Q_ASSERT(const_alpha > 0); // if const_alpha == 0, this should never be called + Q_ASSERT(const_alpha >= 0); Q_ASSERT(const_alpha < 256); const quint32 *src = (const quint32 *) srcPixels; -- cgit v0.12 From 1209a398c3b59b21b38036fffd4fb2442320e5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 29 Jun 2010 12:51:53 +0200 Subject: Made -graphicssystem trace work with Qt::TextBypassShaping flag. The QPaintBuffer gets the text from the text item in order to stream it. Reviewed-by: Jocelyn Turcotte --- src/gui/painting/qpainter.cpp | 2 +- src/gui/text/qtextengine.cpp | 4 ++-- src/gui/text/qtextengine_p.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 71bc990..2ea6673 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5958,7 +5958,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); } - QTextItemInt gf(glyphs, &d->state->font, fontEngine); + QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine); drawTextItem(p, gf); return; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 60195a8..439f2a4 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2668,9 +2668,9 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo flags |= QTextItem::StrikeOut; } -QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe) +QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe) : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), - num_chars(0), chars(0), logClusters(0), f(font), glyphs(g), fontEngine(fe) + num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) { } diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 908a0ec..e623fa5 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -311,7 +311,7 @@ public: logClusters(0), f(0), fontEngine(0) {} QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat()); - QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe); + QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe); /// copy the structure items, adjusting the glyphs arrays to the right subarrays. /// the width of the returned QTextItemInt is not adjusted, for speed reasons -- cgit v0.12 From 497fd44414dea6314731b96869e2d49bb8b439b5 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 29 Jun 2010 15:10:39 +0200 Subject: Doc: QSettings::sync() imports changes made by other processes. Task-number: QTBUG-5949 Reviewed-by: Morten Engvoldsen --- src/corelib/io/qsettings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 64015ce..f802412 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2274,9 +2274,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, be different instances of your application running at the same time or different applications altogether) to read and write to the same system locations. It uses advisory file locking and a - smart merging algorithm to ensure data integrity. Changes - performed by another process aren't visible in the current - process until sync() is called. + smart merging algorithm to ensure data integrity. Note that sync() + imports changes made by other processes (in addition to writing + the changes from this QSettings). \section1 Platform-Specific Notes -- cgit v0.12 From e47512726bc4dcf23db680f0516fc46a634fcef4 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 30 Jun 2010 16:15:04 +1000 Subject: Fixed ARM .def files. Update for commits fd8e9eadd087d11b0a01d598132ccbb19667fa5a and fb76a872e20bd0df8e7bbe9c039b7f20423c6f12, which add private exports. --- src/s60installs/eabi/QtGuiu.def | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index e7d865b..45be23e 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12020,4 +12020,9 @@ EXPORTS _ZN10QImageData14convertInPlaceEN6QImage6FormatE6QFlagsIN2Qt19ImageConversionFlagEE @ 12019 NONAME _ZN17QRasterPixmapData20createPixmapForImageER6QImage6QFlagsIN2Qt19ImageConversionFlagEEb @ 12020 NONAME _ZN17QRasterPixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12021 NONAME + _ZN15QGraphicsSystem16createPixmapDataEP11QPixmapData @ 12022 NONAME + _ZN17QRasterPixmapData4copyEPK11QPixmapDataRK5QRect @ 12023 NONAME + _ZNK11QPixmapData7toImageERK5QRect @ 12024 NONAME + _ZNK17QRasterPixmapData7toImageERK5QRect @ 12025 NONAME + _ZTV15QGraphicsSystem @ 12026 NONAME -- cgit v0.12 From 8ea60a39a8c4661db505a6dc1342e524ec2e460c Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 30 Jun 2010 12:15:49 +0200 Subject: Fixed a crash in menubar with invisible actions That would happen because the loop to find the next action when navigating with the keyboard was not good enough. Task-number: QTBUG-11823 --- src/gui/widgets/qmenubar.cpp | 2 +- tests/auto/qmenubar/tst_qmenubar.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index aa4ffce..e8e80b7 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -768,7 +768,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c const int start = (_start == -1 && increment == -1) ? actions.count() : _start; const int end = increment == -1 ? 0 : actions.count() - 1; - for (int i = start; start != end;) { + for (int i = start; i != end;) { i += increment; QAction *current = actions.at(i); if (!actionRects.at(i).isNull() && (allowActiveAndDisabled || current->isEnabled())) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 4cb63a1..cc9fb0c 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -168,6 +168,7 @@ private slots: void task256322_highlight(); void menubarSizeHint(); void taskQTBUG4965_escapeEaten(); + void taskQTBUG11823_crashwithInvisibleActions(); #if defined(QT3_SUPPORT) void indexBasedInsertion_data(); @@ -1690,6 +1691,34 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() QTRY_VERIFY(!menubar.isVisible()); } +void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() +{ + QMenuBar menubar; + menubar.setNativeMenuBar(false); //we can't check the geometry of native menubars + + QAction * m = menubar.addAction( "&m" ); + QAction * a = menubar.addAction( "&a" ); + + menubar.show(); + QApplication::setActiveWindow(&menubar); + QTest::qWaitForWindowShown(&menubar); + menubar.setActiveAction(m); + QCOMPARE(menubar.activeAction(), m); + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), a); + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), m); + a->setVisible(false); + + menubar.setActiveAction(m); + QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed + + //it used to crash here because the action is invisible + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed +} + + #if defined(QT3_SUPPORT) void tst_QMenuBar::indexBasedInsertion_data() { -- cgit v0.12 From 0ee2330ec237cf5baeabe4833fb8b6cad503fb7c Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 30 Jun 2010 12:43:52 +0200 Subject: Added textureUpload benchmark to the GL benchmarks --- tests/benchmarks/opengl/main.cpp | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/benchmarks/opengl/main.cpp b/tests/benchmarks/opengl/main.cpp index beb4d43..c042fce 100644 --- a/tests/benchmarks/opengl/main.cpp +++ b/tests/benchmarks/opengl/main.cpp @@ -75,6 +75,10 @@ private slots: void gradients_data(); void gradients(); + void textureUpload_data(); + void textureUpload(); + + private: QGLPixelBuffer *pb; }; @@ -374,6 +378,53 @@ void OpenGLBench::gradients() } } +void OpenGLBench::textureUpload_data() +{ + QTest::addColumn("size"); + QTest::addColumn("flags"); + QTest::addColumn("format"); + + int sizes[] = { 8, 10, 16, 20, 32, 50, 64, 100, 128, 200, 256, 500, 512, 1000, 1024, 2000, 2048, -1 }; + int flags[] = { QGLContext::InternalBindOption, + QGLContext::DefaultBindOption, + -1 }; + int formats[] = { GL_RGB, GL_RGBA, -1 }; + + for (int s = 0; sizes[s] != -1; ++s) { + for (int f = 0; flags[f] != -1; ++f) { + for (int a = 0; formats[a] != -1; ++a) { + QByteArray name; + name.append("size=").append(QByteArray::number(sizes[s])); + name.append(", flags=").append(f == 0 ? "internal" : "default"); + name.append(", format=").append(a == 0 ? "RGB" : "RGBA"); + QTest::newRow(name.constData()) << sizes[s] << flags[f] << formats[a]; + } + } + } +} + +void OpenGLBench::textureUpload() +{ + QFETCH(int, size); + QFETCH(int, flags); + QFETCH(int, format); + + QPixmap pixmap(size, size); + + if (format == GL_RGB) + pixmap.fill(Qt::red); + else + pixmap.fill(Qt::transparent); + + pb->makeCurrent(); + QGLContext *context = const_cast(QGLContext::currentContext()); + QTime time; + + time.start(); + context->bindTexture(pixmap, GL_TEXTURE_2D, format, (QGLContext::BindOptions) flags); + QTest::setBenchmarkResult(time.elapsed(), QTest::WalltimeMilliseconds); +} + QTEST_MAIN(OpenGLBench) #include "main.moc" -- cgit v0.12 From 6ea8ad02e1929f98744f7b18f20fa91223cb4398 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 30 Jun 2010 21:23:23 +1000 Subject: Add missing license header. --- tests/manual/qtabletevent/regular_widgets/main.cpp | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp index e0c53f5..a39e094 100644 --- a/tests/manual/qtabletevent/regular_widgets/main.cpp +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include #include -- cgit v0.12 From 922493a72c033a43f59caebcd8ce7fe060df0d4c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 30 Jun 2010 13:45:52 +0200 Subject: Stopped trying to output QML property list in 2 columns Task-number: QTBUG-11009, QTBUG-11096 --- tools/qdoc3/htmlgenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b93db4f..044c458 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4413,6 +4413,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section, bool twoColumn = false; if (section.members.first()->type() == Node::QmlProperty) { twoColumn = (count >= 5); + twoColumn = false; } if (twoColumn) out() << "\n"; -- cgit v0.12 From c16162214eb8757a62e221c34d38cefc402e5b05 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 29 Jun 2010 17:28:19 +0200 Subject: Add QPixmap::fromImageReader() to decode arbitrary images in place. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decoding in-place with QPixmap::fromData() has limitations, it cannot be used with animated gif images, and the user has no control over the parameters of the image reader. Reader the image directly from the image reader allow us to do a better job when loading images. Reviewed-by: Simon Hausmann Reviewed-by: Samuel Rødal --- src/gui/image/qpixmap.cpp | 23 ++++++++++++++++++++++- src/gui/image/qpixmap.h | 2 ++ src/gui/image/qpixmapdata.cpp | 7 +++++++ src/gui/image/qpixmapdata_p.h | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index fd2c139..ef9be8f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -2018,7 +2018,7 @@ void QPixmap::detach() the color table. If this is too expensive an operation, you can use QBitmap::fromImage() instead. - \sa toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} + \sa fromImageReader(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} */ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { @@ -2033,6 +2033,27 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) } /*! + \fn QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) + + Create a QPixmap from an image read directly from an \a imageReader. + The \a flags argument is a bitwise-OR of the \l{Qt::ImageConversionFlags}. + Passing 0 for \a flags sets all the default options. + + On some systems, reading an image directly to QPixmap can use less memory than + reading a QImage to convert it to QPixmap. + + \sa fromImage(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} +*/ +QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + QScopedPointer data(gs ? gs->createPixmapData(QPixmapData::PixmapType) + : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + data->fromImageReader(imageReader, flags); + return QPixmap(data.take()); +} + +/*! \fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int width, int height) diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 82546da..64ca8a3 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -62,6 +62,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QImageWriter; +class QImageReader; class QColor; class QVariant; class QX11Info; @@ -134,6 +135,7 @@ public: QImage toImage() const; static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + static QPixmap fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags = Qt::AutoColor); bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 345e3cf..ef1f6c4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -124,6 +124,13 @@ static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Q return image; } +void QPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + const QImage image = imageReader->read(); + fromImage(image, flags); +} + bool QPixmapData::fromFile(const QString &fileName, const char *format, Qt::ImageConversionFlags flags) { diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 9a1505a..ec62b0b 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE +class QImageReader; + class Q_GUI_EXPORT QPixmapData { public: @@ -83,6 +85,8 @@ public: virtual void resize(int width, int height) = 0; virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags) = 0; + virtual void fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags); virtual bool fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags); -- cgit v0.12 From 176024dfea7d354451a65b61fa2e82dd422b4dfb Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 29 Jun 2010 19:47:53 +0200 Subject: Add the conversion in-place for QPixmap::fromImageReader() on raster. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since raster uses QImage internal, QPixmap::fromImageReader() can use conversion in-place of the image. This avoid a memory peak during the conversion and is a bit faster. Reviewed-by: Samuel Rødal --- src/gui/image/qpixmap_raster.cpp | 11 ++++ src/gui/image/qpixmap_raster_p.h | 1 + .../designer_indexed8_with_alpha_animated.gif | Bin 0 -> 4138 bytes tests/auto/qpixmap/tst_qpixmap.cpp | 61 +++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index e188745..53f3559 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -152,6 +152,17 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, createPixmapForImage(image, flags, /* inplace = */false); } +void QRasterPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + Q_UNUSED(flags); + QImage image = imageReader->read(); + if (image.isNull()) + return; + + createPixmapForImage(image, flags, /* inplace = */true); +} + // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index a46e054..36a9b2f 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -74,6 +74,7 @@ public: void fromFile(const QString &filename, Qt::ImageConversionFlags flags); bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif new file mode 100644 index 0000000..f813c05 Binary files /dev/null and b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif differ diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 179f068..f22edf6 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,11 @@ private slots: void loadFromDataImage_data(); void loadFromDataImage(); + void fromImageReader_data(); + void fromImageReader(); + + void fromImageReaderAnimatedGif(); + void preserveDepth(); void splash_crash(); @@ -1577,6 +1583,61 @@ void tst_QPixmap::loadFromDataImage() QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); } +void tst_QPixmap::fromImageReader_data() +{ + QTest::addColumn("imagePath"); +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; + QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; + QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png"; + QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png"; + QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; + QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; + QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; +} + +void tst_QPixmap::fromImageReader() +{ + QFETCH(QString, imagePath); + + QImage imageRef(imagePath); + QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef); + + QImageReader imageReader(imagePath); + + QPixmap directLoadingPixmap = QPixmap::fromImageReader(&imageReader); + + QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); +} + +void tst_QPixmap::fromImageReaderAnimatedGif() +{ +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + + QImageReader referenceReader(path); + QImageReader pixmapReader(path); + + Q_ASSERT(referenceReader.canRead()); + Q_ASSERT(referenceReader.imageCount() > 1); + + for (int i = 0; i < referenceReader.imageCount(); ++i) { + QImage refImage = referenceReader.read(); + QPixmap refPixmap = QPixmap::fromImage(refImage); + + QPixmap directLoadingPixmap = QPixmap::fromImageReader(&pixmapReader); + QVERIFY(pixmapsAreEqual(&refPixmap, &directLoadingPixmap)); + } +} + void tst_QPixmap::task_246446() { // This crashed without the bugfix in 246446 -- cgit v0.12 From f141de3daa267c266f67def765adb934138db080 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 30 Jun 2010 13:59:30 +0200 Subject: Adds slowdownFactor to UnifiedTimer in abstract animation The slowdown factor is useful for debugging complex animations. Setting it to 0 will stop all animations when slowMode is enabled. Submitted-by: Lasse Reviewed-by: Thierry --- src/corelib/animation/qabstractanimation.cpp | 11 ++++++++--- src/corelib/animation/qabstractanimation_p.h | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 04342e7..7feb3f7 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -168,7 +168,7 @@ Q_GLOBAL_STATIC(QThreadStorage, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), currentAnimationIdx(0), consistentTiming(false), slowMode(false), - isPauseTimerActive(false), runningLeafAnimations(0) + slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0) { time.invalidate(); } @@ -208,8 +208,13 @@ void QUnifiedTimer::updateAnimationsTime() // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; - if (slowMode) - delta /= 5; + if (slowMode) { + if (slowdownFactor > 0) + delta = qRound(delta / slowdownFactor); + else + delta = 0; + } + lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index fcfe824..6ff18f5 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -145,8 +145,9 @@ public: */ void setConsistentTiming(bool consistent) { consistentTiming = consistent; } - //this facilitates fine-tuning of complex animations + //these facilitate fine-tuning of complex animations void setSlowModeEnabled(bool enabled) { slowMode = enabled; } + void setSlowdownFactor(qreal factor) { slowdownFactor = factor; } /* this is used for updating the currentTime of all animations in case the pause @@ -176,6 +177,12 @@ private: int currentAnimationIdx; bool consistentTiming; bool slowMode; + + // This factor will be used to divide the DEFAULT_TIMER_INTERVAL at each tick + // when slowMode is enabled. Setting it to 0 or higher than DEFAULT_TIMER_INTERVAL (16) + // stops all animations. + qreal slowdownFactor; + // bool to indicate that only pause animations are active bool isPauseTimerActive; -- cgit v0.12 From 38a04b3a8c7a33f1636008e04d58690febcc22f5 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 30 Jun 2010 14:48:11 +0200 Subject: Avoid calling time.elapsed() twice in abstract animation Reviewed-by: Thierry --- src/corelib/animation/qabstractanimation.cpp | 5 +++-- src/corelib/animation/qabstractanimation_p.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 7feb3f7..641b42b 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -205,9 +205,10 @@ void QUnifiedTimer::ensureTimerUpdate() void QUnifiedTimer::updateAnimationsTime() { + qint64 totalElapsed = time.elapsed(); // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? - timingInterval : time.elapsed() - lastTick; + timingInterval : totalElapsed - lastTick; if (slowMode) { if (slowdownFactor > 0) delta = qRound(delta / slowdownFactor); @@ -215,7 +216,7 @@ void QUnifiedTimer::updateAnimationsTime() delta = 0; } - lastTick = time.elapsed(); + lastTick = totalElapsed; //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 6ff18f5..d3d4098 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -172,7 +172,7 @@ private: ElapsedTimer time; - int lastTick; + qint64 lastTick; int timingInterval; int currentAnimationIdx; bool consistentTiming; -- cgit v0.12 From 3a2a6e8746b5076b5b7f496444479fa40067731c Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 30 Jun 2010 14:33:38 +0200 Subject: support BGRA textures on SGX Reviewed-by: Samuel --- src/opengl/qgl.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b4c85ac..adc3aa3 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2331,9 +2331,6 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G && target == GL_TEXTURE_2D && (options & QGLContext::MipmapBindOption)) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - generating mipmaps (%d ms)\n", time.elapsed()); -#endif #if !defined(QT_OPENGL_ES_2) glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); #ifndef QT_OPENGL_ES @@ -2347,6 +2344,9 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif glTexParameterf(target, GL_TEXTURE_MIN_FILTER, options & QGLContext::LinearFilteringBindOption ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - generating mipmaps (%d ms)\n", time.elapsed()); +#endif } else { glTexParameterf(target, GL_TEXTURE_MIN_FILTER, filtering); } @@ -2371,7 +2371,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (premul) { img = img.convertToFormat(target_format = QImage::Format_ARGB32_Premultiplied); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting ARGB32 -> ARGB32_Premultiplied (%d ms) \n", time.elapsed()); + printf(" - converted ARGB32 -> ARGB32_Premultiplied (%d ms) \n", time.elapsed()); #endif } break; @@ -2379,7 +2379,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (!premul) { img = img.convertToFormat(target_format = QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); + printf(" - converted ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); #endif } break; @@ -2396,20 +2396,17 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting to 32-bit alpha format (%d ms)\n", time.elapsed()); + printf(" - converted to 32-bit alpha format (%d ms)\n", time.elapsed()); #endif } else { img = img.convertToFormat(QImage::Format_RGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting to 32-bit (%d ms)\n", time.elapsed()); + printf(" - converted to 32-bit (%d ms)\n", time.elapsed()); #endif } } if (options & QGLContext::InvertedYBindOption) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - flipping bits over y (%d ms)\n", time.elapsed()); -#endif if (img.isDetached()) { int ipl = img.bytesPerLine() / 4; int h = img.height(); @@ -2426,17 +2423,20 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G // data twice. This version should only do it once. img = img.mirrored(); } +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - flipped bits over y (%d ms)\n", time.elapsed()); +#endif } if (externalFormat == GL_RGBA) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - doing byte swapping (%d ms)\n", time.elapsed()); -#endif // The only case where we end up with a depth different from // 32 in the switch above is for the RGB16 case, where we set // the format to GL_RGB Q_ASSERT(img.depth() == 32); qgl_byteSwapImage(img, pixel_type); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - did byte swapping (%d ms)\n", time.elapsed()); +#endif } #ifdef QT_OPENGL_ES // OpenGL/ES requires that the internal and external formats be @@ -2465,7 +2465,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifdef QGL_BIND_TEXTURE_DEBUG static int totalUploadTime = 0; totalUploadTime += time.elapsed(); - printf(" - upload done in (%d ms) time=%d\n", time.elapsed(), totalUploadTime); + printf(" - upload done in %d ms, (accumulated: %d ms)\n", time.elapsed(), totalUploadTime); #endif @@ -5161,6 +5161,8 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= NVFloatBuffer; if (extensions.match("GL_ARB_pixel_buffer_object")) glExtensions |= PixelBufferObject; + if (extensions.match("GL_IMG_texture_format_BGRA8888")) + glExtensions |= BGRATextureFormat; #if defined(QT_OPENGL_ES_2) glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; -- cgit v0.12 From 7d80cd1f66fa6331c926674870d2a0dbe2921e77 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 30 Jun 2010 16:57:41 +0200 Subject: Fixes the documentation of QGraphicsEffect::update(). Reflects now the real behavior of this function. Related to a false bug report (QT-3481). Reviewed-by: sroedal --- src/gui/effects/qgraphicseffect.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 5e4e49e..0029017 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -488,13 +488,10 @@ void QGraphicsEffect::setEnabled(bool enable) */ /*! - Schedules a redraw of the source. Call this function whenever the source - needs to be redrawn. - - This convenience function is equivalent to calling - QGraphicsEffectSource::update(). + Schedules a redraw of the effect. Call this function whenever the effect + needs to be redrawn. This function does not trigger a redraw of the source. - \sa updateBoundingRect(), QGraphicsEffectSource::update() + \sa updateBoundingRect() */ void QGraphicsEffect::update() { -- cgit v0.12 From 38153cd6e94645ea21d037b2153d0b697c094949 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 01:01:59 +1000 Subject: Minor Twitter demo enhancements First time I actually use it to tweet and I find two bugs... --- demos/declarative/twitter/TwitterCore/AuthView.qml | 1 + demos/declarative/twitter/TwitterCore/HomeTitleBar.qml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml index ef10258..4f75777 100644 --- a/demos/declarative/twitter/TwitterCore/AuthView.qml +++ b/demos/declarative/twitter/TwitterCore/AuthView.qml @@ -93,6 +93,7 @@ Item { color: "#151515"; selectionColor: "green" KeyNavigation.tab: login KeyNavigation.backtab: nameIn + onAccepted: login.doLogin(); } } } diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 52164ed..b26f7b3 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -128,7 +128,7 @@ Item { cursorVisible: true; font.bold: true width: parent.width - 12 height: parent.height - 8 - font.pointSize: 10 + font.pixelSize: 12 wrapMode: TextEdit.Wrap color: "#151515"; selectionColor: "green" } -- cgit v0.12 From 01648005f1f546dc0281155fecd94b4f47a94584 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 30 Jun 2010 15:52:20 +0200 Subject: Moc: fix compilation when templated types with multiple arguments are used. Each template argument need to be normalized separately. Else, the const type of one argument may end up moved in the first argument. (And then the compilation of the generated moc file would fail as the types would not match) Reviewed-by: Kent Hansen Task-number: QTBUG-11647 --- src/corelib/kernel/qmetaobject_p.h | 11 +++++++---- tests/auto/moc/tst_moc.cpp | 19 +++++++++++++++++++ tests/auto/qmetaobject/tst_qmetaobject.cpp | 2 ++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index b538787..4a03874 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -276,12 +276,15 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc ++templdepth; if (c == '>') --templdepth; - if (templdepth == 0) { + if (templdepth == 0 || (templdepth == 1 && c == ',')) { result += normalizeTypeInternal(tt, t-1, fixScope, false); result += c; - if (*t == '>') - result += ' '; // avoid >> - break; + if (templdepth == 0) { + if (*t == '>') + result += ' '; // avoid >> + break; + } + tt = t; } } } diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index a56d842..19f3677 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -1322,6 +1322,25 @@ public slots: void foo(struct const_ *) {}; }; + +template +class TestTemplate2 +{ +}; + +class QTBUG11647_constInTemplateParameter : public QObject +{ Q_OBJECT +public slots: + void testSlot(TestTemplate2) {} + void testSlot2(TestTemplate2) {} + void testSlot3(TestTemplate2 const *, + TestTemplate2< TestTemplate2 < void, int > , unsigned char *> > ) {} + +signals: + void testSignal(TestTemplate2); +}; + + QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index b6d4558..62416b1 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -740,6 +740,8 @@ void tst_QMetaObject::normalizedType_data() QTest::newRow("template5") << "QList< ::Foo::Bar>" << "QList< ::Foo::Bar>"; QTest::newRow("template6") << "QList<::Foo::Bar>" << "QList<::Foo::Bar>"; QTest::newRow("template7") << "QList >" << "QList >"; + QTest::newRow("template8") << "QMap" << "QMap"; + QTest::newRow("template9") << "QPair , QPair > >" << "QPair,QPair > >"; QTest::newRow("value1") << "const QString &" << "QString"; QTest::newRow("value2") << "QString const &" << "QString"; QTest::newRow("constInName1") << "constconst" << "constconst"; -- cgit v0.12 From 6a218a31de60ea6f3f75fb6df014ef7323a264d6 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 30 Jun 2010 18:59:14 +0200 Subject: Export various symbols needed to make a custom GL graphicssystem. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/gui/painting/qgraphicssystem_runtime_p.h | 2 +- src/opengl/qgl_p.h | 2 +- src/opengl/qglextensions_p.h | 2 +- src/opengl/qwindowsurface_gl_p.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 101a8e7..7aab89c 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QRuntimeGraphicsSystem; -class QRuntimePixmapData : public QPixmapData { +class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData { public: QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type); ~QRuntimePixmapData(); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b57972c..34a6b7c 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -415,7 +415,7 @@ public: #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) static QGLExtensionFuncs qt_extensionFuncs; - static QGLExtensionFuncs& extensionFuncs(const QGLContext *); + static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *); #endif static void setCurrentContext(QGLContext *context); diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 7597b33..6259cca 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -882,7 +882,7 @@ bool qt_resolve_frag_program_extensions(QGLContext *ctx); bool qt_resolve_glsl_extensions(QGLContext *ctx); #ifndef QT_NO_EGL -bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx); +Q_OPENGL_EXPORT bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx); #endif QT_END_NAMESPACE diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 624236c..5e670fe 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -66,6 +66,8 @@ class QRegion; class QWidget; struct QGLWindowSurfacePrivate; +Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget(); + class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice { public: -- cgit v0.12 From 5eefab7dfaf11c2c53c1fa856b6ed94b39d5a688 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 22 Jun 2010 18:14:42 +0200 Subject: Use built-in iconv on Solaris if available Task-number: QTBUG-1853 Reviewed-by: Thiago --- config.tests/unix/sun-libiconv/sun-libiconv.pro | 2 ++ configure | 3 +++ src/corelib/codecs/codecs.pri | 4 ++++ 3 files changed, 9 insertions(+) create mode 100644 config.tests/unix/sun-libiconv/sun-libiconv.pro diff --git a/config.tests/unix/sun-libiconv/sun-libiconv.pro b/config.tests/unix/sun-libiconv/sun-libiconv.pro new file mode 100644 index 0000000..00df865 --- /dev/null +++ b/config.tests/unix/sun-libiconv/sun-libiconv.pro @@ -0,0 +1,2 @@ +SOURCES = ../gnu-libiconv/gnu-libiconv.cpp +CONFIG -= qt dylib app_bundle diff --git a/configure b/configure index 7f6d43b..4650229 100755 --- a/configure +++ b/configure @@ -5154,6 +5154,8 @@ if [ "$CFG_ICONV" != "no" ]; then CFG_ICONV=no elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then CFG_ICONV=yes + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/sun-libiconv" "SUN libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then + CFG_ICONV=sun elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then CFG_ICONV=gnu else @@ -6675,6 +6677,7 @@ fi [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis" [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups" [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv" +[ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv" [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv" [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib" [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer" diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index c572e08..46d7dd4 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -31,6 +31,10 @@ unix { DEFINES += GNU_LIBICONV !mac:LIBS_PRIVATE *= -liconv + } else:contains(QT_CONFIG,sun-libiconv) { + HEADERS += codecs/qiconvcodec_p.h + SOURCES += codecs/qiconvcodec.cpp + DEFINES += GNU_LIBICONV } else:!symbian { # no iconv, so we put all plugins in the library HEADERS += \ -- cgit v0.12 From 0e7f70bb44eae2798c7f2198b713dc1c6ab6f652 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Jul 2010 12:11:15 +1000 Subject: docs - quote code with snippets, other improvements --- doc/src/declarative/qdeclarativemodels.qdoc | 163 ++++++++++----------- .../declarative/visualdatamodel_rootindex/view.qml | 2 +- .../modelviews/objectlistmodel/dataobject.h | 4 + .../modelviews/objectlistmodel/main.cpp | 9 +- .../modelviews/objectlistmodel/view.qml | 18 +-- .../modelviews/stringlistmodel/main.cpp | 5 +- .../modelviews/stringlistmodel/view.qml | 16 +- .../graphicsitems/qdeclarativelistview.cpp | 2 +- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 6 + 9 files changed, 116 insertions(+), 109 deletions(-) diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 7671eb3..0d25da5 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -30,18 +30,46 @@ \target qmlmodels \title Data Models -Some QML Items use Data Models to provide the data to be displayed. +Some QML items use Data Models to provide the data to be displayed. These items typically require a \e delegate component that creates an instance for each item in the model. Models may be static, or have items modified, inserted, removed or moved dynamically. Data is provided to the delegate via named data roles which the -delegate may bind to. The roles are exposed as properties of the -\e model context property, though this property is set as a default property -of the delegate so, unless there is a naming clash with a -property in the delegate, the roles are usually accessed unqualified. The -example below would have a clash between the \e color role of the model and -the \e color property of the Rectangle. The clash is avoided by referencing +delegate may bind to. Here is a ListModel with two roles, \e type and \e age, +and a ListView with a delegate that binds to these roles to display their +values: + +\qml +import Qt 4.7 + +Item { + width: 200; height: 250 + + ListModel { + id: myModel + ListElement { type: "Dog"; age: 8 } + ListElement { type: "Cat"; age: 5 } + } + + Component { + id: myDelegate + Text { text: type + ", " + age } + } + + ListView { + anchors.fill: parent + model: myModel + delegate: myDelegate + } +} +\endqml + +If there is a naming clash between the model's properties and the delegate's +properties (e.g. if the \l Text delegate above had \e type or \e age properties) +the roles can be accessed with the qualified \e model name instead. +For example, the following model has a \e color role which clashes with the +delegate \l Rectangle's \e color property. The clash is avoided by referencing the \e color property of the model by its full name: \e model.color. \code @@ -61,7 +89,7 @@ Component { \endcode A special \e index role containing the index of the item in the model -is also available. +is also available to the delegate. \e Note: the index role will be set to -1 if the item is removed from the model. If you bind to the index role, be sure that the logic @@ -148,9 +176,9 @@ Item { } \endcode -When the MouseArea is clicked fruitModel will have two roles, "cost" and "name". +When the MouseArea is clicked, \c fruitModel will have two roles, "cost" and "name". Even if subsequent roles are added, only the first two will be handled by views -using the model. +using the model. To reset the roles available in the model, call ListModel::clear(). \section2 XmlListModel @@ -170,6 +198,9 @@ XmlListModel { } \endcode +The \l{declarative/demos/rssnews}{RSS News demo} shows how XmlListModel can +be used to display an RSS feed. + \section2 VisualItemModel @@ -230,9 +261,9 @@ ctxt->setContextProperty("myModel", model); or by registering the subclass as a new QML type in a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}. -QAbstractItemModel presents a heirachy of tables, but views currently provided by QML +QAbstractItemModel presents a hierarchy of tables, but views currently provided by QML can only display list data. -In order to display child lists of a heirachical model +In order to display child lists of a hierarchical model the VisualDataModel element provides several properties and functions for use with models of type QAbstractItemModel: \list @@ -245,101 +276,60 @@ with models of type QAbstractItemModel: \section2 QStringList -A model may be a simple QStringList, which provides the contents of the list via the \e modelData role: +A model may be a simple QStringList, which provides the contents of the list via the \e modelData role. -\table -\row -\o -\code -// main.cpp -QStringList dataList; -dataList.append("Fred"); -dataList.append("Ginger"); -dataList.append("Skipper"); +Here is a ListView with a delegate that references its model item's +value using the \c modelData role: -QDeclarativeContext *ctxt = view.rootContext(); -ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); -\endcode +\snippet examples/declarative/modelviews/stringlistmodel/view.qml 0 -\o -\code -// main.qml -ListView { - width: 100 - height: 100 - anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - Text { text: modelData } - } - } -} -\endcode -\endtable +A Qt application can load this QML document and set the value of \c myModel +to a QStringList: + +\snippet examples/declarative/modelviews/stringlistmodel/main.cpp 0 -The complete example is available in \l {declarative/modelviews/stringlistmodel}. +The complete example is available in Qt's \l {declarative/modelviews/stringlistmodel}{examples/declarative/modelviews/stringlistmodel} directory. \note There is no way for the view to know that the contents of a QStringList -have changed. If the QStringList is changed, it will be necessary to reset +have changed. If the QStringList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. \section2 QList -QList provides the properties of the objects in the list as roles. - -\code -class DataObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QString color READ color WRITE setColor) -... -}; +A list of QObject* values can also be used as a model. A QList provides +the properties of the objects in the list as roles. -QList dataList; -dataList.append(new DataObject("Item 1", "red")); -dataList.append(new DataObject("Item 2", "green")); -dataList.append(new DataObject("Item 3", "blue")); -dataList.append(new DataObject("Item 4", "yellow")); +The following application creates a \c DataObject class that with +Q_PROPERTY values that will be accessible as named roles when a +QList is exposed to QML: -QDeclarativeContext *ctxt = view.rootContext(); -ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); -\endcode +\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 0 +\dots 4 +\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 1 +\codeline +\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 0 +\dots 4 +\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 1 +\dots 4 +\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 2 The QObject* is available as the \c modelData property. As a convenience, the properties of the object are also made available directly in the -delegate's context: - -\code -ListView { - width: 100 - height: 100 - anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - color: model.modelData.color - Text { text: name } - } - } -} -\endcode +delegate's context. Here, \c view.qml references the \c DataModel properties in +the ListView delegate: -The complete example is available in \l {declarative/modelviews/objectlistmodel}. +\snippet examples/declarative/modelviews/objectlistmodel/view.qml 0 Note the use of the fully qualified access to the \c color property. The properties of the object are not replicated in the \c model object, since they are easily available via the modelData object. +The complete example is available in Qt's \l {declarative/modelviews/objectlistmodel}{examples/declarative/modelviews/objectlistmodel} directory. + Note: There is no way for the view to know that the contents of a QList -have changed. If the QList is changed, it will be necessary to reset +have changed. If the QList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. @@ -354,8 +344,7 @@ There are no data roles. The following example creates a ListView with five elements: \code Item { - width: 200 - height: 250 + width: 200; height: 250 Component { id: itemDelegate @@ -374,7 +363,7 @@ Item { \section2 An Object Instance -An Object Instance specifies a model with a single Object element. The +An Object instance specifies a model with a single Object element. The properties of the object are provided as roles. The example below creates a list with one item, showing the color of the @@ -383,6 +372,8 @@ to avoid clashing with \e color property of the Text element in the delegate. \code Rectangle { + width: 200; height: 250 + Text { id: myText text: "Hello" diff --git a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml index 835ca32..9e759f9 100644 --- a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml +++ b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml @@ -55,7 +55,7 @@ ListView { MouseArea { anchors.fill: parent onClicked: { - if (hasModelChildren) + if (model.hasModelChildren) view.model.rootIndex = view.model.modelIndex(index) } } diff --git a/examples/declarative/modelviews/objectlistmodel/dataobject.h b/examples/declarative/modelviews/objectlistmodel/dataobject.h index c61e50c..17aa355 100644 --- a/examples/declarative/modelviews/objectlistmodel/dataobject.h +++ b/examples/declarative/modelviews/objectlistmodel/dataobject.h @@ -43,12 +43,14 @@ #include +//![0] class DataObject : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged) +//![0] public: DataObject(QObject *parent=0); @@ -67,6 +69,8 @@ signals: private: QString m_name; QString m_color; +//![1] }; +//![1] #endif // DATAOBJECT_H diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/declarative/modelviews/objectlistmodel/main.cpp index 25de8d1..8c921b7 100644 --- a/examples/declarative/modelviews/objectlistmodel/main.cpp +++ b/examples/declarative/modelviews/objectlistmodel/main.cpp @@ -53,24 +53,29 @@ model in QML */ +//![0] int main(int argc, char ** argv) { +//![0] QApplication app(argc, argv); - QDeclarativeView view; - +//![1] QList dataList; dataList.append(new DataObject("Item 1", "red")); dataList.append(new DataObject("Item 2", "green")); dataList.append(new DataObject("Item 3", "blue")); dataList.append(new DataObject("Item 4", "yellow")); + QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); view.setSource(QUrl("qrc:view.qml")); view.show(); +//![1] return app.exec(); +//![2] } +//![2] diff --git a/examples/declarative/modelviews/objectlistmodel/view.qml b/examples/declarative/modelviews/objectlistmodel/view.qml index 034121c..c3cccdd 100644 --- a/examples/declarative/modelviews/objectlistmodel/view.qml +++ b/examples/declarative/modelviews/objectlistmodel/view.qml @@ -40,17 +40,17 @@ import Qt 4.7 +//![0] ListView { - width: 100 - height: 100 + width: 100; height: 100 anchors.fill: parent + model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - color: model.modelData.color - Text { text: name } - } + delegate: Rectangle { + height: 25 + width: 100 + color: model.modelData.color + Text { text: name } } } +//![0] diff --git a/examples/declarative/modelviews/stringlistmodel/main.cpp b/examples/declarative/modelviews/stringlistmodel/main.cpp index b2ebd4b..ea73859 100644 --- a/examples/declarative/modelviews/stringlistmodel/main.cpp +++ b/examples/declarative/modelviews/stringlistmodel/main.cpp @@ -56,19 +56,20 @@ int main(int argc, char ** argv) { QApplication app(argc, argv); - QDeclarativeView view; - +//![0] QStringList dataList; dataList.append("Item 1"); dataList.append("Item 2"); dataList.append("Item 3"); dataList.append("Item 4"); + QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); view.setSource(QUrl("qrc:view.qml")); view.show(); +//![0] return app.exec(); } diff --git a/examples/declarative/modelviews/stringlistmodel/view.qml b/examples/declarative/modelviews/stringlistmodel/view.qml index ec5597d..3d789fd 100644 --- a/examples/declarative/modelviews/stringlistmodel/view.qml +++ b/examples/declarative/modelviews/stringlistmodel/view.qml @@ -39,17 +39,17 @@ ****************************************************************************/ import Qt 4.7 +//![0] ListView { - width: 100 - height: 100 + width: 100; height: 100 anchors.fill: parent + model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { text: modelData } - } + delegate: Rectangle { + height: 25 + width: 100 + Text { text: modelData } } } +//![0] diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 4be8705..e519bd9 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1395,7 +1395,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa ListModel, GridView, {declarative/modelviews/listview}{ListView examples} + \sa {Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 8071d7a..786d6f9 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -818,6 +818,12 @@ void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate) \c view.qml: \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml 0 + If the \l model is a QAbstractItemModel subclass, the delegate can also + reference a \c hasModelChildren property (optionally qualified by a + \e model. prefix) that indicates whether the delegate's model item has + any child nodes. + + \sa modelIndex(), parentModelIndex() */ QVariant QDeclarativeVisualDataModel::rootIndex() const -- cgit v0.12 From 3084b54e7a4f6163dadcf3e52143391b10b5352e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Jul 2010 16:32:30 +1000 Subject: Add abstractitemmodel example, and fix some model docs --- doc/src/declarative/examples.qdoc | 7 +- doc/src/declarative/qdeclarativemodels.qdoc | 264 ++++++++++++--------- doc/src/examples/qml-examples.qdoc | 15 +- doc/src/images/qml-abstractitemmodel-example.png | Bin 0 -> 4478 bytes .../abstractitemmodel/abstractitemmodel.pro | 8 + .../abstractitemmodel/abstractitemmodel.qrc | 6 + .../modelviews/abstractitemmodel/main.cpp | 66 ++++++ .../modelviews/abstractitemmodel/model.cpp | 88 +++++++ .../modelviews/abstractitemmodel/model.h | 83 +++++++ .../modelviews/abstractitemmodel/view.qml | 51 ++++ .../modelviews/objectlistmodel/main.cpp | 6 +- .../modelviews/stringlistmodel/main.cpp | 2 +- 12 files changed, 469 insertions(+), 127 deletions(-) create mode 100644 doc/src/images/qml-abstractitemmodel-example.png create mode 100644 examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro create mode 100644 examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc create mode 100644 examples/declarative/modelviews/abstractitemmodel/main.cpp create mode 100644 examples/declarative/modelviews/abstractitemmodel/model.cpp create mode 100644 examples/declarative/modelviews/abstractitemmodel/model.h create mode 100644 examples/declarative/modelviews/abstractitemmodel/view.qml diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 7b02d33..587cdf2 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -168,11 +168,14 @@ The examples can be found in Qt's \c examples/declarative directory. \list \o \l{declarative/modelviews/gridview}{GridView} \o \l{declarative/modelviews/listview}{ListView} -\o \l{declarative/modelviews/objectlistmodel}{Object ListModel} \o \l{declarative/modelviews/package}{Package} \o \l{declarative/modelviews/parallax}{Parallax} -\o \l{declarative/modelviews/stringlistmodel}{String ListModel} \o \l{declarative/modelviews/visualitemmodel}{VisualItemModel} + +\o \l{declarative/modelviews/stringlistmodel}{String ListModel} +\o \l{declarative/modelviews/objectlistmodel}{Object ListModel} +\o \l{declarative/modelviews/abstractitemmodel}{AbstractItemModel} + \o \l{declarative/modelviews/webview}{WebView} \endlist diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 0d25da5..b44e6f2 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -30,7 +30,8 @@ \target qmlmodels \title Data Models -Some QML items use Data Models to provide the data to be displayed. +QML items such as ListView, GridView and \l Repeater require Data Models +that provide the data to be displayed. These items typically require a \e delegate component that creates an instance for each item in the model. Models may be static, or have items modified, inserted, removed or moved dynamically. @@ -66,55 +67,30 @@ Item { \endqml If there is a naming clash between the model's properties and the delegate's -properties (e.g. if the \l Text delegate above had \e type or \e age properties) -the roles can be accessed with the qualified \e model name instead. -For example, the following model has a \e color role which clashes with the -delegate \l Rectangle's \e color property. The clash is avoided by referencing -the \e color property of the model by its full name: \e model.color. - -\code -ListModel { - id: myModel - ListElement { color: "red" } - ListElement { color: "green" } -} - -Component { - id: myDelegate - Rectangle { - width: 20; height: 20 - color: model.color - } -} -\endcode +properties, the roles can be accessed with the qualified \e model name instead. +For example, if a \l Text element had \e type or \e age properties, the text in the +above example would display those property values instead of the \e type and \e age values +from the model item. In this case, the properties could have been referenced as +\c model.type and \c model.age instead to ensure the delegate displays the +property values from the model item. A special \e index role containing the index of the item in the model -is also available to the delegate. - -\e Note: the index role will be set to -1 if the item is removed from +is also available to the delegate. Note this index is set to -1 if the item is removed from the model. If you bind to the index role, be sure that the logic accounts for the possibility of index being -1, i.e. that the item -is no longer valid. Usually the item will shortly be destroyed, but -it is possible to delay delegate destruction in some views via a delayRemove -attached property. +is no longer valid. (Usually the item will shortly be destroyed, but +it is possible to delay delegate destruction in some views via a \c delayRemove +attached property.) -Models that do not have named roles will have the data provided via -the \e modelData role. The \e modelData role is also provided for -Models that have only one role. In this case the \e modelData role +Models that do not have named roles (such as the QStringList model shown below) +will have the data provided via the \e modelData role. The \e modelData role is also provided for +models that have only one role. In this case the \e modelData role contains the same data as the named role. -There are a number of QML elements that operate using data models: - -\list -\o ListView -\o GridView -\o PathView -\o \l Repeater -\endlist +QML provides several types of data models among the built-in set of +QML elements. In addition, models can be created with C++ and then +made available to QML components. -QML supports several types of data model, which may be provided by QML -or C++ (via QDeclarativeContext::setContextProperty() or as plugin types, -for example). \section1 QML Data Models @@ -126,6 +102,7 @@ available roles are specified by the \l ListElement properties. \code ListModel { id: fruitModel + ListElement { name: "Apple" cost: 2.45 @@ -145,30 +122,26 @@ The above model has two roles, \e name and \e cost. These can be bound to by a ListView delegate, for example: \code -Component { - id: fruitDelegate - Row { +ListView { + width: 200; height: 250 + model: fruitModel + delegate: Row { Text { text: "Fruit: " + name } Text { text: "Cost: $" + cost } } } -ListView { - model: fruitModel - delegate: fruitDelegate -} \endcode -It is also possible to manipulate the ListModel directly via JavaScript. -In this case, the first item inserted will determine the roles available -to any views using the model. For example, if an empty ListModel is -created and populated via JavaScript the roles provided by the first +ListModel provides methods to manipulate the ListModel directly via JavaScript. +In this case, the first item inserted determines the roles available +to any views that are using the model. For example, if an empty ListModel is +created and populated via JavaScript, the roles provided by the first insertion are the only roles that will be shown in the view: \code Item { - ListModel { - id: fruitModel - } + ListModel { id: fruitModel } + MouseArea { anchors.fill: parent onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"}) @@ -176,7 +149,7 @@ Item { } \endcode -When the MouseArea is clicked, \c fruitModel will have two roles, "cost" and "name". +When the MouseArea is clicked, \c fruitModel will have two roles, \e cost and \e name. Even if subsequent roles are added, only the first two will be handled by views using the model. To reset the roles available in the model, call ListModel::clear(). @@ -198,14 +171,17 @@ XmlListModel { } \endcode -The \l{declarative/demos/rssnews}{RSS News demo} shows how XmlListModel can +The \l{demos/declarative/rssnews}{RSS News demo} shows how XmlListModel can be used to display an RSS feed. \section2 VisualItemModel -VisualItemModel allows QML items to be provided as a model. This model contains -both the data and delegate (its child items). This model does not provide any roles. +VisualItemModel allows QML items to be provided as a model. + +This model contains both the data and delegate; the child items of a +VisualItemModel provide the contents of the delegate. The model +does not provide any roles. \code VisualItemModel { @@ -228,51 +204,11 @@ will be positioned by the view. \section1 C++ Data Models -Models defined in C++ can be made available to QML either from a C++ application or from a -\l{QDeclarativeExtensionPlugin}{QML C++ plugin}. - -\section2 QAbstractItemModel - -A model can be defined by subclassing QAbstractItemModel. - -QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method. -The default role names set by Qt are: - -\table -\header -\o Qt Role -\o QML Role Name -\row -\o Qt::DisplayRole -\o display -\row -\o Qt::DecorationRole -\o decoration -\endtable - -The model could be made available to QML either directly: - -\code -QDeclarativeContext *ctxt = view.rootContext(); -MyModel *model = new MyModel; // subclass of QAbstractItemModel -ctxt->setContextProperty("myModel", model); -\endcode - -or by registering the subclass as a new QML type in -a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}. - -QAbstractItemModel presents a hierarchy of tables, but views currently provided by QML -can only display list data. -In order to display child lists of a hierarchical model -the VisualDataModel element provides several properties and functions for use -with models of type QAbstractItemModel: -\list -\o \e hasModelChildren role property to determine whether a node has child nodes. -\o \l VisualDataModel::rootIndex allows the root node to be specifed -\o \l VisualDataModel::modelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex -\o \l VisualDataModel::parentModelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex -\endlist +Models can be defined in C++ and then made available to QML. This is useful +for exposing existing C++ data models or otherwise complex datasets to QML. +A C++ model class can be defined as a QStringList, a QList or a +QAbstractItemModel. \section2 QStringList @@ -309,10 +245,7 @@ QList is exposed to QML: \snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 1 \codeline \snippet examples/declarative/modelviews/objectlistmodel/main.cpp 0 -\dots 4 -\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 1 -\dots 4 -\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 2 +\dots The QObject* is available as the \c modelData property. As a convenience, the properties of the object are also made available directly in the @@ -323,7 +256,7 @@ the ListView delegate: Note the use of the fully qualified access to the \c color property. The properties of the object are not replicated in the \c model -object, since they are easily available via the modelData +object, since they are easily available via the \c modelData object. The complete example is available in Qt's \l {declarative/modelviews/objectlistmodel}{examples/declarative/modelviews/objectlistmodel} directory. @@ -333,13 +266,115 @@ have changed. If the QList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. +\section2 QAbstractItemModel + +A model can be defined by subclassing QAbstractItemModel. + +The roles of a QAbstractItemModel subclass can be exposed to QML by calling +QAbstractItemModel::setRoleNames(). The default role names set by Qt are: + +\table +\header +\o Qt Role +\o QML Role Name +\row +\o Qt::DisplayRole +\o display +\row +\o Qt::DecorationRole +\o decoration +\endtable + +Here is an application with a QAbstractListModel subclass named \c AnimalModel +that has \e type and \e size roles. It calls QAbstractItemModel::setRoleNames() to set the +role names for accessing the properties via QML: + +\snippet examples/declarative/modelviews/abstractitemmodel/model.h 0 +\dots +\snippet examples/declarative/modelviews/abstractitemmodel/model.h 1 +\dots +\snippet examples/declarative/modelviews/abstractitemmodel/model.h 2 +\codeline +\snippet examples/declarative/modelviews/abstractitemmodel/model.cpp 0 +\codeline +\snippet examples/declarative/modelviews/abstractitemmodel/main.cpp 0 +\dots + +This model is displayed by a ListView delegate that accesses the \e type and \e size +roles: + +\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0 + +The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory. + +QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML +can only display list data. +In order to display child lists of a hierarchical model +the VisualDataModel element provides several properties and functions for use +with models of type QAbstractItemModel: + +\list +\o \e hasModelChildren role property to determine whether a node has child nodes. +\o \l VisualDataModel::rootIndex allows the root node to be specifed +\o \l VisualDataModel::modelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex +\o \l VisualDataModel::parentModelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex +\endlist + + +\section2 Exposing C++ data models to QML + +The above examples use QDeclarativeContext::setContextProperty() to set +model values directly in QML components. An alternative to this is to +register the C++ model class as a QML type from a QML C++ plugin using +QDeclarativeExtensionPlugin. This would allow the model classes to be +created directly as elements within QML: + +\table +\row + +\o +\code +class MyModelPlugin : public QDeclarativeExtensionPlugin +{ +public: + void registerTypes(const char *uri) + { + qmlRegisterType(uri, 1, 0, + "MyModel"); + } +} + +Q_EXPORT_PLUGIN2(mymodelplugin, MyModelPlugin); +\endcode + +\o +\qml +MyModel { + id: myModel + ListElement { someProperty: "some value" } +} + +ListView { + width: 200; height: 250 + model: myModel + delegate: Text { text: someProperty } +} +\endqml + +\endtable + +See \l {Tutorial: Writing QML extensions with C++} for details on writing QML C++ +plugins. + + + \section1 Other Data Models \section2 An Integer -An Integer specifies a model containing the integer number of elements. -There are no data roles. +An integer can be used to specify a model that contains a certain number +of elements. In this case, the model does not have any data roles. The following example creates a ListView with five elements: \code @@ -363,7 +398,7 @@ Item { \section2 An Object Instance -An Object instance specifies a model with a single Object element. The +An object instance can be used to specify a model with a single object element. The properties of the object are provided as roles. The example below creates a list with one item, showing the color of the @@ -382,10 +417,9 @@ Rectangle { Component { id: myDelegate - Text { - text: model.color - } + Text { text: model.color } } + ListView { anchors.fill: parent anchors.topMargin: 30 diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 211ee4b..c8a7403 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -252,6 +252,15 @@ */ /*! + \title Models and Views: AbstractItemModel + \example declarative/modelviews/abstractitemmodel + + This example shows how to use a QAbstractItemModel subclass as a model in QML. + + \image qml-abstractitemmodel-example.png +*/ + +/*! \title Models and Views: GridView \example declarative/modelviews/gridview @@ -306,8 +315,7 @@ \title Models and Views: Object ListModel \example declarative/modelviews/objectlistmodel - This example shows how to create a C++ extension that exposes a - QList as a model in QML. + This example shows how to use a QList as a model in QML. \image qml-objectlistmodel-example.png */ @@ -334,8 +342,7 @@ \title Models and Views: String ListModel \example declarative/modelviews/stringlistmodel - This example shows how to create a C++ extension that exposes a - QStringList as a model in QML. + This example shows how to use a QStringList as a model in QML. \image qml-stringlistmodel-example.png */ diff --git a/doc/src/images/qml-abstractitemmodel-example.png b/doc/src/images/qml-abstractitemmodel-example.png new file mode 100644 index 0000000..1d7ff19 Binary files /dev/null and b/doc/src/images/qml-abstractitemmodel-example.png differ diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro new file mode 100644 index 0000000..55e67f3 --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += declarative + +RESOURCES += abstractitemmodel.qrc + +HEADERS = model.h +SOURCES = main.cpp model.cpp diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc new file mode 100644 index 0000000..4ae861c --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc @@ -0,0 +1,6 @@ + + + view.qml + + + diff --git a/examples/declarative/modelviews/abstractitemmodel/main.cpp b/examples/declarative/modelviews/abstractitemmodel/main.cpp new file mode 100644 index 0000000..e869aba --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "model.h" +#include +#include + +#include + +//![0] +int main(int argc, char ** argv) +{ + QApplication app(argc, argv); + + AnimalModel model; + model.addAnimal(Animal("Wolf", "Medium")); + model.addAnimal(Animal("Polar bear", "Large")); + model.addAnimal(Animal("Quoll", "Small")); + + QDeclarativeView view; + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("myModel", &model); +//![0] + + view.setSource(QUrl("qrc:view.qml")); + view.show(); + + return app.exec(); +} + diff --git a/examples/declarative/modelviews/abstractitemmodel/model.cpp b/examples/declarative/modelviews/abstractitemmodel/model.cpp new file mode 100644 index 0000000..d0e0971 --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/model.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "model.h" + +Animal::Animal(const QString &type, const QString &size) + : m_type(type), m_size(size) +{ +} + +QString Animal::type() const +{ + return m_type; +} + +QString Animal::size() const +{ + return m_size; +} + +//![0] +AnimalModel::AnimalModel(QObject *parent) + : QAbstractListModel(parent) +{ + QHash roles; + roles[TypeRole] = "type"; + roles[SizeRole] = "size"; + setRoleNames(roles); +} +//![0] + +void AnimalModel::addAnimal(const Animal &animal) +{ + m_animals << animal; +} + +int AnimalModel::rowCount(const QModelIndex & parent) const { + return m_animals.count(); +} + +QVariant AnimalModel::data(const QModelIndex & index, int role) const { + if (index.row() < 0 || index.row() > m_animals.count()) + return QVariant(); + + const Animal &animal = m_animals[index.row()]; + if (role == TypeRole) + return animal.type(); + else if (role == SizeRole) + return animal.size(); + return QVariant(); +} + diff --git a/examples/declarative/modelviews/abstractitemmodel/model.h b/examples/declarative/modelviews/abstractitemmodel/model.h new file mode 100644 index 0000000..1119837 --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/model.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![0] +class Animal +{ +public: + Animal(const QString &type, const QString &size); +//![0] + + QString type() const; + QString size() const; + +private: + QString m_type; + QString m_size; +//![1] +}; + +class AnimalModel : public QAbstractListModel +{ + Q_OBJECT +public: + enum AnimalRoles { + TypeRole = Qt::UserRole + 1, + SizeRole + }; + + AnimalModel(QObject *parent = 0); +//![1] + + void addAnimal(const Animal &animal); + + int rowCount(const QModelIndex & parent = QModelIndex()) const; + + QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; + +private: + QList m_animals; +//![2] +}; +//![2] + + diff --git a/examples/declarative/modelviews/abstractitemmodel/view.qml b/examples/declarative/modelviews/abstractitemmodel/view.qml new file mode 100644 index 0000000..591d89a --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/view.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 + +//![0] +ListView { + width: 200; height: 250 + anchors.fill: parent + + model: myModel + delegate: Text { text: "Animal: " + type + ", " + size } +} +//![0] + diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/declarative/modelviews/objectlistmodel/main.cpp index 8c921b7..89c22a1 100644 --- a/examples/declarative/modelviews/objectlistmodel/main.cpp +++ b/examples/declarative/modelviews/objectlistmodel/main.cpp @@ -56,10 +56,8 @@ //![0] int main(int argc, char ** argv) { -//![0] QApplication app(argc, argv); -//![1] QList dataList; dataList.append(new DataObject("Item 1", "red")); dataList.append(new DataObject("Item 2", "green")); @@ -69,13 +67,11 @@ int main(int argc, char ** argv) QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); +//![0] view.setSource(QUrl("qrc:view.qml")); view.show(); -//![1] return app.exec(); -//![2] } -//![2] diff --git a/examples/declarative/modelviews/stringlistmodel/main.cpp b/examples/declarative/modelviews/stringlistmodel/main.cpp index ea73859..bf46c63 100644 --- a/examples/declarative/modelviews/stringlistmodel/main.cpp +++ b/examples/declarative/modelviews/stringlistmodel/main.cpp @@ -66,10 +66,10 @@ int main(int argc, char ** argv) QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); +//![0] view.setSource(QUrl("qrc:view.qml")); view.show(); -//![0] return app.exec(); } -- cgit v0.12 From c24f25fa537486c8c5e38ecfde490b7422a28f81 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Jul 2010 16:55:17 +1000 Subject: doc fix --- doc/src/declarative/globalobject.qdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 40fc3eb..36d91ec 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -114,7 +114,8 @@ browser. The following objects and properties are supported by the QML implemen \endtable -\sa {declarative/xml/xmlhttprequest}{XMLHttpRequest example} +The \l{declarative/xml/xmlhttprequest}{XMLHttpRequest example} demonstrates how to +use the XMLHttpRequest object to make a request and read the response headers. \section1 Offline Storage API @@ -134,7 +135,8 @@ The API can be used from JavaScript functions in your QML: The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. -\sa {declarative/sqllocalstorage}{SQL Local Storage example} +The \l{declarative/sqllocalstorage}{SQL Local Storage example} demonstrates the basics of +using the Offline Storage API. \section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db)) -- cgit v0.12 From a12cd98dda74b9ffa8729a58959bc7ab41118cf0 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 17:50:45 +1000 Subject: Fix bug in SameGame's dialog component Was emitting closed after already being closed. Task-number: QTBUG-11812 --- demos/declarative/samegame/SamegameCore/Dialog.qml | 2 ++ demos/declarative/samegame/samegame.qml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index c71a4b3..7e64bd6 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -49,6 +49,8 @@ Rectangle { signal closed signal opened function forceClose() { + if(page.opacity == 0) + return; //already closed page.closed(); page.opacity = 0; } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 10bf79f..9504fb6 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -88,7 +88,7 @@ Rectangle { Behavior on width { NumberAnimation {} - enabled: initialWidth != 0 + enabled: nameInputDialog.initialWidth != 0 } onOpened: nameInputText.focus = true; -- cgit v0.12 From 7bb2eb806a6d8bcead12c199ae8614af250f6a6c Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Wed, 30 Jun 2010 14:44:29 +0200 Subject: Removed compilation warning for systems with no OpenGL support Reviewed-by: Aaron Kennedy --- tools/qml/qmlruntime.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 94fcc82..debc902 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -1364,6 +1364,8 @@ void QDeclarativeViewer::setUseGL(bool useGL) canvas->setViewport(glWidget); } +#else + Q_UNUSED(useGL) #endif } -- cgit v0.12 From e302b2b1e65c616d7ed6adfcf4b252a6741f3053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 30 Jun 2010 10:32:01 +0200 Subject: Improved performance of 16 bit memrotates using NEON instructions. Make the memrotate functions a function pointer table so that we can replace it with optimized versions, and implement an optimized NEON version for the 90 and 270 rotations. Measured performance improvement for a 400x400 16-bit pixmap was 17 % for 270 degree rotation and 11 % for 90 degree rotation. Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 3 + src/gui/painting/qdrawhelper_neon.cpp | 144 +++++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_asm.S | 105 ++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_p.h | 3 + src/gui/painting/qdrawhelper_p.h | 2 + src/gui/painting/qmemrotate.cpp | 51 +++++++++++ src/gui/painting/qpaintengine_raster.cpp | 24 +----- 7 files changed, 310 insertions(+), 22 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5727b3c..d7f7dc3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7901,6 +7901,9 @@ void qInitDrawhelperAsm() functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; + + qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; } #endif diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 3ce90d2..03fe075 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -622,6 +622,150 @@ void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, u } } +static const int tileSize = 32; + +extern "C" void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); + +void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sstride, uchar *destPixels, int dstride) +{ + const ushort *src = (const ushort *)srcPixels; + ushort *dest = (ushort *)destPixels; + + sstride /= sizeof(ushort); + dstride /= sizeof(ushort); + + const int pack = sizeof(quint32) / sizeof(ushort); + const int unaligned = + qMin(uint((quintptr(dest) & (sizeof(quint32)-1)) / sizeof(ushort)), uint(h)); + const int restX = w % tileSize; + const int restY = (h - unaligned) % tileSize; + const int unoptimizedY = restY % pack; + const int numTilesX = w / tileSize + (restX > 0); + const int numTilesY = (h - unaligned) / tileSize + (restY >= pack); + + for (int tx = 0; tx < numTilesX; ++tx) { + const int startx = w - tx * tileSize - 1; + const int stopx = qMax(startx - tileSize, 0); + + if (unaligned) { + for (int x = startx; x >= stopx; --x) { + ushort *d = dest + (w - x - 1) * dstride; + for (int y = 0; y < unaligned; ++y) { + *d++ = src[y * sstride + x]; + } + } + } + + for (int ty = 0; ty < numTilesY; ++ty) { + const int starty = ty * tileSize + unaligned; + const int stopy = qMin(starty + tileSize, h - unoptimizedY); + + int x = startx; + // qt_rotate90_16_neon writes to eight rows, four pixels at a time + for (; x >= stopx + 7; x -= 8) { + ushort *d = dest + (w - x - 1) * dstride + starty; + const ushort *s = &src[starty * sstride + x - 7]; + qt_rotate90_16_neon(d, s, sstride * 2, dstride * 2, stopy - starty); + } + + for (; x >= stopx; --x) { + quint32 *d = reinterpret_cast(dest + (w - x - 1) * dstride + starty); + for (int y = starty; y < stopy; y += pack) { + quint32 c = src[y * sstride + x]; + for (int i = 1; i < pack; ++i) { + const int shift = (sizeof(int) * 8 / pack * i); + const ushort color = src[(y + i) * sstride + x]; + c |= color << shift; + } + *d++ = c; + } + } + } + + if (unoptimizedY) { + const int starty = h - unoptimizedY; + for (int x = startx; x >= stopx; --x) { + ushort *d = dest + (w - x - 1) * dstride + starty; + for (int y = starty; y < h; ++y) { + *d++ = src[y * sstride + x]; + } + } + } + } +} + +extern "C" void qt_rotate270_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); + +void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, + int sstride, + uchar *destPixels, int dstride) +{ + const ushort *src = (const ushort *)srcPixels; + ushort *dest = (ushort *)destPixels; + + sstride /= sizeof(ushort); + dstride /= sizeof(ushort); + + const int pack = sizeof(quint32) / sizeof(ushort); + const int unaligned = + qMin(uint((long(dest) & (sizeof(quint32)-1)) / sizeof(ushort)), uint(h)); + const int restX = w % tileSize; + const int restY = (h - unaligned) % tileSize; + const int unoptimizedY = restY % pack; + const int numTilesX = w / tileSize + (restX > 0); + const int numTilesY = (h - unaligned) / tileSize + (restY >= pack); + + for (int tx = 0; tx < numTilesX; ++tx) { + const int startx = tx * tileSize; + const int stopx = qMin(startx + tileSize, w); + + if (unaligned) { + for (int x = startx; x < stopx; ++x) { + ushort *d = dest + x * dstride; + for (int y = h - 1; y >= h - unaligned; --y) { + *d++ = src[y * sstride + x]; + } + } + } + + for (int ty = 0; ty < numTilesY; ++ty) { + const int starty = h - 1 - unaligned - ty * tileSize; + const int stopy = qMax(starty - tileSize, unoptimizedY); + + int x = startx; + // qt_rotate90_16_neon writes to eight rows, four pixels at a time + for (; x < stopx - 7; x += 8) { + ushort *d = dest + x * dstride + h - 1 - starty; + const ushort *s = &src[starty * sstride + x]; + qt_rotate90_16_neon(d + 7 * dstride, s, -sstride * 2, -dstride * 2, starty - stopy); + } + + for (; x < stopx; ++x) { + quint32 *d = reinterpret_cast(dest + x * dstride + + h - 1 - starty); + for (int y = starty; y > stopy; y -= pack) { + quint32 c = src[y * sstride + x]; + for (int i = 1; i < pack; ++i) { + const int shift = (sizeof(int) * 8 / pack * i); + const ushort color = src[(y - i) * sstride + x]; + c |= color << shift; + } + *d++ = c; + } + } + } + if (unoptimizedY) { + const int starty = unoptimizedY - 1; + for (int x = startx; x < stopx; ++x) { + ushort *d = dest + x * dstride + h - 1 - starty; + for (int y = starty; y >= 0; --y) { + *d++ = src[y * sstride + x]; + } + } + } + } +} + QT_END_NAMESPACE #endif // QT_HAVE_NEON diff --git a/src/gui/painting/qdrawhelper_neon_asm.S b/src/gui/painting/qdrawhelper_neon_asm.S index 9992817..d9cdc36 100644 --- a/src/gui/painting/qdrawhelper_neon_asm.S +++ b/src/gui/painting/qdrawhelper_neon_asm.S @@ -190,3 +190,108 @@ blend_8_pixels_rgb16_on_rgb16_neon: bx lr .endfunc + +/* void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count) */ + .func qt_rotate90_16_neon + .global qt_rotate90_16_neon + /* For ELF format also set function visibility to hidden */ +#ifdef __ELF__ + .hidden qt_rotate90_16_neon + .type qt_rotate90_16_neon, %function +#endif +qt_rotate90_16_neon: + push { r4-r11, lr } + ldr r5, [sp, #(9*4)] + + /* The preloads are the key to getting good performance */ + pld [r1] + + mov r4, r5, asr #2 + add r6, r0, r3 + add r7, r6, r3 + + add r8, r7, r3 + add r9, r8, r3 + + pld [r1, r2] + + add r10, r9, r3 + add r11, r10, r3 + + add r3, r3, r11 + and r5, r5, #3 + + pld [r1, r2, lsl #1] + + cmp r4, #0 + beq .rotate90_16_tail + +.rotate90_16_loop: + vld1.16 { q8 }, [r1], r2 + + pld [r1, r2, lsl #1] + + vld1.16 { q9 }, [r1], r2 + vld1.16 { q10 }, [r1], r2 + vld1.16 { q11 }, [r1], r2 + + pld [r1] + + /* Could have used four quad-word zips instead, + but those take three cycles as opposed to one. */ + vzip.16 d16, d20 + vzip.16 d17, d21 + + vzip.16 d18, d22 + + pld [r1, r2] + + vzip.16 d19, d23 + + vzip.16 d16, d18 + vzip.16 d17, d19 + + pld [r1, r2, lsl #1] + + vzip.16 d20, d22 + vzip.16 d21, d23 + + vst1.16 { d23 }, [r0]! + vst1.16 { d21 }, [r6]! + vst1.16 { d19 }, [r7]! + vst1.16 { d17 }, [r8]! + vst1.16 { d22 }, [r9]! + vst1.16 { d20 }, [r10]! + vst1.16 { d18 }, [r11]! + vst1.16 { d16 }, [r3]! + + sub r4, r4, #1 + cmp r4, #0 + bne .rotate90_16_loop + b .rotate90_16_tail + +.rotate90_16_tail_loop: + sub r5, r5, #2 + + vld1.16 { q8 }, [r1], r2 + vld1.16 { q9 }, [r1], r2 + + vzip.16 d16, d18 + vzip.16 d17, d19 + + vst1.32 { d19[1] }, [r0]! + vst1.32 { d19[0] }, [r6]! + vst1.32 { d17[1] }, [r7]! + vst1.32 { d17[0] }, [r8]! + vst1.32 { d18[1] }, [r9]! + vst1.32 { d18[0] }, [r10]! + vst1.32 { d16[1] }, [r11]! + vst1.32 { d16[0] }, [r3]! + +.rotate90_16_tail: + cmp r5, #0 + bgt .rotate90_16_tail_loop + + pop { r4-r11, pc } + + .endfunc diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index c054a1e..cd2dbfc 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -120,6 +120,9 @@ void qt_transform_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, const QTransform &targetRectTransform, int const_alpha); +void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); +void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); + uint * QT_FASTCALL qt_destFetchRGB16_neon(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length); diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index acf765c..97c78bb 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -152,6 +152,7 @@ typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl, const QTransform &targetRectTransform, int const_alpha); +typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); struct DrawHelper { ProcessSpans blendColor; @@ -165,6 +166,7 @@ struct DrawHelper { extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]; extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]; extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]; +extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3]; extern DrawHelper qDrawHelper[QImage::NImageFormats]; diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index c37aa51..6888bb0 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -594,4 +594,55 @@ void Q_GUI_EXPORT qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHei qt_memrotate90_template(src, srcWidth, srcHeight, srcStride, reinterpret_cast(dest), dstStride); } +void qt_memrotate90_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate90((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); +} + +void qt_memrotate180_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate180((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); +} + +void qt_memrotate270_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate270((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); +} + +void qt_memrotate90_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate90((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); +} + +void qt_memrotate180_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate180((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); +} + +void qt_memrotate270_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate270((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); +} + +MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] = +// 90, 180, 270 +{ + { 0, 0, 0 }, // Format_Invalid, + { 0, 0, 0 }, // Format_Mono, + { 0, 0, 0 }, // Format_MonoLSB, + { 0, 0, 0 }, // Format_Indexed8, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGB32, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_ARGB32, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_ARGB32_Premultiplied, + { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 }, // Format_RGB16, + { 0, 0, 0 }, // Format_ARGB8565_Premultiplied, + { 0, 0, 0 }, // Format_RGB666, + { 0, 0, 0 }, // Format_ARGB6666_Premultiplied, + { 0, 0, 0 }, // Format_RGB555, + { 0, 0, 0 }, // Format_ARGB8555_Premultiplied, + { 0, 0, 0 }, // Format_RGB888, + { 0, 0, 0 }, // Format_RGB444, + { 0, 0, 0 } // Format_ARGB4444_Premultiplied, +}; + QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 84b36c7..09a87aa 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2553,23 +2553,6 @@ namespace { return NoRotation; } - template void memRotate(RotationType type, const T *srcBase, int w, int h, int sbpl, T *dstBase, int dbpl) - { - switch (type) { - case Rotation90: - qt_memrotate90(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case Rotation180: - qt_memrotate180(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case Rotation270: - qt_memrotate270(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case NoRotation: - break; - } - } - inline bool isPixelAligned(const QRectF &rect) { return QRectF(rect.toRect()) == rect; } @@ -2650,7 +2633,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe { RotationType rotationType = qRotationType(s->matrix); - if (rotationType != NoRotation && img.rect().contains(sr.toAlignedRect())) { + if (rotationType != NoRotation && qMemRotateFunctions[d->rasterBuffer->format][rotationType] && img.rect().contains(sr.toAlignedRect())) { QRectF transformedTargetRect = s->matrix.mapRect(r); if ((!(s->renderHints & QPainter::SmoothPixmapTransform) && !(s->renderHints & QPainter::Antialiasing)) @@ -2678,10 +2661,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe uint cw = clippedSourceRect.width(); uint ch = clippedSourceRect.height(); - if (d->rasterBuffer->format == QImage::Format_RGB16) - memRotate(rotationType, (quint16 *)srcBase, cw, ch, sbpl, (quint16 *)dstBase, dbpl); - else - memRotate(rotationType, (quint32 *)srcBase, cw, ch, sbpl, (quint32 *)dstBase, dbpl); + qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl); return; } -- cgit v0.12 From fa0ef7a2c36afffb45a7954eb8a230953578f55e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 18:39:34 +1000 Subject: Remove arbitrary width checks Width is not an arbitrary value, it is the size of the rendered page (which is whatever webkit says it is). Width should be tested to be correct, but this change should be done by the maintainers (who should also take the autotest out of declarative). Task-number: QTBUG-11855 --- tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index f33e5a4..2a220c4 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -156,7 +156,6 @@ void tst_qdeclarativewebview::basicProperties() QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png")); QCOMPARE(wv->property("statusText").toString(),QString("status here")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); - QCOMPARE(wv->property("width").toDouble(), 123.0); QCOMPARE(wv->property("preferredWidth").toInt(), 0); QCOMPARE(wv->property("preferredHeight").toInt(), 0); QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); @@ -258,7 +257,6 @@ void tst_qdeclarativewebview::historyNav() QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png")); QCOMPARE(wv->property("statusText").toString(),QString("status here")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); - QCOMPARE(wv->property("width").toDouble(), 123.0); QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0); QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); -- cgit v0.12 From 07e755128c3bf4073820ecfc0ea11959b20bbd5a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 18:47:37 +1000 Subject: Get WebView tests passing again zoomFactor was removed in the new version. --- tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index 2a220c4..2bded6b 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -158,7 +158,6 @@ void tst_qdeclarativewebview::basicProperties() QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); QCOMPARE(wv->property("preferredWidth").toInt(), 0); QCOMPARE(wv->property("preferredHeight").toInt(), 0); - QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); QVERIFY(qvariant_cast(wv->property("reload"))); @@ -258,7 +257,6 @@ void tst_qdeclarativewebview::historyNav() QCOMPARE(wv->property("statusText").toString(),QString("status here")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0); - QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); QVERIFY(qvariant_cast(wv->property("reload"))); -- cgit v0.12 From ace4710951ca5be3cb10bb631d8082e12e0b0b1c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 1 Jul 2010 11:22:23 +0200 Subject: Updated WebKit to 0eee8df53d1873669a9dda8f9c0340543258a316 Integrated changes: || || [Qt] QtTestBrowser does not have a "Load" button ; therefore, unable to load pages on touch only symbian devices (portrait mode). || || || [Qt] GraphicsLayerQt delay seems unnecessary. || || || Spatial Navigation: make elements in inner frames nested more than 1 level deep focusable || || || [Qt] Combobox doesn't close when scrolling in graphicsbased mode || || || [Qt] QtWebKit crashes if 's render changes in its onchange event + https://bugs.webkit.org/show_bug.cgi?id=41164 + + QtWebKit crashes if \n" \ + " \n" \ " \n" \ " \n" \ "
\n" \ -- cgit v0.12 From 6c47c8466a894020e9a6113a778a11b04dcd14af Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 1 Jul 2010 14:02:42 +0200 Subject: Update def files for symbian --- src/s60installs/bwins/QtGuiu.def | 33 +++++++++++++++++++++++++++++++++ src/s60installs/bwins/QtScriptu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 6e20131..165a8e8 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12824,4 +12824,37 @@ EXPORTS ?createPixmapForImage@QRasterPixmapData@@IAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 12823 NONAME ; void QRasterPixmapData::createPixmapForImage(class QImage &, class QFlags, bool) ??0Tab@QTextOption@@QAE@MW4TabType@1@VQChar@@@Z @ 12824 NONAME ; QTextOption::Tab::Tab(float, enum QTextOption::TabType, class QChar) ?fromData@QRasterPixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12825 NONAME ; bool QRasterPixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) + ?transformed@QRuntimePixmapData@@UBE?AVQPixmap@@ABVQTransform@@W4TransformationMode@Qt@@@Z @ 12826 NONAME ; class QPixmap QRuntimePixmapData::transformed(class QTransform const &, enum Qt::TransformationMode) const + ?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12827 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &) + ?buffer@QRuntimePixmapData@@UAEPAVQImage@@XZ @ 12828 NONAME ; class QImage * QRuntimePixmapData::buffer(void) + ?copy@QRuntimePixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12829 NONAME ; void QRuntimePixmapData::copy(class QPixmapData const *, class QRect const &) + ?fromData@QRuntimePixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12830 NONAME ; bool QRuntimePixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) + ?readBackInfo@QRuntimePixmapData@@QAEXXZ @ 12831 NONAME ; void QRuntimePixmapData::readBackInfo(void) + ??_EQRuntimePixmapData@@UAE@I@Z @ 12832 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(unsigned int) + ?paintEngine@QRuntimePixmapData@@UBEPAVQPaintEngine@@XZ @ 12833 NONAME ; class QPaintEngine * QRuntimePixmapData::paintEngine(void) const + ?memoryUsage@QRuntimePixmapData@@UBEIXZ @ 12834 NONAME ; unsigned int QRuntimePixmapData::memoryUsage(void) const + ?toImage@QRasterPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12835 NONAME ; class QImage QRasterPixmapData::toImage(class QRect const &) const + ?fromImageReader@QRasterPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12836 NONAME ; void QRasterPixmapData::fromImageReader(class QImageReader *, class QFlags) + ?fill@QRuntimePixmapData@@UAEXABVQColor@@@Z @ 12837 NONAME ; void QRuntimePixmapData::fill(class QColor const &) + ?alphaChannel@QRuntimePixmapData@@UBE?AVQPixmap@@XZ @ 12838 NONAME ; class QPixmap QRuntimePixmapData::alphaChannel(void) const + ?createCompatiblePixmapData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12839 NONAME ; class QPixmapData * QRuntimePixmapData::createCompatiblePixmapData(void) const + ?toImage@QRuntimePixmapData@@UBE?AVQImage@@XZ @ 12840 NONAME ; class QImage QRuntimePixmapData::toImage(void) const + ?resize@QRuntimePixmapData@@UAEXHH@Z @ 12841 NONAME ; void QRuntimePixmapData::resize(int, int) + ?fromNativeType@QRuntimePixmapData@@UAEXPAXW4NativeType@QPixmapData@@@Z @ 12842 NONAME ; void QRuntimePixmapData::fromNativeType(void *, enum QPixmapData::NativeType) + ?fromFile@QRuntimePixmapData@@UAE_NABVQString@@PBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12843 NONAME ; bool QRuntimePixmapData::fromFile(class QString const &, char const *, class QFlags) + ?setAlphaChannel@QRuntimePixmapData@@UAEXABVQPixmap@@@Z @ 12844 NONAME ; void QRuntimePixmapData::setAlphaChannel(class QPixmap const &) + ?fromImageReader@QPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12845 NONAME ; void QPixmapData::fromImageReader(class QImageReader *, class QFlags) + ?toImage@QPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12846 NONAME ; class QImage QPixmapData::toImage(class QRect const &) const + ?fromImageReader@QPixmap@@SA?AV1@PAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12847 NONAME ; class QPixmap QPixmap::fromImageReader(class QImageReader *, class QFlags) + ?fromImage@QRuntimePixmapData@@UAEXABVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12848 NONAME ; void QRuntimePixmapData::fromImage(class QImage const &, class QFlags) + ?setMask@QRuntimePixmapData@@UAEXABVQBitmap@@@Z @ 12849 NONAME ; void QRuntimePixmapData::setMask(class QBitmap const &) + ?mask@QRuntimePixmapData@@UBE?AVQBitmap@@XZ @ 12850 NONAME ; class QBitmap QRuntimePixmapData::mask(void) const + ?createPixmapData@QGraphicsSystem@@UAEPAVQPixmapData@@PAV2@@Z @ 12851 NONAME ; class QPixmapData * QGraphicsSystem::createPixmapData(class QPixmapData *) + ?metric@QRuntimePixmapData@@UBEHW4PaintDeviceMetric@QPaintDevice@@@Z @ 12852 NONAME ; int QRuntimePixmapData::metric(enum QPaintDevice::PaintDeviceMetric) const + ??1QRuntimePixmapData@@UAE@XZ @ 12853 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(void) + ??0QRuntimePixmapData@@QAE@PBVQRuntimeGraphicsSystem@@W4PixelType@QPixmapData@@@Z @ 12854 NONAME ; QRuntimePixmapData::QRuntimePixmapData(class QRuntimeGraphicsSystem const *, enum QPixmapData::PixelType) + ?hasAlphaChannel@QRuntimePixmapData@@UBE_NXZ @ 12855 NONAME ; bool QRuntimePixmapData::hasAlphaChannel(void) const + ?runtimeData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12856 NONAME ; class QPixmapData * QRuntimePixmapData::runtimeData(void) const + ?toNativeType@QRuntimePixmapData@@UAEPAXW4NativeType@QPixmapData@@@Z @ 12857 NONAME ; void * QRuntimePixmapData::toNativeType(enum QPixmapData::NativeType) + ?copy@QRasterPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12858 NONAME ; void QRasterPixmapData::copy(class QPixmapData const *, class QRect const &) diff --git a/src/s60installs/bwins/QtScriptu.def b/src/s60installs/bwins/QtScriptu.def index 7769443..fbf0d3b 100644 --- a/src/s60installs/bwins/QtScriptu.def +++ b/src/s60installs/bwins/QtScriptu.def @@ -401,4 +401,6 @@ EXPORTS ?didReachBreakpoint@QScriptEngineAgentPrivate@@UAEXABVDebuggerCallFrame@QTJSC@@HH@Z @ 400 NONAME ; void QScriptEngineAgentPrivate::didReachBreakpoint(class QTJSC::DebuggerCallFrame const &, int, int) ?exception@QScriptEngineAgentPrivate@@UAEXABVDebuggerCallFrame@QTJSC@@HH_N@Z @ 401 NONAME ; void QScriptEngineAgentPrivate::exception(class QTJSC::DebuggerCallFrame const &, int, int, bool) ?reportAdditionalMemoryCost@QScriptEngine@@QAEXH@Z @ 402 NONAME ; void QScriptEngine::reportAdditionalMemoryCost(int) + ?newStaticScopeObject@QScriptDeclarativeClass@@SA?AVQScriptValue@@PAVQScriptEngine@@@Z @ 403 NONAME ; class QScriptValue QScriptDeclarativeClass::newStaticScopeObject(class QScriptEngine *) + ?newStaticScopeObject@QScriptDeclarativeClass@@SA?AVQScriptValue@@PAVQScriptEngine@@HPBVQString@@PBV2@PBV?$QFlags@W4PropertyFlag@QScriptValue@@@@@Z @ 404 NONAME ; class QScriptValue QScriptDeclarativeClass::newStaticScopeObject(class QScriptEngine *, int, class QString const *, class QScriptValue const *, class QFlags const *) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 45be23e..b672b65 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12025,4 +12025,37 @@ EXPORTS _ZNK11QPixmapData7toImageERK5QRect @ 12024 NONAME _ZNK17QRasterPixmapData7toImageERK5QRect @ 12025 NONAME _ZTV15QGraphicsSystem @ 12026 NONAME + _ZN11QPixmapData15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12027 NONAME + _ZN17QRasterPixmapData15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12028 NONAME + _ZN18QRuntimePixmapData12readBackInfoEv @ 12029 NONAME + _ZN18QRuntimePixmapData12toNativeTypeEN11QPixmapData10NativeTypeE @ 12030 NONAME + _ZN18QRuntimePixmapData14fromNativeTypeEPvN11QPixmapData10NativeTypeE @ 12031 NONAME + _ZN18QRuntimePixmapData15setAlphaChannelERK7QPixmap @ 12032 NONAME + _ZN18QRuntimePixmapData4copyEPK11QPixmapDataRK5QRect @ 12033 NONAME + _ZN18QRuntimePixmapData4fillERK6QColor @ 12034 NONAME + _ZN18QRuntimePixmapData6bufferEv @ 12035 NONAME + _ZN18QRuntimePixmapData6resizeEii @ 12036 NONAME + _ZN18QRuntimePixmapData6scrollEiiRK5QRect @ 12037 NONAME + _ZN18QRuntimePixmapData7setMaskERK7QBitmap @ 12038 NONAME + _ZN18QRuntimePixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12039 NONAME + _ZN18QRuntimePixmapData8fromFileERK7QStringPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12040 NONAME + _ZN18QRuntimePixmapData9fromImageERK6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 12041 NONAME + _ZN18QRuntimePixmapDataC1EPK22QRuntimeGraphicsSystemN11QPixmapData9PixelTypeE @ 12042 NONAME + _ZN18QRuntimePixmapDataC2EPK22QRuntimeGraphicsSystemN11QPixmapData9PixelTypeE @ 12043 NONAME + _ZN18QRuntimePixmapDataD0Ev @ 12044 NONAME + _ZN18QRuntimePixmapDataD1Ev @ 12045 NONAME + _ZN18QRuntimePixmapDataD2Ev @ 12046 NONAME + _ZN7QPixmap15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12047 NONAME + _ZNK18QRuntimePixmapData11memoryUsageEv @ 12048 NONAME + _ZNK18QRuntimePixmapData11paintEngineEv @ 12049 NONAME + _ZNK18QRuntimePixmapData11runtimeDataEv @ 12050 NONAME + _ZNK18QRuntimePixmapData11transformedERK10QTransformN2Qt18TransformationModeE @ 12051 NONAME + _ZNK18QRuntimePixmapData12alphaChannelEv @ 12052 NONAME + _ZNK18QRuntimePixmapData15hasAlphaChannelEv @ 12053 NONAME + _ZNK18QRuntimePixmapData26createCompatiblePixmapDataEv @ 12054 NONAME + _ZNK18QRuntimePixmapData4maskEv @ 12055 NONAME + _ZNK18QRuntimePixmapData6metricEN12QPaintDevice17PaintDeviceMetricE @ 12056 NONAME + _ZNK18QRuntimePixmapData7toImageEv @ 12057 NONAME + _ZTI18QRuntimePixmapData @ 12058 NONAME + _ZTV18QRuntimePixmapData @ 12059 NONAME -- cgit v0.12 From 2471a5f348084ded48fd738683dde0137528c30d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 30 Jun 2010 12:45:42 +0200 Subject: Improved a bit detection of a touch screen on Windows. Use the bitfield description from MSDN instead of just checking if there is any kind of digitizer. Reviewed-by: Prasanth --- src/gui/kernel/qapplication_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index ef719ca..9e8a128 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -4086,7 +4086,12 @@ void QApplicationPrivate::initializeMultitouch_sys() { if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { static const int QT_SM_DIGITIZER = 94; - QApplicationPrivate::HasTouchSupport = GetSystemMetrics(QT_SM_DIGITIZER); + int value = GetSystemMetrics(QT_SM_DIGITIZER); + static const int QT_NID_INTEGRATED_TOUCH = 0x01; + static const int QT_NID_EXTERNAL_TOUCH = 0x02; + static const int QT_NID_MULTI_INPUT = 0x40; + QApplicationPrivate::HasTouchSupport = + value & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH | QT_NID_MULTI_INPUT); } QLibrary library(QLatin1String("user32")); -- cgit v0.12 From 9a1b0695277a3864b42d082095962f8742cdcf04 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 1 Jul 2010 12:00:05 +0200 Subject: Fixed QX11EmbedContainer. Enforce the creation of the native window id for the focusproxy widget inside the container to make sure we won't get a CreateNotify event to try to embed the focusproxy itself. Task-number: QTBUG-10809 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qx11embed_x11.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index b527e72..9f1b1f8 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -1070,6 +1070,7 @@ QX11EmbedContainer::QX11EmbedContainer(QWidget *parent) d->focusProxy = new QWidget(this); d->focusProxy->setAttribute(Qt::WA_NativeWindow); d->focusProxy->setAttribute(Qt::WA_DontCreateNativeAncestors); + d->focusProxy->createWinId(); d->focusProxy->setGeometry(-1, -1, 1, 1); // We need events from the window (activation status) and -- cgit v0.12 From 4cd1d5ce5fed9519a8c093424ca1ed9beb38dd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 14:31:34 +0200 Subject: Fixed bug in drawTiledPixmap when width of pixmap matches target rect. qt_memconvert's duff's device implementation assumes that count is > 0, if count is 0 it will still blit eight pixels. Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index d7f7dc3..ca9556b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5014,7 +5014,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * length -= copy_image_width; copy_image_width *= 2; } - qt_memconvert(dest, src, length); + if (length > 0) + qt_memconvert(dest, src, length); } else { while (length) { int l = qMin(image_width - sx, length); -- cgit v0.12 From fb00d5003ac5d91953a95d8164180f8f56a2b0f2 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Thu, 1 Jul 2010 10:14:09 +0200 Subject: Check for EGLSurface leak only when paint device is a QGLWidget. (not QGLWindowSurface for example). Merge-request: 722 Reviewed-by: Trond --- src/opengl/qgl_egl.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 58d3b0a..eafa181 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -232,17 +232,20 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() if (eglSurface != EGL_NO_SURFACE) { #ifdef Q_WS_X11 // Make sure we don't call eglDestroySurface on a surface which - // was created for a different winId: + // was created for a different winId. This applies only to QGLWidget + // paint device, so make sure this is the one we're operating on + // (as opposed to a QGLWindowSurface use case). if (paintDevice && paintDevice->devType() == QInternal::Widget) { - QGLWidget* w = static_cast(paintDevice); - - if (w->d_func()->eglSurfaceWindowId == w->winId()) - eglDestroySurface(eglContext->display(), eglSurface); - else - qWarning("WARNING: Potential EGL surface leak!"); - } else + QWidget *w = static_cast(paintDevice); + if (QGLWidget *wgl = qobject_cast(w)) { + if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) { + qWarning("WARNING: Potential EGL surface leak! Not destroying surface."); + return; + } + } + } #endif - eglDestroySurface(eglContext->display(), eglSurface); + eglDestroySurface(eglContext->display(), eglSurface); eglSurface = EGL_NO_SURFACE; } } -- cgit v0.12 From 7727c6b2aa577f87e3d30adcf3fd96be5f62ded9 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Thu, 1 Jul 2010 15:19:51 +0200 Subject: Adding func prototypes for EGL_NOK_swap_region2 extension. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 712 Reviewed-by: Samuel Rødal --- src/gui/egl/qegl.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/gui/egl/qegl_p.h | 1 + src/gui/egl/qeglcontext_p.h | 1 + 3 files changed, 46 insertions(+) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index e6ea198..3e2049c 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -515,6 +515,31 @@ bool QEglContext::swapBuffers(EGLSurface surface) return ok; } +bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) { + QVector qrects = region->rects(); + GLint *gl_rects; + uint count; + uint i; + + count = qrects.size(); + QVarLengthArray arr(4 * count); + gl_rects = arr.data(); + for (i = 0; i < count; i++) { + QRect qrect = qrects[i]; + + gl_rects[4 * i + 0] = qrect.x(); + gl_rects[4 * i + 1] = qrect.y(); + gl_rects[4 * i + 2] = qrect.width(); + gl_rects[4 * i + 3] = qrect.height(); + } + + bool ok = QEgl::eglSwapBuffersRegion2NOK(QEgl::display(), surface, count, gl_rects); + + if (!ok) + qWarning() << "QEglContext::swapBuffersRegion2NOK():" << QEgl::errorString(); + return ok; +} + int QEglContext::configAttrib(int name) const { EGLint value; @@ -532,6 +557,9 @@ typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR); static _eglCreateImageKHR qt_eglCreateImageKHR = 0; static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0; +typedef EGLBoolean (EGLAPIENTRY *_eglSwapBuffersRegion2NOK)(EGLDisplay, EGLSurface, EGLint, const EGLint*); + +static _eglSwapBuffersRegion2NOK qt_eglSwapBuffersRegion2NOK = 0; EGLDisplay QEgl::display() { @@ -560,6 +588,10 @@ EGLDisplay QEgl::display() qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); } #endif + + if (QEgl::hasExtension("EGL_NOK_swap_region2")) { + qt_eglSwapBuffersRegion2NOK = (_eglSwapBuffersRegion2NOK) eglGetProcAddress("eglSwapBuffersRegion2NOK"); + } } return dpy; @@ -591,6 +623,18 @@ EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) return 0; } +EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects) +{ + if (qt_eglSwapBuffersRegion2NOK) + return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects); + + QEgl::display(); // Initialises function pointers + if (qt_eglSwapBuffersRegion2NOK) + return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects); + + qWarning("QEgl::eglSwapBuffersRegion2NOK() called but EGL_NOK_swap_region2 extension not present"); + return 0; +} #ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 4fc1338..c214e88 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -224,6 +224,7 @@ namespace QEgl { // Extension functions Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img); + Q_GUI_EXPORT EGLBoolean eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects); #ifdef Q_WS_X11 Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config); diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index ccde00d..cae8164 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -84,6 +84,7 @@ public: bool doneCurrent(); bool lazyDoneCurrent(); bool swapBuffers(EGLSurface surface); + bool swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region); int configAttrib(int name) const; -- cgit v0.12 From 7394aadc24bc5318fdd9498931a882f8b8533365 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Thu, 1 Jul 2010 15:19:51 +0200 Subject: QGLWindowSurface support for partial updates via EGL_NOK_swap_region2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (if extension available). Merge-request: 712 Reviewed-by: Samuel Rødal --- src/opengl/qgl.cpp | 10 ++++++++++ src/opengl/qgl_egl.cpp | 8 ++++++++ src/opengl/qgl_p.h | 1 + src/opengl/qwindowsurface_gl.cpp | 24 ++++++++++++++++++++++-- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e05db96..72ed0c6 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2092,6 +2092,16 @@ void QGLContextPrivate::syncGlState() } #undef ctx +#ifdef QT_NO_EGL +void QGLContextPrivate::swapRegion(const QRegion *region) +{ + static bool firstWarning = true; + if (firstWarning) { + qWarning() << "::swapRegion called but not supported!"; + firstWarning = false; + } +} +#endif /*! \overload diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index eafa181..3763926 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -274,6 +274,14 @@ EGLSurface QGLContextPrivate::eglSurfaceForDevice() const return eglSurface; } +void QGLContextPrivate::swapRegion(const QRegion *region) +{ + if (!valid || !eglContext) + return; + + eglContext->swapBuffersRegion2NOK(eglSurfaceForDevice(), region); +} + void QGLWidget::setMouseTracking(bool enable) { QWidget::setMouseTracking(enable); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 34a6b7c..32feacd 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -334,6 +334,7 @@ public: void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true); void syncGlState(); // Makes sure the GL context's state is what we think it is + void swapRegion(const QRegion *region); #if defined(Q_WS_WIN) void updateFormatVersion(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 7efa9bc..e9da452 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -354,8 +354,22 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) ctx->create(qt_gl_share_widget()->context()); #ifndef QT_NO_EGL - if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED) + static bool checkedForNOKSwapRegion = false; + static bool haveNOKSwapRegion = false; + + if (!checkedForNOKSwapRegion) { + haveNOKSwapRegion = QEgl::hasExtension("EGL_NOK_swap_region2"); + checkedForNOKSwapRegion = true; + + if (haveNOKSwapRegion) + qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates."; + } + + if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED && + ! haveNOKSwapRegion) setPartialUpdateSupport(false); // Force full-screen updates + else + setPartialUpdateSupport(true); #endif widgetPrivate->extraData()->glContext = ctx; @@ -480,8 +494,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif + if (d_ptr->paintedRegion.boundingRect() != geometry()) { + // Emits warning if not supported. Should never happen unless + // setPartialUpdateSupport(true) has been called. + context()->d_func()->swapRegion(&d_ptr->paintedRegion); + } else + context()->swapBuffers(); + d_ptr->paintedRegion = QRegion(); - context()->swapBuffers(); } else { glFlush(); } -- cgit v0.12 From 844472273a17c74494d1d98a4f4110c21fb79a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 15:19:52 +0200 Subject: Got rid of unused variable compiler warning. --- 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 72ed0c6..fc28a73 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2093,7 +2093,7 @@ void QGLContextPrivate::syncGlState() #undef ctx #ifdef QT_NO_EGL -void QGLContextPrivate::swapRegion(const QRegion *region) +void QGLContextPrivate::swapRegion(const QRegion *) { static bool firstWarning = true; if (firstWarning) { -- cgit v0.12 From 2113140dc2a6a2e5b4f5ce62a678192907adcca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:14:52 +0200 Subject: Added missing EGL stub function. Reviewed-by: Shane Kearns --- src/gui/egl/qegl_stub.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp index 86a7aab..e7bb748 100644 --- a/src/gui/egl/qegl_stub.cpp +++ b/src/gui/egl/qegl_stub.cpp @@ -208,6 +208,15 @@ EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) return 0; } +EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects) +{ + Q_UNUSED(dpy); + Q_UNUSED(surface); + Q_UNUSED(count); + Q_UNUSED(rects); + NOEGL + return 0; +} #ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) -- cgit v0.12 From 401bfd7dd1f2fd4fbcea49206b3f8c6febc545ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:22:59 +0200 Subject: Fixed compilation on Symbian. Use EGLint, not GLint here, as GLint might not be defined. Reviewed-by: Shane Kearns --- src/gui/egl/qegl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 3e2049c..605b1e6 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -517,12 +517,12 @@ bool QEglContext::swapBuffers(EGLSurface surface) bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) { QVector qrects = region->rects(); - GLint *gl_rects; + EGLint *gl_rects; uint count; uint i; count = qrects.size(); - QVarLengthArray arr(4 * count); + QVarLengthArray arr(4 * count); gl_rects = arr.data(); for (i = 0; i < count; i++) { QRect qrect = qrects[i]; -- cgit v0.12 From 7631458b5b1c265c77dc9310463734960a3ff364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:30:09 +0200 Subject: Added another missing EGL stub. Reviewed-by: Shane Kearns --- src/gui/egl/qegl_stub.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp index e7bb748..1adb56c 100644 --- a/src/gui/egl/qegl_stub.cpp +++ b/src/gui/egl/qegl_stub.cpp @@ -176,6 +176,14 @@ bool QEglContext::swapBuffers(EGLSurface surface) return false; } +bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) +{ + Q_UNUSED(surface) + Q_UNUSED(region) + NOEGL + return false; +} + int QEglContext::configAttrib(int name) const { Q_UNUSED(name) -- cgit v0.12 From 80c2fbd7bb49483daf0a038a5e2ff85472a88ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:36:28 +0200 Subject: Updated Symbian def files with new EGL exports. Reviewed-by: Shane Kearns --- src/s60installs/bwins/QtGuiu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 165a8e8..8dc97f5 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12857,4 +12857,6 @@ EXPORTS ?runtimeData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12856 NONAME ; class QPixmapData * QRuntimePixmapData::runtimeData(void) const ?toNativeType@QRuntimePixmapData@@UAEPAXW4NativeType@QPixmapData@@@Z @ 12857 NONAME ; void * QRuntimePixmapData::toNativeType(enum QPixmapData::NativeType) ?copy@QRasterPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12858 NONAME ; void QRasterPixmapData::copy(class QPixmapData const *, class QRect const &) + ?eglSwapBuffersRegion2NOK@QEgl@@YAHHHHPBH@Z @ 12859 NONAME ; int QEgl::eglSwapBuffersRegion2NOK(int, int, int, int const *) + ?swapBuffersRegion2NOK@QEglContext@@QAE_NHPBVQRegion@@@Z @ 12860 NONAME ; bool QEglContext::swapBuffersRegion2NOK(int, class QRegion const *) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index b672b65..5b21b97 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12058,4 +12058,6 @@ EXPORTS _ZNK18QRuntimePixmapData7toImageEv @ 12057 NONAME _ZTI18QRuntimePixmapData @ 12058 NONAME _ZTV18QRuntimePixmapData @ 12059 NONAME + _ZN11QEglContext21swapBuffersRegion2NOKEiPK7QRegion @ 12060 NONAME + _ZN4QEgl24eglSwapBuffersRegion2NOKEiiiPKi @ 12061 NONAME -- cgit v0.12 From a69176304478ee070f8f5cfdf10b897ea4442759 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 1 Jul 2010 16:23:25 +0200 Subject: QSslSocket::systemCaCertificates(): have one common case for all Unices Reviewed-by: Simon Hausmann --- src/network/ssl/qsslsocket_openssl.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 30428ff..54a580d 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -615,13 +615,10 @@ QList QSslSocketPrivate::systemCaCertificates() ptrCertCloseStore(hSystemStore, 0); } } -#elif defined(Q_OS_AIX) - systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); -#elif defined(Q_OS_SOLARIS) - systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); -#elif defined(Q_OS_HPUX) - systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_UNIX) + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // AIX + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Solaris + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // HP-UX systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // (K)ubuntu, OpenSUSE, Mandriva, ... systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Gentoo, Mandrake -- cgit v0.12 From 71547238ea4391636e37f5cf89905433faeb32d1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 1 Jul 2010 16:23:00 +0200 Subject: Symbian on Linux: $QTDIR/bin is not necessarily in the path. So it would not find elf2e32_qtwrapper use the qtPrepareTool macro that does the right thing. But this macro need QT_BUILD_TREE to be defined, which is not defined yet early in the test process. So change the tests accordingly Reviewed-by: ossi --- config.tests/mac/crc.test | 2 +- config.tests/symbian/compile.test | 2 +- config.tests/unix/compile.test | 2 +- config.tests/unix/doubleformat.test | 2 +- config.tests/unix/endian.test | 2 +- config.tests/unix/ptrsize.test | 2 +- config.tests/x11/notype.test | 2 +- mkspecs/features/symbian/symbian_building.prf | 6 ++++-- 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/config.tests/mac/crc.test b/config.tests/mac/crc.test index 644ff75..9cbe7ba 100755 --- a/config.tests/mac/crc.test +++ b/config.tests/mac/crc.test @@ -53,7 +53,7 @@ test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" cd "$OUTDIR/$TEST" $MAKE distclean >/dev/null 2>&1 -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then $MAKE diff --git a/config.tests/symbian/compile.test b/config.tests/symbian/compile.test index 20a3039..ab85819 100755 --- a/config.tests/symbian/compile.test +++ b/config.tests/symbian/compile.test @@ -26,7 +26,7 @@ cd "$OUTDIR/$TEST" test -r Makefile && $MAKE distclean >/dev/null 2>&1 -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then $MAKE diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 99ebfd2..29ddea7 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -68,7 +68,7 @@ test -r Makefile && $MAKE distclean >/dev/null 2>&1 # Make sure output from possible previous tests is gone rm -f "$EXE" "${EXE}.exe" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then $MAKE diff --git a/config.tests/unix/doubleformat.test b/config.tests/unix/doubleformat.test index 953efd8..9968553 100755 --- a/config.tests/unix/doubleformat.test +++ b/config.tests/unix/doubleformat.test @@ -10,7 +10,7 @@ OUTDIR=$4 # build and run a test program test -d "$OUTDIR/config.tests/unix/doubleformat" || mkdir -p "$OUTDIR/config.tests/unix/doubleformat" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/unix/doubleformat" DOUBLEFORMAT="UNKNOWN" diff --git a/config.tests/unix/endian.test b/config.tests/unix/endian.test index 4755b1f..d0fb6ce 100755 --- a/config.tests/unix/endian.test +++ b/config.tests/unix/endian.test @@ -10,7 +10,7 @@ OUTDIR=$4 # build and run a test program test -d "$OUTDIR/config.tests/unix/endian" || mkdir -p "$OUTDIR/config.tests/unix/endian" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/unix/endian" diff --git a/config.tests/unix/ptrsize.test b/config.tests/unix/ptrsize.test index c1d80ee..c78c73f 100755 --- a/config.tests/unix/ptrsize.test +++ b/config.tests/unix/ptrsize.test @@ -10,7 +10,7 @@ OUTDIR=$4 # build and run a test program test -d "$OUTDIR/config.tests/unix/ptrsize" || mkdir -p "$OUTDIR/config.tests/unix/ptrsize" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/unix/ptrsize" if [ "$VERBOSE" = "yes" ]; then diff --git a/config.tests/x11/notype.test b/config.tests/x11/notype.test index 3a01d8f..1b534c8 100755 --- a/config.tests/x11/notype.test +++ b/config.tests/x11/notype.test @@ -27,7 +27,7 @@ if [ $XPLATFORM = "solaris-g++" -o $XPLATFORM = "hpux-g++" -o $XPLATFORM = "aix- NOTYPE=yes test -d "$OUTDIR/config.tests/x11/notype" || mkdir -p "$OUTDIR/config.tests/x11/notype" - "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1 + "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/x11/notype" if [ "$VERBOSE" = "yes" ]; then diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index fbaefca..c4088ca 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -8,6 +8,8 @@ QMAKE_LFLAGS += -Ttext 0x80000 -Tdata 0x400000 } +qtPrepareTool(QMAKE_ELF2E32_WRAPPER, elf2e32_qtwrapper) + isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000 epoc_heap_size = $$split(TARGET.EPOCHEAPSIZE, " ") @@ -107,7 +109,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { contains(CONFIG, plugin):QMAKE_ELF2E32_FLAGS += --definput=plugin_commonu.def QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget}.dll $$symbianDestdir/$${baseTarget}.sym \ - && elf2e32_qtwrapper --version=$$decVersion \ + && $$QMAKE_ELF2E32_WRAPPER --version=$$decVersion \ --sid=$$TARGET.SID \ --uid1=0x10000079 \ --uid2=$$TARGET.UID2 \ @@ -155,7 +157,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@.*") { QMAKE_POST_LINK = && $$QMAKE_POST_LINK } QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget} $$symbianDestdir/$${baseTarget}.sym \ - && elf2e32_qtwrapper --version $$decVersion \ + && $$QMAKE_ELF2E32_WRAPPER --version $$decVersion \ --sid=$$TARGET.SID \ --uid1=0x1000007a \ --uid2=$$TARGET.UID2 \ -- cgit v0.12 From b223a6ae4b1c3e7ddf91bc6158757ba8ea09980c Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 1 Jul 2010 21:23:11 +0200 Subject: Doc: Adding navigation and style fixes. Also rearranging qml elements --- doc/src/declarative/elements.qdoc | 264 +++++++++++----------------- doc/src/template/images/bullet_up.png | Bin 253 -> 210 bytes doc/src/template/style/style.css | 23 ++- tools/qdoc3/htmlgenerator.cpp | 49 +++--- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 5 files changed, 147 insertions(+), 191 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 2c36d12..48eb09f 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -32,169 +32,107 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt Declarative} module. -\table 80% -\header -\o \bold {States} -\o \bold {Animation and Transitions} -\o \bold {Working with Data} -\o \bold {Utility} -\row - -\o -\list -\o \l State -\o \l PropertyChanges -\o \l StateGroup -\o \l StateChangeScript -\o \l ParentChange (Item-specific) -\o \l AnchorChanges (Item-specific) -\endlist - -\o -\list -\o \l PropertyAnimation -\o \l NumberAnimation -\o \l ColorAnimation -\o \l RotationAnimation -\o \l SequentialAnimation -\o \l ParallelAnimation -\o \l PauseAnimation -\o \l ParentAnimation -\o \l AnchorAnimation -\o \l SmoothedAnimation -\o \l Vector3dAnimation -\o \l PropertyAction -\o \l ScriptAction -\o \l Transition -\o \l SmoothedFollow -\o \l SpringFollow -\o \l Behavior -\endlist - -\o -\list -\o \l Binding -\o \l ListModel -\list -\o \l ListElement -\endlist -\o \l VisualItemModel -\o \l VisualDataModel -\o \l Package -\o \l XmlListModel -\list -\o \l XmlRole -\endlist -\endlist - -\o -\list -\o \l Connections -\o \l Component -\o \l Timer -\o \l QtObject -\o \l WorkerScript -\endlist - -\header -\o \bold {Basic Visual Items} -\o \bold {Basic Interaction Items} -\o \bold {Utility} -\o \bold {Transforms} - -\row -\o -\list -\o \l Item -\o \l Rectangle - \list - \o \l Gradient - \list - \o \l GradientStop - \endlist - \endlist -\o \l Image -\o \l BorderImage -\o \l AnimatedImage -\o \l Text -\o \l TextInput - \list - \o \l IntValidator - \o \l DoubleValidator - \o \l RegExpValidator - \endlist -\o \l TextEdit -\endlist - -\o -\list -\o \l MouseArea -\o \l FocusScope -\o \l Flickable -\o \l Flipable -\o \l GestureArea (experimental) -\endlist - -\o -\list -\o \l Loader -\o \l Repeater -\o \l SystemPalette -\o \l FontLoader -\o \l LayoutItem -\endlist - -\o -\list -\o \l Scale -\o \l Rotation -\o \l Translate -\endlist - -\header -\o \bold {Views} -\o \bold {Positioners} -\o \bold {Effects} -\o - -\row -\o - -\target xmlViews -\list -\o \l ListView -\o \l GridView -\o \l PathView - \list - \o \l Path - \list - \o \l PathLine - \o \l PathQuad - \o \l PathCubic - \o \l PathAttribute - \o \l PathPercent - \endlist - \endlist -\o \l WebView -\endlist - -\o -\list -\o \l Column -\o \l Row -\o \l Grid -\o \l Flow -\endlist - -\o -\list -\o \l Particles (experimental) - \list - \o \l ParticleMotionLinear - \o \l ParticleMotionGravity - \o \l ParticleMotionWander - \endlist -\endlist +\table +\header \o {2,1} \bold {Basic Visual Items} +\row \o \l {Item} \o Basic item element inherited by all visual items in QML +\row \o \l {Rectangle} \o Basic visual rectangle element +\row \o \l {Gradient} \o Defines a gradient between two or more colors +\row \o \l {GradientStop} \o Defines a color used in a \l {Gradient} +\row \o \l {Image} \o Allows the use of bitmaps to a scene +\row \o \l {BorderImage} (Item-specific) \o Defines an image as a border +\row \o \l {AnimatedImage} \o For playing animations stored as a series of frames +\row \o \l {Text} \o Allows the use of formatted text in a scene +\row \o \l {TextInput} \o Displays an editable line of text +\row \o \l {IntValidator} \o Validator for integer values +\row \o \l {DoubleValidator} \o Validator for non-integer values +\row \o \l {RegExpValidator} \o Validator for string regular expressions +\row \o \l {TextEdit} \o Displays multiple lines of editable formatted text + +\header \o {2,1} \bold {Basic Interaction Items} +\row \o \l {MouseArea} \o Handles mouse interactions +\row \o \l {FocusScope} \o For keyboard focus handling +\row \o \l {Flickable} \o Provides a surface that can be "flicked" +\row \o \l {Flipable} \o Provides a surface that produces flipping effects +\row \o \l {GestureArea} (experimental) \o Enables simple gesture handling + +\header \o {2,1} \bold {States} +\row \o \l {State} \o Defines sets of configurations of objects and properties +\row \o \l {PropertyChanges} \o Describes property changes within a state +\row \o \l {StateGroup} \o Contains a set of states and state transitions +\row \o \l {StateChangeScript} \o Allows script binding in a state +\row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change +\row \o \l {AnchorChanges} \o Change the anchors of an item in a state + +\header \o {2,1} \bold {Animation and Transitions} +\row \o \l {Behavior} \o Specifies a default animation for property changes +\row \o \l {SequentialAnimation} \o Runs animations sequentially +\row \o \l {ParallelAnimation} \o Runs animations in parallel +\row \o \l {PropertyAnimation} \o Animates property changes +\row \o \l {NumberAnimation} \o Animates properties of type qreal +\row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d +\row \o \l {ColorAnimation} \o Animates color changes +\row \o \l {RotationAnimation} \o Animates rotations +\row \o \l {ParentAnimation} \o Animates parent changes +\row \o \l {AnchorAnimation} \o Animates anchor changes +\row \o \l {PauseAnimation} \o Pauses an animation +\row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value +\row \o \l {PropertyAction} \o Sets immediate property changes during animation +\row \o \l {ScriptAction} \o Runs scripts during an animation +\row \o \l {Transition} \o Animates transitions during state changes +\row \o \l {SpringFollow} \o Allows a property to follow value changes +\row \o \l {SmoothedFollow} \o Allows animation to smoothly follow value changes + +\header \o {2,1} \bold {Working with Data} +\row \o \l {Binding} \o Binds any value to any property +\row \o \l {ListModel} \o Defines a list of data +\row \o \l {ListElement} \o Defines a data item in a \l {ListModel} +\row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate +\row \o \l {VisualDataModel} \o Encapsulates a model and a delegate +\row \o \l {Package} \o Collection that enables sharing of items within different views +\row \o \l {XmlListModel} \o Specifies a model using XPath expressions +\row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel} + +\header \o {2,1} \bold {Views} +\row \o \l {ListView} \o Provides a list visualization of a model +\row \o \l {GridView} \o Provides a grid visualization of a model +\row \o \l {PathView} \o Visualizes a model's contents along a path +\row \o \l {Path} \o Defines a path used by \l {PathView} +\row \o \l {PathLine} \o Defines a line in \l {Path} +\row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path} +\row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path} +\row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path} +\row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path} +\row \o \l {WebView} \o Allows the addition of web content to a canvas + +\header \o {2,1} \bold {Positioners} +\row \o \l {Column} \o Arranges its children vertically +\row \o \l {Row} \o Arranges its children horizontally +\row \o \l {Grid} \o Positions its children in a grid +\row \o \l {Flow} \o Positions its children with wrapping support + +\header \o {2,1} \bold {Utility} +\row \o \l {Connections} \o Explicitly connects signals and signal handlers +\row \o \l {Component} \o Encapsulate QML items as a component +\row \o \l {Timer} \o Provides timed triggers +\row \o \l {QtObject} \o Basic element containing only the objectName property +\row \o \l {WorkerScript} \o Enables the use of threads in QML +\row \o \l {Loader} \o Controls the loading of items or components +\row \o \l {Repeater} \o Uses a model to create multiples of components +\row \o \l {SystemPalette} \o Provides access to the Qt palettes +\row \o \l {FontLoader} \o Loads fonts by name or URL +\row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts + +\header \o {2,1} \bold {Transforms} +\row \o \l {Scale} \o Assigns item scaling behaviors +\row \o \l {Rotation} \o Assigns item rotation behaviors +\row \o \l {Translate} \o Assigns item translation behaviors + +\header \o {2,1} \bold {Effects} +\row \o \l {Particles} (experimental) \o Generates and animates particles +\row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles} +\row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles} +\row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles} \endtable + */ diff --git a/doc/src/template/images/bullet_up.png b/doc/src/template/images/bullet_up.png index 285e741..7de2f06 100644 Binary files a/doc/src/template/images/bullet_up.png and b/doc/src/template/images/bullet_up.png differ diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 78a21f6..f1a63a9 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -490,11 +490,20 @@ } .wrap .content h2 { - font: 600 16px/1.2 Arial; + + border-bottom:1px solid #DDDDDD; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; + } .wrap .content h3 { font: 600 14px/1.2 Arial; + /*border-bottom:1px solid #DDDDDD;*/ + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content p { @@ -755,7 +764,7 @@ font-size: 11px; /*min-width: 395px;*/ margin-bottom: 25px; - display: inline-block; + /* display: inline-block;*/ } thead { @@ -1219,7 +1228,15 @@ pre.highlightedCode { list-style-type:decimal; } - + .navTop{ + float:right; + padding-right:5px; + padding-top:15px; + } + + .wrap .content .toc h3{ + border-bottom:none; + } /* end of screen media */ /* start of print media */ diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 044c458..9f745c5 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -443,7 +443,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, { int skipAhead = 0; static bool in_para = false; - + switch (atom->type()) { case Atom::AbstractLeft: break; @@ -1066,11 +1066,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, } sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); } - out() << "\n"; + out() << "
\n"; } #else out() << "\n"; + << "\">
\n"; #endif break; case Atom::SectionRight: @@ -1339,19 +1339,19 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } else { if (!s->members.isEmpty()) { - out() << "
\n"; + // out() << "
\n"; out() << "\n"; + << "\">
\n"; out() << "

" << protectEnc((*s).name) << "

\n"; generateSection(s->members, inner, marker, CodeMarker::Summary); } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; - out() << "
\n"; + // out() << "
\n"; out() << "\n"; + << "\">
\n"; out() << "

" << protectEnc(name) << "

\n"; generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); } @@ -1378,11 +1378,11 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, out() << "\n"; } - out() << "\n"; + out() << "
\n"; if (!inner->doc().isEmpty()) { - out() << "
\n" - << "
\n" // QTBUG-9504 + //out() << "
\n" + out() << "
\n" // QTBUG-9504 << "

" << "Detailed Description" << "

\n"; generateBody(inner, marker); out() << "
\n"; // QTBUG-9504 @@ -1392,7 +1392,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "
\n"; + //out() << "
\n"; if (!(*s).divClass.isEmpty()) out() << "
\n"; // QTBUG-9504 out() << "

" << protectEnc((*s).name) << "

\n"; @@ -1518,12 +1518,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - out() << "\n"; + out() << "
\n"; out() << "

Namespaces

\n"; generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); } if (moduleClassMap.contains(fake->name())) { - out() << "\n"; + out() << "
\n"; out() << "

Classes

\n"; generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); } @@ -1586,19 +1586,19 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->qmlSections(qml_cn,CodeMarker::Summary); s = sections.begin(); while (s != sections.end()) { - out() << "\n"; + out() << "
\n"; out() << "

" << protectEnc((*s).name) << "

\n"; generateQmlSummary(*s,fake,marker); ++s; } - out() << "\n"; + out() << "
\n"; out() << "

" << "Detailed Description" << "

\n"; generateBody(fake, marker); if (cn) generateQmlText(cn->doc().body(), cn, marker, fake->name()); generateAlsoList(fake, marker); - out() << "
\n"; + //out() << "
\n"; sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); s = sections.begin(); @@ -1622,7 +1622,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "\n"; + out() << "
\n"; out() << "

" << protectEnc((*s).name) << "

\n"; generateSectionList(*s, fake, marker, CodeMarker::Summary); ++s; @@ -1630,7 +1630,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) Text brief = fake->doc().briefText(); if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "\n"; + out() << "
\n"; out() << "
\n"; // QTBUG-9504 out() << "

" << "Detailed Description" << "

\n"; } @@ -1655,7 +1655,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "
\n"; + //out() << "
\n"; out() << "

" << protectEnc((*s).name) << "

\n"; NodeList::ConstIterator m = (*s).members.begin(); @@ -1801,9 +1801,10 @@ void HtmlGenerator::generateHeader(const QString& title, if (offlineDocs) { - out() << " "; + out() << " "; out() << "\n"; out() << "\n"; // narrow mainly for Creator + out() << " \n"; } else { @@ -2039,7 +2040,7 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = true; out() << "
\n"; - out() << "

Contents

\n"; + out() << "

Contents

\n"; sectionNumber.append("1"); out() << "
    \n"; @@ -2252,7 +2253,7 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - out() << "
    \n"; + //out() << "
    \n"; out() << "

    " << protectEnc(sections.at(i).name) << "

    \n"; NodeList::ConstIterator m = sections.at(i).members.begin(); @@ -2621,7 +2622,7 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, QMap::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - out() << "
    \n"; + //out() << "
    \n"; generateText(text, relative, marker); out() << "
      \n"; do { @@ -3828,7 +3829,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, out() << "

      "; out() << ""; generateSynopsis(node, relative, marker, CodeMarker::Detailed); - out() << "

      \n"; + out() << "
      \n"; } generateStatus(node, marker); diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 7ad78bd..e888bc4 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -49,6 +49,7 @@ HTML.postheader = "
    \n" \ " \n" \ "
  • Examples \n" \ @@ -57,7 +58,6 @@ HTML.postheader = "
    \n" \ "
  • Tutorials
  • \n" \ "
  • Demos
  • \n" \ "
  • QML Examples
  • \n" \ - "
  • QML Demos
  • \n" \ "
\n" \ " \n" \ " \n" \ -- cgit v0.12 From 51f5fdb75017edd4a66999be07d8e26240a5a091 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 1 Jul 2010 22:07:38 +0200 Subject: Updated WebKit to cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 Integrated changes: || || [Qt] Crash when destroying a QWebView with a QComboBox as its child. || || || Spatial Navigation: refactor spatial-navigation-utils.js to support testing nested frames deeper than one level || --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/ChangeLog | 8 ++++ src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit.pri | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 38 +++++++++++++++++++ .../qt/WebCoreSupport/QtFallbackWebPopup.cpp | 43 ++++++++++++---------- .../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h | 3 +- 7 files changed, 74 insertions(+), 24 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 8be0498..c44a95b 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -0eee8df53d1873669a9dda8f9c0340543258a316 +cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 1f067bf..14d6da3 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,11 @@ +2010-07-01 Simon Hausmann + + Rubber-stamped by Laszlo Gombos. + + [Qt][Symbian] Bumped up the maximum heap size to 96MB + + * WebKit.pri: + 2010-06-17 Alexis Menard Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 56e2c01..aa574b4 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 0eee8df53d1873669a9dda8f9c0340543258a316 + cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri index fcd2891..a080c43 100644 --- a/src/3rdparty/webkit/WebKit.pri +++ b/src/3rdparty/webkit/WebKit.pri @@ -30,7 +30,7 @@ building-libs { LIBS += -lQtWebKit symbian { TARGET.EPOCSTACKSIZE = 0x14000 // 80 kB - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB + TARGET.EPOCHEAPSIZE = 0x20000 0x6000000 // Min 128kB, Max 32MB } } } diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index acf1695..1eb7b11 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,41 @@ +2010-07-01 Bea Lam + + Reviewed by Simon Hausmann. + + [Qt] Doc improvements for QDeclarativeWebView + + * declarative/qdeclarativewebview.cpp: + +2010-07-01 Jocelyn Turcotte + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Create QComboBoxes when clicked and destroy on hide. + https://bugs.webkit.org/show_bug.cgi?id=41451 + + Currently a QComboBox is created for each RenderMenuList and + it gets destroyed either when the RenderMenuList or the + QWebView (its Qt parent) is destroyed. This cause a crash + when the QWebView is destroyed before the render tree (which + is kept in cache). + + This patch aim to destroy the QComboBox as soon as its popup + gets hidden, and likewise, create it only when the popup is + requested to be shown. + It also removes the unneeded reference to the QGraphicsProxyWidget, + destroying the QComboBox automatically destroys its bound + proxywidget. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopupCombo::hidePopup): + (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::hide): + (WebCore::QtFallbackWebPopup::destroyPopup): + (WebCore::QtFallbackWebPopup::populate): + * WebCoreSupport/QtFallbackWebPopup.h: + 2010-06-30 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index 1a87463..59ac87b 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -75,14 +75,12 @@ void QtFallbackWebPopupCombo::hidePopup() QComboBox::hidePopup(); - if (QGraphicsProxyWidget* proxy = graphicsProxyWidget()) - proxy->setVisible(false); - if (!m_ownerPopup.m_popupVisible) return; m_ownerPopup.m_popupVisible = false; m_ownerPopup.popupDidHide(); + m_ownerPopup.destroyPopup(); } bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event) @@ -102,19 +100,13 @@ bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event) QtFallbackWebPopup::QtFallbackWebPopup() : QtAbstractWebPopup() , m_popupVisible(false) - , m_combo(new QtFallbackWebPopupCombo(*this)) - , m_proxy(0) + , m_combo(0) { - connect(m_combo, SIGNAL(activated(int)), - SLOT(activeChanged(int)), Qt::QueuedConnection); } QtFallbackWebPopup::~QtFallbackWebPopup() { - // If we create a proxy, then the deletion of the proxy and the - // combo will be done by the proxy's parent (QGraphicsWebView) - if (!m_proxy && m_combo) - m_combo->deleteLater(); + destroyPopup(); } void QtFallbackWebPopup::show() @@ -125,17 +117,20 @@ void QtFallbackWebPopup::show() #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) TRAP_IGNORE(showS60BrowserDialog()); #else + + destroyPopup(); + m_combo = new QtFallbackWebPopupCombo(*this); + connect(m_combo, SIGNAL(activated(int)), + SLOT(activeChanged(int)), Qt::QueuedConnection); + populate(); m_combo->setCurrentIndex(currentIndex()); QRect rect = geometry(); if (QGraphicsWebView *webView = qobject_cast(pageClient()->pluginParent())) { - if (!m_proxy) { - m_proxy = new QGraphicsProxyWidget(webView); - m_proxy->setWidget(m_combo); - } else - m_proxy->setVisible(true); - m_proxy->setGeometry(rect); + QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); + proxy->setWidget(m_combo); + proxy->setGeometry(rect); } else { m_combo->setParent(pageClient()->ownerWidget()); m_combo->setGeometry(QRect(rect.left(), rect.top(), @@ -204,13 +199,21 @@ void QtFallbackWebPopup::showS60BrowserDialog() void QtFallbackWebPopup::hide() { - m_combo->hidePopup(); + // Destroying the QComboBox here cause problems if the popup is in the + // middle of its show animation. Instead we rely on the fact that the + // Qt::Popup window will hide itself on mouse events outside its window. } -void QtFallbackWebPopup::populate() +void QtFallbackWebPopup::destroyPopup() { - m_combo->clear(); + if (m_combo) { + m_combo->deleteLater(); + m_combo = 0; + } +} +void QtFallbackWebPopup::populate() +{ QStandardItemModel* model = qobject_cast(m_combo->model()); Q_ASSERT(model); diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h index 860e9fa..e6c371f 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h @@ -42,6 +42,8 @@ public: virtual void show(); virtual void hide(); + void destroyPopup(); + private slots: void activeChanged(int); @@ -49,7 +51,6 @@ private: friend class QtFallbackWebPopupCombo; bool m_popupVisible; QtFallbackWebPopupCombo* m_combo; - QGraphicsProxyWidget* m_proxy; void populate(); #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) -- cgit v0.12 From a02de048753aeb9e4c6811bf7689801c59d3c236 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 2 Jul 2010 11:21:55 +1000 Subject: Fix docs to link to the new QML Viewer page instead of the Runtime page where applicable, and remove or rename references to 'qml' tool. Also improve QML Viewer docs. --- doc/src/declarative/examples.qdoc | 13 ++++++++++--- doc/src/declarative/extending-tutorial.qdoc | 14 ++++++++------ doc/src/declarative/focus.qdoc | 2 +- doc/src/declarative/modules.qdoc | 4 ++-- doc/src/declarative/network.qdoc | 4 ++-- doc/src/declarative/qdeclarativedebugging.qdoc | 8 ++++---- doc/src/declarative/qdeclarativei18n.qdoc | 8 ++++---- doc/src/declarative/qml-intro.qdoc | 10 +++++++++- doc/src/declarative/qmlviewer.qdoc | 4 ++-- doc/src/declarative/tutorial.qdoc | 4 ++-- src/declarative/qml/qdeclarativeengine.cpp | 3 +-- 11 files changed, 45 insertions(+), 29 deletions(-) diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 587cdf2..8a24228 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -36,11 +36,18 @@ Qt includes a set of examples and demos that show how to use various aspects of QML. The examples are small demonstrations of particular QML components, while the demos contain more complete and functional applications. -To run the examples and demos, you can use Qt Creator or the included \l {Qt Declarative UI Runtime}{qmlviewer} -command-line application. For example, from your build directory, run: +To run the examples and demos, open them in Qt Creator or use the included +\l {QML Viewer} tool. The \l {QML Viewer} can be run from the command line: \code - bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml + qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml +\endcode + +On Mac OS X, you can run the included "QMLViewer" application from the +Finder, or use the command line: + +\code + QMLViewer.app/Contents/MacOS/QMLViewer $QTDIR/demos/declarative/samegame/samegame.qml \endcode diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index 0cb3a7d..2cf00b9 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -116,9 +116,9 @@ Now we can build and run the application. Try it yourself with the code in Qt's \example declarative/tutorials/extending/chapter1-basics At the moment, the \c app.qml is run from within a C++ application. -This may seem odd if you're used to running QML files with the standard \c qml tool. +This may seem odd if you're used to running QML files with the \l {QML Viewer}. Later on, we'll show how to create a plugin so that you can run \c app.qml using the -\c qml tool instead. +\l {QML Viewer} instead. */ @@ -301,8 +301,8 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom Currently the \c Musician and \c Instrument types are used by \c app.qml, which is displayed using a QDeclarativeView in a C++ application. An alternative way to use our QML extension is to create a plugin library to make it available -to the QML engine. This means we could load \c app.qml using the standard \c qml tool -(or some other QML runtime application) instead of writing a \c main.cpp file and +to the QML engine. This means we could load \c app.qml using the \l {QML Viewer} +(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and loading our own C++ application. To create a plugin library, we need: @@ -337,12 +337,14 @@ of the example project) can be found in the "lib" subdirectory: \quotefile declarative/tutorials/extending/chapter5-plugins/qmldir Now we have a plugin, and instead of having a main.cpp and an executable, we can build -the project and then run the QML file directly using the \c qml tool: +the project and then load the QML file in the \l {QML Viewer}: \code - qml app.qml + qmlviewer app.qml \endcode +(On Mac OS X, you can launch the "QMLViewer" application instead.) + Notice the "import Music 1.0" statement has disappeared from \c app.qml. This is because the \c qmldir file is in the same directory as \c app.qml: this is equivalent to having Musician.qml and Instrument.qml files inside the project directory, which could both diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index cc546c0..0dd5eb3 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -87,7 +87,7 @@ Text { An \l Item requests focus by setting the \c {Item::focus} property to true. For very simple cases simply setting the \c {Item::focus} property is sometimes -sufficient. If we run the following example with the \l {Qt Declarative UI Runtime}{qml} tool, we see that +sufficient. If we run the following example with the \l {QML Viewer}, we see that the \c {keyHandler} element has \e {active focus} and pressing the 'A', 'B' or 'C' keys modifies the text appropriately. diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 02a2f5f..a77c64e 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -72,7 +72,7 @@ The second exception is explained in more detail in the section below on Namespa \section2 The Import Path Installed modules are searched for on the import path. -The \c -I option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path. +The \c -I option to the \l {QML Viewer} adds paths to the import path. From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to using \l QDeclarativeEngine::addImportPath(). @@ -122,7 +122,7 @@ to the module. of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows. By default the engine searches for the plugin library in the directory containing the \c qmldir -file. The \c -P option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the +file. The \c -P option to the \l {QML Viewer} adds paths to the plugin search path. From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to using \l QDeclarativeEngine::addPluginPath(). diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index b0d19e2..60359de 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -54,7 +54,7 @@ Network transparency is supported throughout QML, for example: \o WebViews - the \c url property of WebView (obviously!) \endlist -Even QML types themselves can be on the network - if the \l {Qt Declarative UI Runtime}{qml} tool is used to load +Even QML types themselves can be on the network - if the \l {QML Viewer} is used to load \tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file. For example if the qmldir file contains the line "World World.qml", it will load @@ -119,7 +119,7 @@ All network access from QML is managed by a QNetworkAccessManager set on the QDe By default, this is an unmodified Qt QNetworkAccessManager. You may set a different manager by providing a QDeclarativeNetworkAccessManagerFactory and setting it via QDeclarativeEngine::setNetworkAccessManagerFactory(). -For example, the \l {Qt Declarative UI Runtime}{qml} tool sets a QDeclarativeNetworkAccessManagerFactory which +For example, the \l {QML Viewer} sets a QDeclarativeNetworkAccessManagerFactory which creates QNetworkAccessManager that trusts HTTP Expiry headers to avoid network cache checks, allows HTTP Pipelining, adds a persistent HTTP CookieJar, a simple disk cache, and supports proxy settings. diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index da6e407..ea21852 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -47,7 +47,7 @@ Rectangle { When a transition doesn't look quite right, it can be helpful to view it in slow motion to see what is happening more clearly. This functionality is supported -in the \l {Qt Declarative UI Runtime}{qmlviewer} tool: to enable this, +in the \l {QML Viewer} tool: to enable this, click on the "Debugging" menu, then "Slow Down Animations". @@ -64,7 +64,7 @@ import Qt 4.7 Rectangle { width: 100; height: 100 } \endqml -If you set \c {QML_IMPORT_TRACE=1} before running the \l {Qt Declarative UI Runtime}{qmlviewer} +If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer} (or your QML C++ application), you will see output similar to this: \code @@ -85,11 +85,11 @@ show QML debugging information and options for your application, including object inspection, property monitoring and application frame-rate analysis. Creator can be used to debug both local and remote QML applications. To -enable remote debugging, start the \l {Qt Declarative UI Runtime}{qml} tool +enable remote debugging, start the \l {QML Viewer} on the remote device with a debugging port defined, like this: \code - QML_DEBUG_SERVER_PORT=3768 qml myqmlfile.qml + QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml \endcode In Creator, open the project settings pane and set the server and port diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 40f7919..b6e6c6e 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -49,7 +49,7 @@ capabilities are described more fully in: \o \l {Qt Linguist Manual} \endlist -You can test a translation with the \l {Qt Declarative UI Runtime}{qml} tool using the -translation option. +You can test a translation with the \l {QML Viewer} using the -translation option. \section1 Example @@ -61,8 +61,8 @@ hello.qml: import Qt 4.7 Rectangle { - width: 200; height: 200 - Text { text: qsTr("Hello"); anchors.centerIn: parent } + width: 200; height: 200 + Text { text: qsTr("Hello"); anchors.centerIn: parent } } \endqml @@ -76,7 +76,7 @@ a translation and create the release file \c hello.qm. Finally, we can test the translation: \code -qml -translation hello.qm hello.qml +qmlviewer -translation hello.qm hello.qml \endcode diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index ac79496..21ce2dd 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -105,9 +105,17 @@ This is a valid QML script. To run it, copy it and save it to a file, say myexample.qml, and on the command line run the command \code - qml myexample.qml + qmlviewer myexample.qml \endcode +On Mac OS X, open the "QMLViewer" application instead and open the +\c myexample.qml file, or run it from the command line: + + \code + QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml + \endcode + + It will create a very boring rectangle in its own window. diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index efff9cc..5efc0ce 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -42,7 +42,7 @@ deployment of QML applications. In those cases, the QML runtime should be invoke from a Qt application instead; see \l {Qt Declarative UI Runtime} for more information. -The viewer is located at QTDIR/bin/qmlviewer. To load a \c .qml file +The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file with the viewer, run the viewer and select the file to be opened, or provide the file path on the command line: @@ -50,7 +50,7 @@ file path on the command line: qmlviewer myqmlfile.qml \endcode -On Mac OS X, the QML Viewer application is named \c QMLViewer.app instead. You +On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You can launch the viewer by opening the QMLViewer application from the Finder, or from the command line: diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index c884486..7a97eb1 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -101,11 +101,11 @@ The \c font.pointSize and \c font.bold properties are related to fonts and use t \section2 Viewing the example -To view what you have created, run the \l{Qt Declarative UI Runtime}{qml} tool (located in the \c bin directory) with your filename as the first argument. +To view what you have created, run the \l{QML Viewer} tool (located in the \c bin directory) with your filename as the first argument. For example, to run the provided completed Tutorial 1 example from the install location, you would type: \code -bin/qml $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml +bin/qmlviewer $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml \endcode */ diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8b15ae9..aa3c8d9 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1728,8 +1728,7 @@ void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const /*! \qmlmethod Qt::quit() This function causes the QDeclarativeEngine::quit() signal to be emitted. -Within the \l {Qt Declarative UI Runtime}{qml} application this causes the -launcher application to exit. +Within the \l {QML Viewer}, this causes the launcher application to exit. */ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e) -- cgit v0.12 From 2497d922f06404f6fd1c65c6c685fbce173303ae Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 2 Jul 2010 13:42:56 +1000 Subject: fix doc links --- doc/src/declarative/advtutorial.qdoc | 2 +- doc/src/declarative/globalobject.qdoc | 2 +- doc/src/examples/qml-webbrowser.qdoc | 2 +- src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeloader.cpp | 2 +- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 5 +++-- src/declarative/util/qdeclarativeview.cpp | 2 +- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- src/imports/gestures/qdeclarativegesturearea.cpp | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 9c72e95..2c3610c 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -164,7 +164,7 @@ The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. +\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. \o If \c createObject() returned null (i.e. if there was an error while loading the object), print the error information. diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 36d91ec..a9aee2f 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -35,7 +35,7 @@ Contains all the properties of the JavaScript global object, plus: \section1 Qt Object -The \l{Qt}{Qt object} provides useful enums and functions from Qt, for use in all QML +The \l{QmlGlobalQtObject}{Qt object} provides useful enums and functions from Qt, for use in all QML files. \section1 XMLHttpRequest diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc index da6f600..d322b02 100644 --- a/doc/src/examples/qml-webbrowser.qdoc +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \title Web Browser + \title QML Web Browser \example demos/declarative/webbrowser This demo shows how to write a simple web browser in QML by combining the diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9a17d78..352c3df 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2144,7 +2144,7 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const \property QDeclarativeItem::baselineOffset \brief The position of the item's baseline in local coordinates. - The baseline of a Text item is the imaginary line on which the text + The baseline of a \l Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text. diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index c8c9e44..e745ca6 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -119,7 +119,7 @@ void QDeclarativeLoaderPrivate::initResize() property, or loaded from a URL via the \l source property. Loader can be used to delay the creation of a component until it is required. - For example, this loads "Page1.qml" as a component into the \l Loader element + For example, this loads "Page1.qml" as a component into the Loader element when the \l MouseArea is clicked: \code diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c6566ff..c066f11 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -203,7 +203,7 @@ QString QDeclarativeTextEdit::text() const Sets the font size in pixels. Using this function makes the font device dependent. - Use \l pointSize to set the size of the font in a device independent manner. + Use \l font.pointSize to set the size of the font in a device independent manner. */ /*! diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index aa3c8d9..8bf7450 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -151,6 +151,7 @@ void QDeclarativeEnginePrivate::defineModule() } /*! +\keyword QmlGlobalQtObject \qmlclass Qt QDeclarativeEnginePrivate \brief The QML global Qt object provides useful enums and functions from Qt. @@ -1077,7 +1078,7 @@ If you are certain the files will be local, you could simplify to: \snippet doc/src/snippets/declarative/componentCreation.js 2 To create a QML object from an arbitrary string of QML (instead of a file), -use \l{Qt::createQmlObject()}{Qt.createQmlObject()}. +use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. */ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QScriptEngine *engine) @@ -1124,7 +1125,7 @@ Each object in this array has the members \c lineNumber, \c columnNumber, \c fil Note that this function returns immediately, and therefore may not work if the \a qml string loads new components (that is, external QML files that have not yet been loaded). -If this is the case, consider using \l{Qt::createComponent()}{Qt.createComponent()} instead. +If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. */ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 0414e65..12a8d3a 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -611,7 +611,7 @@ void QDeclarativeView::timerEvent(QTimerEvent* e) } } -/*! \reimp */ +/*! \internal */ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e) { Q_D(QDeclarativeView); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 0692aaa..5583007 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -589,7 +589,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty