diff options
author | Marius Bugge Monsen <mmonsen@trolltech.com> | 2009-07-14 11:35:06 (GMT) |
---|---|---|
committer | Marius Bugge Monsen <mmonsen@trolltech.com> | 2009-07-14 11:35:06 (GMT) |
commit | ec823a0414ea1bb00fd52b0922ad50e4061fe660 (patch) | |
tree | 5e5b05e9751a318c950d688be44e01b49050fc77 /src | |
parent | a749d4cb3509f9a82c1d7d3b6a03e2c99dfe1842 (diff) | |
parent | ec11bd70c78cbdb07b399b058fabdb16d66072b0 (diff) | |
download | Qt-ec823a0414ea1bb00fd52b0922ad50e4061fe660.zip Qt-ec823a0414ea1bb00fd52b0922ad50e4061fe660.tar.gz Qt-ec823a0414ea1bb00fd52b0922ad50e4061fe660.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 14 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 10 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview_p.h | 10 | ||||
-rw-r--r-- | src/network/access/qnetworkreply.cpp | 21 | ||||
-rw-r--r-- | src/network/access/qnetworkreply.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkreply_p.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 5 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl_p.h | 2 |
8 files changed, 51 insertions, 15 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 3296775..06333ae 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -357,6 +357,9 @@ void QGraphicsScenePrivate::_q_emitUpdated() updateAll = false; for (int i = 0; i < views.size(); ++i) views.at(i)->d_func()->processPendingUpdates(); + // It's important that we update all views before we dispatch, hence two for-loops. + for (int i = 0; i < views.size(); ++i) + views.at(i)->d_func()->dispatchPendingUpdateRequests(); return; } @@ -447,13 +450,8 @@ void QGraphicsScenePrivate::_q_processDirtyItems() } // Immediately dispatch all pending update requests on the views. - for (int i = 0; i < views.size(); ++i) { - QWidget *viewport = views.at(i)->d_func()->viewport; - if (qt_widget_private(viewport)->paintOnScreen()) - QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); - else - QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); - } + for (int i = 0; i < views.size(); ++i) + views.at(i)->d_func()->dispatchPendingUpdateRequests(); } /*! @@ -2750,7 +2748,7 @@ void QGraphicsScene::update(const QRectF &rect) if (directUpdates) { // Update all views. for (int i = 0; i < d->views.size(); ++i) - d->views.at(i)->d_func()->updateAll(); + d->views.at(i)->d_func()->fullUpdatePending = true; } } else { if (directUpdates) { diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index bcfd68c..1cea8db 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -821,13 +821,9 @@ void QGraphicsViewPrivate::processPendingUpdates() if (!scene) return; - if (fullUpdatePending) { // We have already called viewport->update() - dirtyBoundingRect = QRect(); - dirtyRegion = QRegion(); - return; - } - - if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) { + if (fullUpdatePending) { + viewport->update(); + } else if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) { if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) viewport->update(dirtyBoundingRect.adjusted(-1, -1, 1, 1)); else diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 0fa8b34..62a2b84 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -58,6 +58,7 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW #include <QtGui/qevent.h> +#include <QtCore/qcoreapplication.h> #include "qgraphicssceneevent.h" #include <QtGui/qstyleoption.h> #include <private/qabstractscrollarea_p.h> @@ -168,6 +169,15 @@ public: dirtyBoundingRect = QRect(); dirtyRegion = QRegion(); } + + inline void dispatchPendingUpdateRequests() + { + if (qt_widget_private(viewport)->paintOnScreen()) + QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); + else + QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); + } + bool updateRect(const QRect &rect); bool updateRegion(const QRegion ®ion); bool updateSceneSlotReimplementedChecked; diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 1b0d9f5..e55c202 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -442,6 +442,27 @@ QNetworkReply::NetworkError QNetworkReply::error() const } /*! + Returns true when the reply has finished or was aborted. + + \sa isRunning() +*/ +bool QNetworkReply::isFinished() const +{ + return d_func()->isFinished(); +} + +/*! + Returns true when the request is still processing and the + reply has not finished or was aborted yet. + + \sa isFinished() +*/ +bool QNetworkReply::isRunning() const +{ + return !isFinished(); +} + +/*! Returns the URL of the content downloaded or uploaded. Note that the URL may be different from that of the original request. diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 7cb082f..30e89f1 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -116,6 +116,8 @@ public: QNetworkAccessManager::Operation operation() const; QNetworkRequest request() const; NetworkError error() const; + bool isFinished() const; + bool isRunning() const; QUrl url() const; // "cooked" headers diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h index c8543f0..b51e3fb 100644 --- a/src/network/access/qnetworkreply_p.h +++ b/src/network/access/qnetworkreply_p.h @@ -75,6 +75,8 @@ public: static inline void setManager(QNetworkReply *reply, QNetworkAccessManager *manager) { reply->d_func()->manager = manager; } + virtual bool isFinished() const { return false; } + Q_DECLARE_PUBLIC(QNetworkReply) }; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index b11d986..55b8b7f 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -532,6 +532,11 @@ void QNetworkReplyImplPrivate::sslErrors(const QList<QSslError> &errors) #endif } +bool QNetworkReplyImplPrivate::isFinished() const +{ + return (state == Finished || state == Aborted); +} + QNetworkReplyImpl::QNetworkReplyImpl(QObject *parent) : QNetworkReply(*new QNetworkReplyImplPrivate, parent) { diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 3e89a00..454185a 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -152,6 +152,8 @@ public: void redirectionRequested(const QUrl &target); void sslErrors(const QList<QSslError> &errors); + bool isFinished() const; + QNetworkAccessBackend *backend; QIODevice *outgoingData; QRingBuffer *outgoingDataBuffer; |