diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-10 08:26:14 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-10 08:26:14 (GMT) |
commit | 3e7f05c1a07441a4b0e9ade893c519a050e5b8de (patch) | |
tree | db54af72e0e8f241a8c01ae34bfa9124299b5c24 /src/gui | |
parent | f57a2756ebfb48c2fad94c0c319fa181d2af4dfd (diff) | |
parent | 4935ec52fc07d4aaa7ae594cfe9986e25ca62dcb (diff) | |
download | Qt-3e7f05c1a07441a4b0e9ade893c519a050e5b8de.zip Qt-3e7f05c1a07441a4b0e9ade893c519a050e5b8de.tar.gz Qt-3e7f05c1a07441a4b0e9ade893c519a050e5b8de.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
(ODBC) Use wchar_t instead of assuming 2 bytes.
Fixed some global QIcon/QPixmap instances that leaked handles on X11.
Speed up QListView test
QListView: fix crash when hiding many of the lasts item in a QListView
Fixed warnings and crash when painting graphics effects outside scene.
Stabilize QLineEdit test on X11
(sqlite) Allow shared cache mode
Make generate uid3 (symbian) work on 64 bit host platform.
Updated the docs for QPainter::begin/endNativePainting()
Compile fix for network benchmarks.
Add a pixmap modification hook to blur pixmap filter cache
Delete benchmark examples (qtestlib-simple and qtwidgets).
Restructure tests/benchmarks directory.
Fixed QImagReader::setAutoDetectImageFormat() to work with plugins.
QLineEdit: regression: read-only line edits would eat shortcuts.
QGraphicsItem: Do not crash at exit if there is static QGraphicsItem.
Make QTextCodec reentrant.
Fixed bug where GL widget was not fully updated on Vista.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 3 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 17 | ||||
-rw-r--r-- | src/gui/image/qimagereader.cpp | 28 | ||||
-rw-r--r-- | src/gui/image/qpixmapfilter.cpp | 14 | ||||
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 28 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 23 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 2 |
10 files changed, 90 insertions, 31 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b4e19d1..39c41c4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1392,7 +1392,8 @@ QGraphicsItem::~QGraphicsItem() } delete d_ptr->transformData; - qt_dataStore()->data.remove(this); + if (QGraphicsItemCustomDataStore *dataStore = qt_dataStore()) + dataStore->data.remove(this); } /*! diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index ac1d303..bf6eb8d 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -104,6 +104,15 @@ QT_BEGIN_NAMESPACE static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +static void qt_cleanup_icon_cache(); +typedef QCache<QString, QIcon> IconCache; +Q_GLOBAL_STATIC_WITH_INITIALIZER(IconCache, qtIconCache, qAddPostRoutine(qt_cleanup_icon_cache)) + +static void qt_cleanup_icon_cache() +{ + qtIconCache()->clear(); +} + QIconPrivate::QIconPrivate() : engine(0), ref(1), serialNum(serialNumCounter.fetchAndAddRelaxed(1)), @@ -963,15 +972,13 @@ QString QIcon::themeName() */ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) { - static QCache <QString, QIcon> iconCache; - QIcon icon; - if (iconCache.contains(name)) { - icon = *iconCache.object(name); + if (qtIconCache()->contains(name)) { + icon = *qtIconCache()->object(name); } else { QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name)); - iconCache.insert(name, cachedIcon); + qtIconCache()->insert(name, cachedIcon); icon = *cachedIcon; } diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index c9e015c..9320cfc 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -263,25 +263,37 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, device->seek(pos); } - if (!handler && !testFormat.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { + if (!handler && !testFormat.isEmpty() && !ignoresFormatAndExtension) { // check if any plugin supports the format (they are not allowed to // read from the device yet). const qint64 pos = device ? device->pos() : 0; - for (int i = 0; i < keys.size(); ++i) { - if (i != suffixPluginIndex) { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); - if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { + + if (autoDetectImageFormat) { + for (int i = 0; i < keys.size(); ++i) { + if (i != suffixPluginIndex) { + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); + if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { #ifdef QIMAGEREADER_DEBUG - qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format"; + qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format"; #endif - handler = plugin->create(device, testFormat); - break; + handler = plugin->create(device, testFormat); + break; + } } } + } else { + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QLatin1String(testFormat))); + if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { +#ifdef QIMAGEREADER_DEBUG + qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format"; +#endif + handler = plugin->create(device, testFormat); + } } if (device && !device->isSequential()) device->seek(pos); } + #endif // QT_NO_LIBRARY // if we don't have a handler yet, check if we have built-in support for diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 37a6a18..7cf942c 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -422,6 +422,9 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if(d->kernelWidth<=0 || d->kernelHeight <= 0) return; + if (src.isNull()) + return; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapConvolutionFilter *convolutionFilter = static_cast<QPixmapConvolutionFilter*>(filter); @@ -902,6 +905,9 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap if (!painter->isActive()) return; + if (src.isNull()) + return; + QRectF srcRect = rect; if (srcRect.isNull()) srcRect = src.rect(); @@ -1082,6 +1088,10 @@ void QPixmapColorizeFilter::setStrength(qreal strength) void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { Q_D(const QPixmapColorizeFilter); + + if (src.isNull()) + return; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapColorizeFilter *colorizeFilter = static_cast<QPixmapColorizeFilter*>(filter); @@ -1312,6 +1322,10 @@ void QPixmapDropShadowFilter::draw(QPainter *p, const QRectF &src) const { Q_D(const QPixmapDropShadowFilter); + + if (px.isNull()) + return; + QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ? static_cast<QPaintEngineEx *>(p->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapDropShadowFilter *dropShadowFilter = static_cast<QPixmapDropShadowFilter*>(filter); diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 19b1e8c..b2def39 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2160,7 +2160,7 @@ void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) } else { if (flowPositions.isEmpty()) return; - const int max = flowPositions.count() - 1; + const int max = scrollValueMap.count() - 1; if (vertical && flow() == QListView::TopToBottom && dy != 0) { int currentValue = qBound(0, verticalValue, max); int previousValue = qBound(0, currentValue + dy, max); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 3355272..0a4869b 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -928,7 +928,11 @@ const QString qt_reg_winclass(QWidget *w) // register window class uint style; bool icon; QString cname; - if (flags & Qt::MSWindowsOwnDC) { + if (qt_widget_private(w)->isGLWidget) { + cname = QLatin1String("QGLWidget"); + style = CS_DBLCLKS; + icon = true; + } else if (flags & Qt::MSWindowsOwnDC) { cname = QLatin1String("QWidgetOwnDC"); style = CS_DBLCLKS; #ifndef Q_WS_WINCE @@ -1021,7 +1025,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class } wc.hCursor = 0; #ifndef Q_WS_WINCE - wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW); + wc.hbrBackground = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW); #else wc.hbrBackground = 0; #endif @@ -3616,13 +3620,19 @@ bool QETWidget::translatePaintEvent(const MSG &msg) return true; setAttribute(Qt::WA_PendingUpdate, false); - const QRegion dirtyInBackingStore(qt_dirtyRegion(this)); - // Make sure the invalidated region contains the region we're about to repaint. - // BeginPaint will set the clip to the invalidated region and it is impossible - // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient - // as it may return an invalid context (especially on Windows Vista). - if (!dirtyInBackingStore.isEmpty()) - InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false); + + if (d_func()->isGLWidget) { + if (d_func()->usesDoubleBufferedGLContext) + InvalidateRect(internalWinId(), 0, false); + } else { + const QRegion dirtyInBackingStore(qt_dirtyRegion(this)); + // Make sure the invalidated region contains the region we're about to repaint. + // BeginPaint will set the clip to the invalidated region and it is impossible + // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient + // as it may return an invalid context (especially on Windows Vista). + if (!dirtyInBackingStore.isEmpty()) + InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false); + } PAINTSTRUCT ps; d_func()->hd = BeginPaint(internalWinId(), &ps); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index c072d9d..2a19d23 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -192,6 +192,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , inDirtyList(0) , isScrolled(0) , isMoved(0) + , isGLWidget(0) , usesDoubleBufferedGLContext(0) #if defined(Q_WS_X11) , picture(0) @@ -200,7 +201,6 @@ QWidgetPrivate::QWidgetPrivate(int version) , nativeGesturePanEnabled(0) #elif defined(Q_WS_MAC) , needWindowChange(0) - , isGLWidget(0) , window_event(0) , qd_hd(0) #endif diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 4b62074..b421d30 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -683,6 +683,7 @@ public: uint inDirtyList : 1; uint isScrolled : 1; uint isMoved : 1; + uint isGLWidget : 1; uint usesDoubleBufferedGLContext : 1; // *************************** Platform specific ************************************ @@ -714,7 +715,6 @@ public: #elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC // This is new stuff uint needWindowChange : 1; - uint isGLWidget : 1; // Each wiget keeps a list of all its child and grandchild OpenGL widgets. // This list is used to update the gl context whenever a parent and a granparent diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index bf12c6b..3bcaf8c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1986,12 +1986,25 @@ QPaintEngine *QPainter::paintEngine() const endNativePainting(). Note that only the states the underlying paint engine changes will be reset - to their respective default states. If, for example, the OpenGL polygon - mode is changed by the user inside a beginNativePaint()/endNativePainting() - block, it will not be reset to the default state by endNativePainting(). + to their respective default states. The states we reset may change from + release to release. The following states are currently reset in the OpenGL + 2 engine: - Here is an example that shows intermixing of painter commands - and raw OpenGL commands: + \list + \i blending is disabled + \i the depth, stencil and scissor tests are disabled + \i the active texture unit is reset to 0 + \i the depth mask, depth function and the clear depth are reset to their + default values + \i the stencil mask, stencil operation and stencil function are reset to + their default values + \i the current color is reset to solid white + \endlist + + If, for example, the OpenGL polygon mode is changed by the user inside a + beginNativePaint()/endNativePainting() block, it will not be reset to the + default state by endNativePainting(). Here is an example that shows + intermixing of painter commands and raw OpenGL commands: \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21 diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index b0a64ea..db099e8 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1371,6 +1371,8 @@ bool QLineControl::processEvent(QEvent* ev) processInputMethodEvent(static_cast<QInputMethodEvent*>(ev)); break; #ifndef QT_NO_SHORTCUT case QEvent::ShortcutOverride:{ + if (isReadOnly()) + return false; QKeyEvent* ke = static_cast<QKeyEvent*>(ev); if (ke == QKeySequence::Copy || ke == QKeySequence::Paste |