diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-13 00:50:44 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-13 00:50:44 (GMT) |
commit | 50711dd7aa22052eff58431d9f4e95e1a688047e (patch) | |
tree | 748ba00ade4cb880739dd88990b5c827b312296a /src/gui | |
parent | 47760d59d57f548d5816ae43e456c86e01146491 (diff) | |
parent | d45c45432ccd0a74c67e70ce5fc3a09f35923c26 (diff) | |
download | Qt-50711dd7aa22052eff58431d9f4e95e1a688047e.zip Qt-50711dd7aa22052eff58431d9f4e95e1a688047e.tar.gz Qt-50711dd7aa22052eff58431d9f4e95e1a688047e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (34 commits)
Fix TextEdit and TextInput input panel support for mode RSIP_OnMouseClickAndAlreadyFocused
Fix for graphics widget in the background stealing declarative item's focus
Fix broken benchmarks.
Possibly fix autotest
Correctly assign bool to variant properties
Improve Image docs. Move all fillMode image examples to fillMode
Flickable small API changes.
Reset the dragDropItem to 0 when the item dies while dragging on top it.
Avoid warning (and possible future crash) upon reload.
Don't pass sequential (QNetworkReply) to image reader, it doesn't work well enough.
Stop GIF handler claiming it can report Size for sequential devices,
Use raster graphicssystem for qml.app on OS X.
Add missing test, qdeclarativelayoutitem, to declarative.pro
Sorted the tests list in declarative.pro
Bail out early if the same target value is reassigned to a Behavior.
Correctly position any input method popups for TextInput.
Correctly resize TextInput in the presence of preedit text.
Apply signal handler changes immediately.
Remove unused image
Qt.widgets was removed, point to graphics layouts example
...
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 8 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmapcache.cpp | 43 | ||||
-rw-r--r-- | src/gui/image/qpixmapcache.h | 10 | ||||
-rw-r--r-- | src/gui/image/qpixmapcache_p.h | 2 |
5 files changed, 59 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0d4e48a..7abd5f6 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -690,6 +690,10 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) if (item == lastMouseGrabberItem) lastMouseGrabberItem = 0; + // Reset the current drop item + if (item == dragDropItem) + dragDropItem = 0; + // Reenable selectionChanged() for individual items --selectionChanging; if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize) @@ -1316,10 +1320,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou setFocus = true; break; } - if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { + if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable))) { if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { setFocus = true; - if (item != q->focusItem()) + if (item != q->focusItem() && item->d_ptr->mouseSetsFocus) q->setFocusItem(item, Qt::MouseFocusReason); break; } diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 0bba7e9..9519ca0 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1819,8 +1819,6 @@ void QGraphicsView::centerOn(const QGraphicsItem *item) void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin) { Q_D(QGraphicsView); - Q_UNUSED(xmargin); - Q_UNUSED(ymargin); qreal width = viewport()->width(); qreal height = viewport()->height(); QRectF viewRect = d->matrix.mapRect(rect); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 5fc605a..7a6a73f 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#define Q_TEST_QPIXMAPCACHE #include "qpixmapcache.h" #include "qobject.h" #include "qdebug.h" @@ -194,6 +195,9 @@ public: static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key); + QList< QPair<QString,QPixmap> > allPixmaps() const; + void flushDetachedPixmaps(bool nt); + private: int *keyArray; int theid; @@ -235,10 +239,9 @@ QPMCache::~QPMCache() When the last pixmap has been deleted from the cache, kill the timer so Qt won't keep the CPU from going into sleep mode. */ -void QPMCache::timerEvent(QTimerEvent *) +void QPMCache::flushDetachedPixmaps(bool nt) { int mc = maxCost(); - bool nt = totalCost() == ps; setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1); setMaxCost(mc); ps = totalCost(); @@ -252,6 +255,12 @@ void QPMCache::timerEvent(QTimerEvent *) ++it; } } +} + +void QPMCache::timerEvent(QTimerEvent *) +{ + bool nt = totalCost() == ps; + flushDetachedPixmaps(nt); if (!size()) { killTimer(theid); @@ -263,6 +272,7 @@ void QPMCache::timerEvent(QTimerEvent *) } } + QPixmap *QPMCache::object(const QString &key) const { QPixmapCache::Key cacheKey = cacheKeys.value(key); @@ -422,6 +432,20 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key) return key->d; } +QList< QPair<QString,QPixmap> > QPMCache::allPixmaps() const +{ + QList< QPair<QString,QPixmap> > r; + QHash<QString, QPixmapCache::Key>::const_iterator it = cacheKeys.begin(); + while (it != cacheKeys.end()) { + QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(it.value()); + if (ptr) + r.append(QPair<QString,QPixmap>(it.key(),*ptr)); + ++it; + } + return r; +} + + Q_GLOBAL_STATIC(QPMCache, pm_cache) int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize() @@ -633,4 +657,19 @@ void QPixmapCache::clear() } } +void QPixmapCache::flushDetachedPixmaps() +{ + pm_cache()->flushDetachedPixmaps(true); +} + +int QPixmapCache::totalUsed() +{ + return (pm_cache()->totalCost()+1023) / 1024; +} + +QList< QPair<QString,QPixmap> > QPixmapCache::allPixmaps() +{ + return pm_cache()->allPixmaps(); +} + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index 50a9369..e9c8c15 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -44,6 +44,10 @@ #include <QtGui/qpixmap.h> +#ifdef Q_TEST_QPIXMAPCACHE +#include <QtCore/qpair.h> +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -83,6 +87,12 @@ public: static void remove(const QString &key); static void remove(const Key &key); static void clear(); + +#ifdef Q_TEST_QPIXMAPCACHE + static void flushDetachedPixmaps(); + static int totalUsed(); + static QList< QPair<QString,QPixmap> > allPixmaps(); +#endif }; QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h index 86a1b78..825f272 100644 --- a/src/gui/image/qpixmapcache_p.h +++ b/src/gui/image/qpixmapcache_p.h @@ -95,6 +95,8 @@ public: QPixmapCache::Key key; }; +inline bool qIsDetached(QPixmapCacheEntry &t) { return t.isDetached(); } + QT_END_NAMESPACE #endif // QPIXMAPCACHE_P_H |