summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene.cpp
diff options
context:
space:
mode:
authorIain <qt-info@nokia.com>2009-08-21 13:23:16 (GMT)
committerIain <qt-info@nokia.com>2009-08-21 13:23:16 (GMT)
commitd2cfe342ff109e7135fe2fcb00f60d918a7bfaa5 (patch)
tree26a2edc99e561721fad57d27f84a2a6c0be73a3c /src/gui/graphicsview/qgraphicsscene.cpp
parent6df41a9378e39f4d46cee1a085463d55fe2af5aa (diff)
parentab1df6dea670a60bfef5efd81d6687f9534cfc5d (diff)
downloadQt-d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5.zip
Qt-d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5.tar.gz
Qt-d2cfe342ff109e7135fe2fcb00f60d918a7bfaa5.tar.bz2
Merge commit 'origin/master' into symbolVisibility
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscene.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index a2a92b8..a8db74d 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -265,12 +265,13 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph
hover->setAccepted(mouseEvent->isAccepted());
}
+int QGraphicsScenePrivate::changedSignalIndex;
+
/*!
\internal
*/
QGraphicsScenePrivate::QGraphicsScenePrivate()
- : changedSignalMask(0),
- indexMethod(QGraphicsScene::BspTreeIndex),
+ : indexMethod(QGraphicsScene::BspTreeIndex),
index(0),
lastItemCount(0),
hasSceneRect(false),
@@ -311,7 +312,9 @@ void QGraphicsScenePrivate::init()
index = new QGraphicsSceneBspTreeIndex(q);
// Keep this index so we can check for connected slots later on.
- changedSignalMask = (1 << q->metaObject()->indexOfSignal("changed(QList<QRectF>)"));
+ if (!changedSignalIndex) {
+ changedSignalIndex = signalIndex("changed(QList<QRectF>)");
+ }
qApp->d_func()->scene_list.append(q);
q->update();
}
@@ -343,7 +346,7 @@ void QGraphicsScenePrivate::_q_emitUpdated()
// the optimization that items send updates directly to the views, but it
// needs to happen in order to keep compatibility with the behavior from
// Qt 4.4 and backward.
- if (connectedSignals[0] & changedSignalMask) {
+ if (isSignalConnected(changedSignalIndex)) {
for (int i = 0; i < views.size(); ++i) {
QGraphicsView *view = views.at(i);
if (!view->d_func()->connectedToScene) {
@@ -2894,7 +2897,7 @@ void QGraphicsScene::update(const QRectF &rect)
// Check if anyone's connected; if not, we can send updates directly to
// the views. Otherwise or if there are no views, use old behavior.
- bool directUpdates = !(d->connectedSignals[0] & d->changedSignalMask) && !d->views.isEmpty();
+ bool directUpdates = !(d->isSignalConnected(d->changedSignalIndex)) && !d->views.isEmpty();
if (rect.isNull()) {
d->updateAll = true;
d->updatedRects.clear();
@@ -4473,7 +4476,7 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
if (removingItemFromScene) {
// Note that this function can be called from the item's destructor, so
// do NOT call any virtual functions on it within this block.
- if ((connectedSignals[0] & changedSignalMask) || views.isEmpty()) {
+ if (isSignalConnected(changedSignalIndex) || views.isEmpty()) {
// This block of code is kept for compatibility. Since 4.5, by default
// QGraphicsView does not connect the signal and we use the below
// method of delivering updates.
@@ -4619,7 +4622,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
// Process item.
if (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint) {
- const bool useCompatUpdate = views.isEmpty() || (connectedSignals[0] & changedSignalMask);
+ const bool useCompatUpdate = views.isEmpty() || isSignalConnected(changedSignalIndex);
const QRectF itemBoundingRect = adjustedItemBoundingRect(item);
if (useCompatUpdate && !itemIsUntransformable && qFuzzyIsNull(item->boundingRegionGranularity())) {