[Marble-commits] KDE/kdeedu/marble/src/lib/graphicsview
Bastian Holst
bastianholst at gmx.de
Wed Mar 24 12:13:55 CET 2010
SVN commit 1106969 by bholst:
Using QPixmapCache::Key for MarbleGraphicsItem-caching now, if Qt-version >= 4.6.0
M +8 -0 MarbleGraphicsItem.cpp
M +7 -1 MarbleGraphicsItem_p.h
--- trunk/KDE/kdeedu/marble/src/lib/graphicsview/MarbleGraphicsItem.cpp #1106968:1106969
@@ -72,7 +72,11 @@
{
p()->ensureValidCacheKey();
QPixmap cachePixmap;
+#if QT_VERSION < 0x040600
bool pixmapAvailable = QPixmapCache::find( p()->m_cacheKey, cachePixmap );
+#else
+ bool pixmapAvailable = QPixmapCache::find( p()->m_cacheKey, &cachePixmap );
+#endif
if ( !pixmapAvailable ) {
QSize neededPixmapSize = size().toSize() + QSize( 1, 1 ); // adding a pixel for rounding errors
@@ -100,7 +104,11 @@
}
}
// Update the pixmap in cache
+#if QT_VERSION < 0x040600
QPixmapCache::insert( p()->m_cacheKey, cachePixmap );
+#else
+ p()->m_cacheKey = QPixmapCache::insert( cachePixmap );
+#endif
}
foreach( const QPointF& position, p()->positions() ) {
--- trunk/KDE/kdeedu/marble/src/lib/graphicsview/MarbleGraphicsItem_p.h #1106968:1106969
@@ -24,6 +24,7 @@
#include<QtCore/QSize>
#include<QtCore/QSizeF>
#include<QtCore/QRect>
+#include<QtGui/QPixmapCache>
namespace Marble
{
@@ -95,11 +96,13 @@
void ensureValidCacheKey()
{
+#if QT_VERSION < 0x040600
if( m_cacheKey.isNull() ) {
static unsigned int key = 0;
m_cacheKey = QString( "MarbleGraphicsItem:" ) + QString::number( key );
key++;
}
+#endif
}
QList<QRectF> boundingRects() const
@@ -155,8 +158,11 @@
MarbleGraphicsItem::CacheMode m_cacheMode;
- // TODO: Substitute this by QPixmapCache::Key once it is available.
+#if QT_VERSION < 0x040600
QString m_cacheKey;
+#else
+ QPixmapCache::Key m_cacheKey;
+#endif
bool m_visibility;
More information about the Marble-commits
mailing list