summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-11-05 00:00:12 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-11-05 00:00:12 (GMT)
commit0943eb0ac24d4d3b362805c020139b09f0f43f8c (patch)
tree9105c703a87820932f80602053d2b400a3a99181 /src
parent6ac2ea67b0dfb4ec74cf7efcfe5b0f1cb0b4e975 (diff)
parenta08d09937db437397cc1ecd6aca104a9370d4aa6 (diff)
downloadQt-0943eb0ac24d4d3b362805c020139b09f0f43f8c.zip
Qt-0943eb0ac24d4d3b362805c020139b09f0f43f8c.tar.gz
Qt-0943eb0ac24d4d3b362805c020139b09f0f43f8c.tar.bz2
Merge branch 'master-upstream' into master-water
Diffstat (limited to 'src')
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp45
-rw-r--r--src/gui/itemviews/qdirmodel.cpp19
-rw-r--r--src/gui/kernel/qstandardgestures.cpp10
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac.cpp27
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac_p.h1
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm15
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h1
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp7
-rw-r--r--src/network/kernel/qauthenticator.cpp10
10 files changed, 91 insertions, 46 deletions
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 8cb813c..d1d7822 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -648,7 +648,7 @@ void QDeclarativeStateChangeScript::setScript(const QDeclarativeScriptString &s)
}
/*!
- \qmlproperty script StateChangeScript::script
+ \qmlproperty string StateChangeScript::name
This property holds the name of the script. This name can be used by a
ScriptAction to target a specific script.
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index b8aafe3..5002beb 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -80,11 +80,43 @@ QT_BEGIN_NAMESPACE
directories. In the simplest case, it can be used with a suitable display
widget as part of a browser or filter.
- QFileSystemModel will not fetch any files or directories until setRootPath
+ QFileSystemModel can be accessed using the standard interface provided by
+ QAbstractItemModel, but it also provides some convenience functions that are
+ specific to a directory model.
+ The fileInfo(), isDir(), name(), and path() functions provide information
+ about the underlying files and directories related to items in the model.
+ Directories can be created and removed using mkdir(), rmdir().
+
+ \note QFileSystemModel requires an instance of a GUI application.
+
+ \section1 Example Usage
+
+ A directory model that displays the contents of a default directory
+ is usually constructed with a parent object:
+
+ \snippet doc/src/snippets/shareddirmodel/main.cpp 2
+
+ A tree view can be used to display the contents of the model
+
+ \snippet doc/src/snippets/shareddirmodel/main.cpp 4
+
+ and the contents of a particular directory can be displayed by
+ setting the tree view's root index:
+
+ \snippet doc/src/snippets/shareddirmodel/main.cpp 7
+
+ The view's root index can be used to control how much of a
+ hierarchical model is displayed. QDirModel provides a convenience
+ function that returns a suitable model index for a path to a
+ directory within the model.
+
+ \section1 Caching and Performance
+
+ QFileSystemModel will not fetch any files or directories until setRootPath()
is called. This will prevent any unnecessary querying on the file system
until that point such as listing the drives on Windows.
- Unlike the QDirModel, QFileSystemModel uses a separate thread to populate
+ Unlike QDirModel, QFileSystemModel uses a separate thread to populate
itself so it will not cause the main thread to hang as the file system
is being queried. Calls to rowCount() will return 0 until the model
populates a directory.
@@ -92,15 +124,6 @@ QT_BEGIN_NAMESPACE
QFileSystemModel keeps a cache with file information. The cache is
automatically kept up to date using the QFileSystemWatcher.
- QFileSystemModel can be accessed using the standard interface provided by
- QAbstractItemModel, but it also provides some convenience functions that are
- specific to a directory model.
- The fileInfo(), isDir(), name(), and path() functions provide information
- about the underlying files and directories related to items in the model.
- Directories can be created and removed using mkdir(), rmdir().
-
- \note QFileSystemModel requires an instance of a GUI application.
-
\sa {Model Classes}
*/
diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp
index 48599bc..cb6f81e 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -201,25 +201,6 @@ void QDirModelPrivate::invalidate()
QDirModel keeps a cache with file information. The cache needs to be
updated with refresh().
- A directory model that displays the contents of a default directory
- is usually constructed with a parent object:
-
- \snippet doc/src/snippets/shareddirmodel/main.cpp 2
-
- A tree view can be used to display the contents of the model
-
- \snippet doc/src/snippets/shareddirmodel/main.cpp 4
-
- and the contents of a particular directory can be displayed by
- setting the tree view's root index:
-
- \snippet doc/src/snippets/shareddirmodel/main.cpp 7
-
- The view's root index can be used to control how much of a
- hierarchical model is displayed. QDirModel provides a convenience
- function that returns a suitable model index for a path to a
- directory within the model.
-
QDirModel can be accessed using the standard interface provided by
QAbstractItemModel, but it also provides some convenience functions
that are specific to a directory model. The fileInfo() and isDir()
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 1821c3d..48b7ac1 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -194,13 +194,15 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
d->hotSpot = p1.screenPos();
d->isHotSpotSet = true;
+ QPointF centerPoint = (p1.screenPos() + p2.screenPos()) / 2.0;
if (d->isNewSequence) {
d->startPosition[0] = p1.screenPos();
d->startPosition[1] = p2.screenPos();
+ d->lastCenterPoint = centerPoint;
+ } else {
+ d->lastCenterPoint = d->centerPoint;
}
-
- d->lastCenterPoint = d->centerPoint;
- d->centerPoint = (p1.screenPos() + p2.screenPos()) / 2.0;
+ d->centerPoint = centerPoint;
d->changeFlags |= QPinchGesture::CenterPointChanged;
@@ -224,7 +226,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
startAngle -= 360;
const qreal rotationAngle = startAngle - angle;
if (d->isNewSequence)
- d->lastRotationAngle = rotationAngle;
+ d->lastRotationAngle = 0.0;
else
d->lastRotationAngle = d->rotationAngle;
d->rotationAngle = rotationAngle;
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
index ab05dbd..3590993 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
@@ -42,6 +42,7 @@
#include "qunifiedtoolbarsurface_mac_p.h"
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qbackingstore_p.h>
+#include <private/qmainwindowlayout_p.h>
#include <QDebug>
@@ -90,7 +91,6 @@ void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offse
{
setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME
recursiveRedirect(toolbar, offset);
-// toolbar->d_func()->toolbar_offset = offset;
}
void QUnifiedToolbarSurface::setGeometry(const QRect &rect)
@@ -101,6 +101,8 @@ void QUnifiedToolbarSurface::setGeometry(const QRect &rect)
if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height())
prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
d->inSetGeometry = false;
+
+ // FIXME: set unified toolbar height.
}
void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn)
@@ -114,10 +116,18 @@ void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn)
}
}
+void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget)
+{
+ QMainWindowLayout *mlayout = qobject_cast<QMainWindowLayout*> (widget->window()->layout());
+ mlayout->updateUnifiedToolbarOffset();
+}
+
void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
{
Q_D(QUnifiedToolbarSurface);
+ QRegion flushingRegion(widget->rect());
+
if (!d->image || rgn.rectCount() == 0) {
return;
}
@@ -132,24 +142,29 @@ void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QP
qt_mac_display(widget);
return;
} else {
+ // We render the content of the toolbar in the surface.
+ updateToolbarOffset(widget);
+ QRect beginPaintRect(widget->d_func()->toolbar_offset.x(), widget->d_func()->toolbar_offset.y(), widget->geometry().width(), widget->geometry().height());
+ QRegion beginPaintRegion(beginPaintRect);
+
context = widget->d_func()->cgContext;
+ beginPaint(beginPaintRegion);
widget->render(widget->d_func()->unifiedSurface->paintDevice(), widget->d_func()->toolbar_offset, QRegion(), QWidget::DrawChildren);
}
CGContextSaveGState(context);
- int areaX = widget->geometry().x() + widget->d_func()->toolbar_offset.x();
- int areaY = widget->geometry().y() + widget->d_func()->toolbar_offset.y();
+ int areaX = widget->d_func()->toolbar_offset.x();
+ int areaY = widget->d_func()->toolbar_offset.y();
int areaWidth = widget->geometry().width();
int areaHeight = widget->geometry().height();
const CGRect area = CGRectMake(areaX, areaY, areaWidth, areaHeight);
// Clip to region.
- const QVector<QRect> &rects = rgn.rects();
+ const QVector<QRect> &rects = flushingRegion.rects();
for (int i = 0; i < rects.size(); ++i) {
const QRect &rect = rects.at(i);
- // CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
- CGContextAddRect(context, CGRectMake(0, 0, 1000, 1000)); //FIXME: Set correct size.
+ CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
}
CGContextAddRect(context, area);
CGContextClip(context);
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
index 4d72ff9..3bc0404 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
@@ -85,6 +85,7 @@ public:
private:
QPaintDevice *paintDevice();
+ void updateToolbarOffset(QWidget *widget);
void prepareBuffer(QImage::Format format, QWidget *widget);
void recursiveRedirect(QObject *widget, const QPoint &offset);
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 126cc4a..dfde799 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -43,6 +43,7 @@
#include <qtoolbar.h>
#include <private/qtoolbarlayout_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
+#include <private/qtoolbar_p.h>
#ifndef QT_MAC_USE_COCOA
#include <Carbon/Carbon.h>
@@ -473,6 +474,16 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
#endif
}
+void QMainWindowLayout::updateUnifiedToolbarOffset()
+{
+ QPoint offset(0, 0);
+
+ for (int i = 1; i < qtoolbarsInUnifiedToolbarList.length(); ++i) {
+ offset.setX(offset.x() + qtoolbarsInUnifiedToolbarList.at(i - 1)->size().width());
+ qtoolbarsInUnifiedToolbarList.at(i)->d_func()->toolbar_offset = offset;
+ }
+}
+
void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar)
{
QHash<void *, QToolBar *>::iterator it = unifiedToolbarHash.begin();
@@ -546,11 +557,11 @@ void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const
QMacCocoaAutoReleasePool pool;
QWidgetItem layoutItem(tb);
QSize size = layoutItem.maximumSize();
- NSSize nssize = NSMakeSize(size.width(), size.height() - 2);
+ NSSize nssize = NSMakeSize(size.width(), size.height());
[item setMaxSize:nssize];
size = layoutItem.minimumSize();
nssize.width = size.width();
- nssize.height = size.height() - 2;
+ nssize.height = size.height();
[item setMinSize:nssize];
}
#else
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index a372216..e457cbc 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -335,6 +335,7 @@ public:
QHash<QToolBar *, ToolBarSaveState> toolbarSaveState;
QHash<QString, QToolBar *> cocoaItemIDToToolbarHash;
void insertIntoMacToolbar(QToolBar *before, QToolBar *after);
+ void updateUnifiedToolbarOffset();
void removeFromMacToolbar(QToolBar *toolbar);
void cleanUpMacToolbarItems();
void fixSizeInUnifiedToolbar(QToolBar *tb) const;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 1ef58d8..1ce162c 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -374,6 +374,13 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
// - If withCredentials has been set to false (e.g. by QtWebKit for a cross-origin XMLHttpRequest) then
// we need to bail out if authentication is required.
if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
+ // Reset authenticator so the next request on that channel does not get messed up
+ auth = 0;
+ if (isProxy)
+ channels[i].proxyAuthenticator = QAuthenticator();
+ else
+ channels[i].authenticator = QAuthenticator();
+
// authentication is cancelled, send the current contents to the user.
emit channels[i].reply->headerChanged();
emit channels[i].reply->readyRead();
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 220f7da..73f6b94 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -164,9 +164,13 @@ QAuthenticator &QAuthenticator::operator=(const QAuthenticator &other)
{
if (d == other.d)
return *this;
- detach();
- d->user = other.d->user;
- d->password = other.d->password;
+
+ if (d && !d->ref.deref())
+ delete d;
+
+ d = other.d;
+ if (d)
+ d->ref.ref();
return *this;
}