From fac227f609e544f8f55aca8447b4328d6534407a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 17 Jun 2010 07:43:41 +0200 Subject: Speed up calls to QPainter::setCompositionMode when the mode is unchanged Avoid marking the composition mode as dirty and calling into the extended engine if the composition mode that the application wants to set is the same that's currently used. Reviewed-by: Gunnar --- src/gui/painting/qpainter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d17c711..71bc990 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2391,6 +2391,8 @@ void QPainter::setCompositionMode(CompositionMode mode) qWarning("QPainter::setCompositionMode: Painter not active"); return; } + if (d->state->composition_mode == mode) + return; if (d->extended) { d->state->composition_mode = mode; d->extended->compositionModeChanged(); -- cgit v0.12 From 594900e68f8e264facbe8c75eaf2b857240bc072 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Jun 2010 09:11:18 +0200 Subject: Doc: Specified QAbstractEventDispatcher::filterEvent()'s argument types. Task-number: QTBUG-10904 Reviewed-by: Morten Engvoldsen --- src/corelib/kernel/qabstracteventdispatcher.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index ee3c4f2..bcf4477 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -393,6 +393,27 @@ void QAbstractEventDispatcher::closingDown() \snippet doc/src/snippets/code/src_corelib_kernel_qabstracteventdispatcher.cpp 0 + Note that the type of the \a message is platform dependent. The + following table shows the \a {message}'s type on Windows, Mac, and + X11. You can do a static cast to these types. + + \table + \header + \o Platform + \o type + \row + \o Windows + \o MSG + \row + \o X11 + \o XEvent + \row + \o Mac + \o NSEvent + \endtable + + + \sa setEventFilter(), filterEvent() */ @@ -434,6 +455,9 @@ QAbstractEventDispatcher::EventFilter QAbstractEventDispatcher::setEventFilter(E compatibility with any extensions that may be used in the application. + Note that the type of \a message is platform dependent. See + QAbstractEventDispatcher::EventFilter for details. + \sa setEventFilter() */ bool QAbstractEventDispatcher::filterEvent(void *message) -- cgit v0.12 From e4fbdd4fde9b8d2acc13268b44caa57405c3db1a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 17 Jun 2010 10:24:49 +0200 Subject: Typo in qcleanlooksstyle.cpp Task-number: QTBUG-11506 --- src/gui/styles/qcleanlooksstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 883f511..ada5293 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -884,7 +884,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, } painter->restore(); break; -#ifndef QT_NO_LINEDIT +#ifndef QT_NO_LINEEDIT case PE_FrameLineEdit: // fall through #endif // QT_NO_LINEEDIT -- cgit v0.12 From cf74e83d8b79c4840c073bb7dc387045b1210df8 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Jun 2010 11:14:59 +0200 Subject: Doc: Small change to QAbstractItemDelegate::editorEvent() Task-number: QTBUG-2446 Reviewed-by: Marius Bugge Monsen --- src/gui/itemviews/qabstractitemdelegate.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp index 775bf7d..0ea6d67 100644 --- a/src/gui/itemviews/qabstractitemdelegate.cpp +++ b/src/gui/itemviews/qabstractitemdelegate.cpp @@ -291,8 +291,14 @@ void QAbstractItemDelegate::updateEditorGeometry(QWidget *, } /*! - Whenever an event occurs, this function is called with the \a event - \a model \a option and the \a index that corresponds to the item being edited. + When editing of an item starts, this function is called with the + \a event that triggered the editing, the \a model, the \a index of + the item, and the \a option used for rendering the item. + + Mouse events are sent to editorEvent() even if they don't start + editing of the item. This can, for instance, be useful if you wish + to open a context menu when the right mouse button is pressed on + an item. The base implementation returns false (indicating that it has not handled the event). -- cgit v0.12 From 4cdeac4d4780e163eee3a1916683766f16747f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 17 Jun 2010 10:38:06 +0200 Subject: Optimized QPixmap::fromImage for raster pixmaps. If we know that the QImage is ARGB32 or ARGB32_Premultiplied and doesn't contain any alpha pixels we can treat it as RGB32 when doing the conversion. Reviewed-by: Gunnar Sletta --- src/gui/image/qpixmap_raster.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 9dc15fc..4f32d2f 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -192,10 +192,23 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, } #endif - if (!sourceImage.hasAlphaChannel() - || ((flags & Qt::NoOpaqueDetection) == 0 - && !const_cast(sourceImage).data_ptr()->checkForAlphaPixels())) { + if (!sourceImage.hasAlphaChannel()) { image = sourceImage.convertToFormat(opaqueFormat); + } else if ((flags & Qt::NoOpaqueDetection) == 0 + && !const_cast(sourceImage).data_ptr()->checkForAlphaPixels()) + { + // image has alpha format but is really opaque, so try to do a + // more efficient conversion + if (sourceImage.format() == QImage::Format_ARGB32 + || sourceImage.format() == QImage::Format_ARGB32_Premultiplied) + { + QImage rgbImage(sourceImage.bits(), sourceImage.width(), sourceImage.height(), + QImage::Format_RGB32); + image = rgbImage.convertToFormat(opaqueFormat); + image.detach(); + } else { + image = sourceImage.convertToFormat(opaqueFormat); + } } else { image = sourceImage.convertToFormat(alphaFormat); } -- cgit v0.12 From 21f5de51e0c49006f5be75ef64675145b9d8b5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 17 Jun 2010 10:59:31 +0200 Subject: Don't do opaque detection when copying a sub-rect of a QPixmap. If the pixmap is non-opaque in the first place most likely a reasonably sized sub-rect is also non-opaque, so this check is a waste in 90 % of the cases. Reviewed-by: Gunnar Sletta --- src/gui/image/qpixmapdata.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index ea4fe6b..31ca909 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::AutoColor); + fromImage(data->toImage().copy(rect), Qt::NoOpaqueDetection); } bool QPixmapData::scroll(int dx, int dy, const QRect &rect) -- cgit v0.12