summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-01-07 00:51:34 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-01-07 00:51:34 (GMT)
commit5b67b61150771cf978648a35db201345d6fb37ae (patch)
treec8927dd65b3d1edeff76fd21ac0c49b7ace72bf6 /src
parentc527a1ee371c4758776217e7d16c75e20fe6f5aa (diff)
parent9cc21c043238dc7576a465c9d236e8968fd8c549 (diff)
downloadQt-5b67b61150771cf978648a35db201345d6fb37ae.zip
Qt-5b67b61150771cf978648a35db201345d6fb37ae.tar.gz
Qt-5b67b61150771cf978648a35db201345d6fb37ae.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11
Conflicts: src/declarative/graphicsitems/qdeclarativeitem.cpp tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qdiriterator.cpp6
-rw-r--r--src/corelib/io/qresource.cpp2
-rw-r--r--src/corelib/io/qurl.cpp1
-rw-r--r--src/corelib/tools/qlocale.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp9
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp54
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp21
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp17
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp6
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp11
-rw-r--r--src/declarative/qml/qdeclarativecomponent_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp12
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp16
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp8
-rw-r--r--src/declarative/util/qdeclarativeview.cpp7
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp1
-rw-r--r--src/gui/dialogs/qdialog.cpp24
-rw-r--r--src/gui/dialogs/qfiledialog_symbian.cpp73
-rw-r--r--src/gui/image/qpixmap.cpp4
-rw-r--r--src/gui/kernel/qapplication_s60.cpp8
-rw-r--r--src/gui/kernel/qkeymapper_x11.cpp15
-rw-r--r--src/gui/painting/qdrawhelper.cpp168
-rw-r--r--src/gui/painting/qpainterpath.cpp3
-rw-r--r--src/gui/styles/qcommonstyle.cpp5
-rw-r--r--src/gui/styles/qwindowsstyle.cpp5
-rw-r--r--src/gui/widgets/qdockwidget.cpp17
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp33
-rw-r--r--src/opengl/qwindowsurface_gl.cpp13
-rw-r--r--src/opengl/qwindowsurface_gl_p.h3
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp3
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp6
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp8
-rw-r--r--src/s60main/newallocator_hook.cpp12
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp116
-rw-r--r--src/sql/drivers/psql/qsql_psql.h6
40 files changed, 510 insertions, 206 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index fd4b9c1..dbb333f 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -389,9 +389,6 @@ QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
\note To list symlinks that point to non existing files, QDir::System must be
passed to the flags.
- \warning This constructor expects \a flags to be left at its default value. Use
- the constructors that do not take the \a filters argument instead.
-
\sa hasNext(), next(), IteratorFlags
*/
QDirIterator::QDirIterator(const QString &path, QDir::Filters filters, IteratorFlags flags)
@@ -429,9 +426,6 @@ QDirIterator::QDirIterator(const QString &path, IteratorFlags flags)
\note To list symlinks that point to non existing files, QDir::System must be
passed to the flags.
- \warning This constructor expects \c flags to be left at its default value. Use the
- constructors that do not take the \a filters argument instead.
-
\sa hasNext(), next(), IteratorFlags
*/
QDirIterator::QDirIterator(const QString &path, const QStringList &nameFilters,
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index ce9c57e..b45710c 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -187,7 +187,7 @@ Q_GLOBAL_STATIC(QStringList, resourceSearchPaths)
A QResource can either be loaded with an absolute path, either treated
as a file system rooted with a \c{/} character, or in resource notation
rooted with a \c{:} character. A relative resource can also be opened
- which will be found through the searchPaths().
+ which will be found in the list of paths returned by QDir::searchPaths().
A QResource that is representing a file will have data backing it, this
data can possibly be compressed, in which case qUncompress() must be
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 6a3037d..45f908d 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -4262,6 +4262,7 @@ void QUrl::setUrl(const QString &url)
*/
void QUrl::setUrl(const QString &url, ParsingMode parsingMode)
{
+ detach();
// escape all reserved characters and delimiters
// reserved = gen-delims / sub-delims
if (parsingMode != TolerantMode) {
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 83d6dcd..b817eb2 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1576,8 +1576,6 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l)
defaults to the default locale (see setDefault()).
\endlist
- The "C" locale is identical in behavior to \l{English}/\l{UnitedStates}.
-
Use language() and country() to determine the actual language and
country values used.
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 337965f..52ad1e1 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -671,10 +671,12 @@ void QDeclarativeFlickable::setFlickableDirection(FlickableDirection direction)
void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
{
+ Q_Q(QDeclarativeFlickable);
if (interactive && timeline.isActive() && (qAbs(hData.velocity) > 10 || qAbs(vData.velocity) > 10))
stealMouse = true; // If we've been flicked then steal the click.
else
stealMouse = false;
+ q->setKeepMouseGrab(stealMouse);
pressed = true;
timeline.clear();
hData.velocity = 0;
@@ -769,6 +771,8 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
}
stealMouse = stealX || stealY;
+ if (stealMouse)
+ q->setKeepMouseGrab(true);
if (!lastPos.isNull()) {
qreal elapsed = qreal(QDeclarativeItemPrivate::restart(lastPosTime)) / 1000.;
@@ -848,8 +852,6 @@ void QDeclarativeFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Q_D(QDeclarativeFlickable);
if (d->interactive) {
d->handleMouseMoveEvent(event);
- if (d->stealMouse)
- setKeepMouseGrab(true);
event->accept();
} else {
QDeclarativeItem::mouseMoveEvent(event);
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 5aa88b5..c2c28c2 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1131,6 +1131,13 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
+ GridView attaches a number of properties to the root item of the delegate, for example
+ \c {GridView.isCurrentItem}. In the following example, the root delegate item can access
+ this attached property directly as \c GridView.isCurrentItem, while the child
+ \c contactInfo object must refer to this property as \c wrapper.GridView.isCurrentItem.
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem
+
\note Views do not set the \l{Item::}{clip} property automatically.
If the view is not clipped by another item or the screen, it will be necessary
to set this property to true in order to clip the items that are partially or
@@ -1167,6 +1174,8 @@ QDeclarativeGridView::~QDeclarativeGridView()
This attached property holds the view that manages this delegate instance.
It is attached to each instance of the delegate.
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 4cf9b26..295a889 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -461,8 +461,16 @@ void QDeclarativeItemKeyFilter::componentComplete()
\qmlproperty Item KeyNavigation::backtab
These properties hold the item to assign focus to
- when Key_Left, Key_Right, Key_Up, Key_Down, Key_Tab or Key_BackTab
- are pressed.
+ when the left, right, up or down cursor keys, or the
+ tab key are pressed.
+*/
+
+/*!
+ \qmlproperty Item KeyNavigation::tab
+ \qmlproperty Item KeyNavigation::backtab
+
+ These properties hold the item to assign focus to
+ when the Tab key or Shift+Tab key combination (Backtab) are pressed.
*/
QDeclarativeKeyNavigationAttached::QDeclarativeKeyNavigationAttached(QObject *parent)
@@ -941,6 +949,20 @@ void QDeclarativeKeyNavigationAttached::setFocusNavigation(QDeclarativeItem *cur
*/
/*!
+ \qmlsignal Keys::onTabPressed(KeyEvent event)
+
+ This handler is called when the Tab key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal Keys::onBacktabPressed(KeyEvent event)
+
+ This handler is called when the Shift+Tab key combination (Backtab) has
+ been pressed. The \a event parameter provides information about the event.
+*/
+
+/*!
\qmlsignal Keys::onAsteriskPressed(KeyEvent event)
This handler is called when the Asterisk '*' has been pressed. The \a event
@@ -1341,23 +1363,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
}
\endqml
- \section1 Identity
-
- Each item has an "id" - the identifier of the Item.
-
- The identifier can be used in bindings and other expressions to
- refer to the item. For example:
-
- \qml
- Text { id: myText; ... }
- Text { text: myText.text }
- \endqml
-
- The identifier is available throughout to the \l {components}{component}
- where it is declared. The identifier must be unique in the component.
-
- The id should not be thought of as a "property" - it makes no sense
- to write \c myText.id, for example.
\section1 Key Handling
@@ -1384,17 +1389,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
\endqml
See the \l {Keys}{Keys} attached property for detailed documentation.
-
- \section1 Property Change Signals
-
- Most properties on Item and Item derivatives have a signal
- emitted when they change. By convention, the signals are
- named <propertyName>Changed, e.g. xChanged will be emitted when an item's
- x property changes. Note that these also have signal handers e.g.
- the onXChanged signal handler will be called when an item's x property
- changes. For many properties in Item or Item derivatives this can be used
- to add a touch of imperative logic to your application (when absolutely
- necessary).
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 2a7f508..702442b 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -643,7 +643,8 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
int i = visibleItems.count() - 1;
while (i > 0 && visibleItems.at(i)->index == -1)
--i;
- modelIndex = visibleItems.at(i)->index + 1;
+ if (visibleItems.at(i)->index != -1)
+ modelIndex = visibleItems.at(i)->index + 1;
}
bool changed = false;
@@ -1415,6 +1416,13 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
+ ListView attaches a number of properties to the root item of the delegate, for example
+ \c {ListView.isCurrentItem}. In the following example, the root delegate item can access
+ this attached property directly as \c ListView.isCurrentItem, while the child
+ \c contactInfo object must refer to this property as \c wrapper.ListView.isCurrentItem.
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
+
\note Views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
@@ -2804,7 +2812,10 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count)
int i = d->visibleItems.count() - 1;
while (i > 0 && d->visibleItems.at(i)->index == -1)
--i;
- if (d->visibleItems.at(i)->index + 1 == modelIndex
+ if (i == 0 && d->visibleItems.first()->index == -1) {
+ // there are no visible items except items marked for removal
+ index = d->visibleItems.count();
+ } else if (d->visibleItems.at(i)->index + 1 == modelIndex
&& d->visibleItems.at(i)->endPosition() < d->buffer+d->position()+d->size()-1) {
// Special case of appending an item to the model.
index = d->visibleItems.count();
@@ -2836,7 +2847,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count)
// index can be the next item past the end of the visible items list (i.e. appended)
int pos = index < d->visibleItems.count() ? d->visibleItems.at(index)->position()
- : d->visibleItems.at(index-1)->endPosition()+d->spacing+1;
+ : d->visibleItems.last()->endPosition()+d->spacing+1;
int initialPos = pos;
int diff = 0;
QList<FxListItem*> added;
@@ -2988,14 +2999,16 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count)
}
// update visibleIndex
+ bool haveVisibleIndex = false;
for (it = d->visibleItems.begin(); it != d->visibleItems.end(); ++it) {
if ((*it)->index != -1) {
d->visibleIndex = (*it)->index;
+ haveVisibleIndex = true;
break;
}
}
- if (removedVisible && d->visibleItems.isEmpty()) {
+ if (removedVisible && !haveVisibleIndex) {
d->timeline.clear();
if (d->itemCount == 0) {
d->visibleIndex = 0;
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index 966c51b..e63a2c3 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -46,6 +46,8 @@
#include <QTime>
#include <private/qbezier_p.h>
+#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
QT_BEGIN_NAMESPACE
@@ -367,9 +369,11 @@ void QDeclarativePath::createPointCache() const
{
Q_D(const QDeclarativePath);
qreal pathLength = d->_path.length();
+ if (pathLength <= 0 || qIsNaN(pathLength))
+ return;
// more points means less jitter between items as they move along the
// path, but takes longer to generate
- const int points = int(pathLength*5);
+ const int points = qCeil(pathLength*5);
const int lastElement = d->_path.elementCount() - 1;
d->_pointCache.resize(points+1);
@@ -418,6 +422,8 @@ QPointF QDeclarativePath::pointAt(qreal p) const
Q_D(const QDeclarativePath);
if (d->_pointCache.isEmpty()) {
createPointCache();
+ if (d->_pointCache.isEmpty())
+ return QPointF();
}
int idx = qRound(p*d->_pointCache.size());
if (idx >= d->_pointCache.size())
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 87ea214..74d3418 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -393,6 +393,13 @@ void QDeclarativePathViewPrivate::regenerate()
Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
+ PathView attaches a number of properties to the root item of the delegate, for example
+ \c {PathView.isCurrentItem}. In the following example, the root delegate item can access
+ this attached property directly as \c PathView.isCurrentItem, while the child
+ \c nameText object must refer to this property as \c wrapper.PathView.isCurrentItem.
+
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+
\bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
@@ -452,6 +459,8 @@ QDeclarativePathView::~QDeclarativePathView()
It is attached to each instance of the delegate.
This property may be used to adjust the appearance of the current item.
+
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
*/
/*!
@@ -1133,8 +1142,10 @@ void QDeclarativePathViewPrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
QPointF pathPoint = pointNear(event->pos(), &newPc);
if (!stealMouse) {
QPointF delta = pathPoint - startPoint;
- if (qAbs(delta.x()) > QApplication::startDragDistance() || qAbs(delta.y()) > QApplication::startDragDistance())
+ if (qAbs(delta.x()) > QApplication::startDragDistance() || qAbs(delta.y()) > QApplication::startDragDistance()) {
stealMouse = true;
+ startPc = newPc;
+ }
}
if (stealMouse) {
@@ -1307,8 +1318,10 @@ void QDeclarativePathView::componentComplete()
// It is possible that a refill has already happended to to Path
// bindings being handled in the componentComplete(). If so
// don't do it again.
- if (d->items.count() == 0)
+ if (d->items.count() == 0 && d->model) {
+ d->modelCount = d->model->count();
d->regenerate();
+ }
d->updateHighlight();
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index c1314ff..b76a70c 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -644,6 +644,8 @@ int QDeclarativeTextEdit::cursorPosition() const
void QDeclarativeTextEdit::setCursorPosition(int pos)
{
Q_D(QDeclarativeTextEdit);
+ if (pos < 0 || pos > d->text.length())
+ return;
QTextCursor cursor = d->control->textCursor();
if (cursor.position() == pos)
return;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 4e1c297..ac07d4b 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -445,6 +445,8 @@ int QDeclarativeTextInput::cursorPosition() const
void QDeclarativeTextInput::setCursorPosition(int cp)
{
Q_D(QDeclarativeTextInput);
+ if (cp < 0 || cp > d->control->text().length())
+ return;
d->control->moveCursor(cp);
}
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index dd07067..a5fae36 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -774,6 +774,8 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model)
QObject::connect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
QObject::connect(d->m_abstractItemModel, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
d->m_metaDataCacheable = true;
+ if (d->m_abstractItemModel->canFetchMore(d->m_root))
+ d->m_abstractItemModel->fetchMore(d->m_root);
return;
}
if ((d->m_visualItemModel = qvariant_cast<QDeclarativeVisualDataModel *>(model))) {
@@ -871,6 +873,8 @@ void QDeclarativeVisualDataModel::setRootIndex(const QVariant &root)
if (d->m_root != modelIndex) {
int oldCount = d->modelCount();
d->m_root = modelIndex;
+ if (d->m_abstractItemModel && d->m_abstractItemModel->canFetchMore(modelIndex))
+ d->m_abstractItemModel->fetchMore(modelIndex);
int newCount = d->modelCount();
if (d->m_delegate && oldCount)
emit itemsRemoved(0, oldCount);
@@ -1095,6 +1099,8 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
d->m_delegateValidated = true;
}
}
+ if (d->modelCount()-1 == index && d->m_abstractItemModel && d->m_abstractItemModel->canFetchMore(d->m_root))
+ d->m_abstractItemModel->fetchMore(d->m_root);
return item;
}
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index a8b1c3f..38bd74b 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -699,17 +699,6 @@ QObject *QDeclarativeComponent::create(QDeclarativeContext *context)
return rv;
}
-QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context,
- const QBitField &bindings)
-{
- if (!context)
- context = QDeclarativeContextData::get(engine->rootContext());
-
- QObject *rv = beginCreate(context, bindings);
- completeCreate();
- return rv;
-}
-
/*!
This method provides more advanced control over component instance creation.
In general, programmers should use QDeclarativeComponent::create() to create a
diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
index 7b30bad..daf1dcb 100644
--- a/src/declarative/qml/qdeclarativecomponent_p.h
+++ b/src/declarative/qml/qdeclarativecomponent_p.h
@@ -81,7 +81,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeComponentPrivate : public QObjectPrivate, pu
public:
QDeclarativeComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), engine(0), creationContext(0) {}
- QObject *create(QDeclarativeContextData *, const QBitField &);
QObject *beginCreate(QDeclarativeContextData *, const QBitField &);
void completeCreate();
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 3a5fe66..0a008ff 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -761,8 +761,10 @@ QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url, QSize *s
QImage image;
QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
locker.unlock();
- if (provider)
- image = provider->requestImage(url.path().mid(1), size, req_size);
+ if (provider) {
+ QString imageId = url.toString(QUrl::RemoveScheme | QUrl::RemoveAuthority).mid(1);
+ image = provider->requestImage(imageId, size, req_size);
+ }
return image;
}
@@ -772,8 +774,10 @@ QPixmap QDeclarativeEnginePrivate::getPixmapFromProvider(const QUrl &url, QSize
QPixmap pixmap;
QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
locker.unlock();
- if (provider)
- pixmap = provider->requestPixmap(url.path().mid(1), size, req_size);
+ if (provider) {
+ QString imageId = url.toString(QUrl::RemoveScheme | QUrl::RemoveAuthority).mid(1);
+ pixmap = provider->requestPixmap(imageId, size, req_size);
+ }
return pixmap;
}
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index ef31be7..e3da645 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -182,13 +182,17 @@ QDeclarativeImageProvider::ImageType QDeclarativeImageProvider::imageType() cons
Implement this method to return the image with \a id. The default
implementation returns an empty image.
+ The \a id is the requested image source, with the "image:" scheme and
+ provider identifier removed. For example, if the image \l{Image::}{source}
+ was "image://myprovider/icons/home", the given \a id would be "icons/home".
+
The \a requestedSize corresponds to the \l {Image::sourceSize} requested by
an Image element. If \a requestedSize is a valid size, the image
returned should be of that size.
In all cases, \a size must be set to the original size of the image. This
- is used to set the \l {Item::}{width} and \l {Item::}{height} of image
- elements that should be automatically sized to the loaded image.
+ is used to set the \l {Item::}{width} and \l {Item::}{height} of the
+ relevant \l Image if these values have not been set explicitly.
\note this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
@@ -207,13 +211,17 @@ QImage QDeclarativeImageProvider::requestImage(const QString &id, QSize *size, c
Implement this method to return the pixmap with \a id. The default
implementation returns an empty pixmap.
+ The \a id is the requested image source, with the "image:" scheme and
+ provider identifier removed. For example, if the image \l{Image::}{source}
+ was "image://myprovider/icons/home", the given \a id would be "icons/home".
+
The \a requestedSize corresponds to the \l {Image::sourceSize} requested by
an Image element. If \a requestedSize is a valid size, the image
returned should be of that size.
In all cases, \a size must be set to the original size of the image. This
- is used to set the \l {Item::}{width} and \l {Item::}{height} of image
- elements that should be automatically sized to the loaded image.
+ is used to set the \l {Item::}{width} and \l {Item::}{height} of the
+ relevant \l Image if these values have not been set explicitly.
*/
QPixmap QDeclarativeImageProvider::requestPixmap(const QString &id, QSize *size, const QSize& requestedSize)
{
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index 4b78020..9dc214f 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -458,7 +458,7 @@ QDeclarativeWorkerScriptEngine::QDeclarativeWorkerScriptEngine(QDeclarativeEngin
{
d->m_lock.lock();
connect(d, SIGNAL(stopThread()), this, SLOT(quit()), Qt::DirectConnection);
- start(QThread::LowPriority);
+ start(QThread::IdlePriority);
d->m_wait.wait(&d->m_lock);
d->moveToThread(this);
d->m_lock.unlock();
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index f2e6217..dd7e5fd 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -1324,7 +1324,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
/*!
\qmlclass RotationAnimation QDeclarativeRotationAnimation
- \ingroup qml-animation-transition
+ \ingroup qml-animation-transition
\since 4.7
\inherits PropertyAnimation
\brief The RotationAnimation element animates changes in rotation values.
@@ -1333,8 +1333,8 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
over the direction of rotation during an animation.
By default, it rotates in the direction
- of the numerical change; a rotation from 0 to 240 will rotate 220 degrees
- clockwise, while a rotation from 240 to 0 will rotate 220 degrees
+ of the numerical change; a rotation from 0 to 240 will rotate 240 degrees
+ clockwise, while a rotation from 240 to 0 will rotate 240 degrees
counterclockwise. The \l direction property can be set to specify the
direction in which the rotation should occur.
@@ -1342,7 +1342,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
between states via the shortest path:
\snippet doc/src/snippets/declarative/rotationanimation.qml 0
-
+
Notice the RotationAnimation did not need to set a \l target
value. As a convenience, when used in a transition, RotationAnimation will rotate all
properties named "rotation" or "angle". You can override this by providing
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index a87ca37..9d4d4b0 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -191,7 +191,7 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem,
/*!
\class QDeclarativeView
- \since 4.7
+ \since 4.7
\brief The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface.
QDeclarativeItem objects can be placed on a standard QGraphicsScene and
@@ -362,13 +362,14 @@ QDeclarativeContext* QDeclarativeView::rootContext() const
}
/*!
- \enum QDeclarativeView::Status
+ \enum QDeclarativeView::Status
Specifies the loading status of the QDeclarativeView.
\value Null This QDeclarativeView has no source set.
\value Ready This QDeclarativeView has loaded and created the QML component.
\value Loading This QDeclarativeView is loading network data.
- \value Error An error has occurred. Call errorDescription() to retrieve a description.
+ \value Error One or more errors has occurred. Call errors() to retrieve a list
+ of errors.
*/
/*! \enum QDeclarativeView::ResizeMode
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index f5c3ad4..9e616de 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -924,6 +924,7 @@ void QDeclarativeXmlListModel::reload()
} else {
d->notifyQueryStarted(true);
QNetworkRequest req(d->src);
+ req.setRawHeader("Accept", "application/xml");
d->reply = qmlContext(this)->engine()->networkAccessManager()->get(req);
QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(requestFinished()));
QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index 16ea045..bcf952c 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -899,9 +899,21 @@ bool QDialog::symbianAdjustedPosition()
{
#if defined(Q_WS_S60)
QPoint p;
- const bool doS60Positioning = !(isFullScreen()||isMaximized());
- if (doS60Positioning) {
- QPoint oldPos = pos();
+ QPoint oldPos = pos();
+ if (isFullScreen()) {
+ p.setX(0);
+ p.setY(0);
+ } else if (isMaximized()) {
+ TRect statusPaneRect = TRect();
+ if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
+ } else {
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, statusPaneRect);
+ }
+
+ p.setX(0);
+ p.setY(statusPaneRect.Height());
+ } else {
// naive way to deduce screen orientation
if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
int cbaHeight;
@@ -937,10 +949,10 @@ bool QDialog::symbianAdjustedPosition()
p.setX(qMax(0,S60->screenWidthInPixels - width()));
}
}
- if (oldPos != p || p.y() < 0)
- move(p);
}
- return doS60Positioning;
+ if (oldPos != p || p.y() < 0)
+ move(p);
+ return true;
#else
// TODO - check positioning requirement for Symbian, non-s60
return false;
diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp
index 1f70305..1fc5f5e 100644
--- a/src/gui/dialogs/qfiledialog_symbian.cpp
+++ b/src/gui/dialogs/qfiledialog_symbian.cpp
@@ -64,7 +64,7 @@ public:
filterList.clear();
if (filter.left(2) == QLatin1String("*.")) {
//Filter has only extensions
- filterList << filter.split(" ");
+ filterList << filter.split(QLatin1String(" "));
return;
} else {
//Extensions are in parenthesis and there may be several filters
@@ -75,7 +75,7 @@ public:
return;
}
}
- QRegExp rx("\\(([^\\)]*)\\)");
+ QRegExp rx(QLatin1String("\\(([^\\)]*)\\)"));
int pos = 0;
while ((pos = rx.indexIn(filter, pos)) != -1) {
filterList << rx.cap(1).split(QLatin1String(" "));
@@ -119,36 +119,49 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st
{
QString selection;
#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3)
- QT_TRAP_THROWING(
- TFileName startFolder;
- if (!startDirectory.isEmpty()) {
- QString dir = QDir::toNativeSeparators(startDirectory);
+ TFileName startFolder;
+ if (!startDirectory.isEmpty()) {
+ QString dir = QDir::toNativeSeparators(QFileDialogPrivate::workingDirectory(startDirectory));
+ startFolder = qt_QString2TPtrC(dir);
+ }
+ TInt types = AknCommonDialogsDynMem::EMemoryTypeMMCExternal|
+ AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage|
+ AknCommonDialogsDynMem::EMemoryTypePhone;
+
+ TPtrC titlePtr(qt_QString2TPtrC(dialogCaption));
+ TFileName target;
+ bool select = false;
+ int tryCount = 2;
+ while (tryCount--) {
+ TInt err(KErrNone);
+ TRAP(err,
+ if (dialogMode == DialogOpen) {
+ CExtensionFilter* extensionFilter = new (ELeave) CExtensionFilter;
+ CleanupStack::PushL(extensionFilter);
+ extensionFilter->setFilter(filter);
+ select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target,
+ startFolder, NULL, NULL, titlePtr, extensionFilter);
+ CleanupStack::Pop(extensionFilter);
+ } else if (dialogMode == DialogSave) {
+ select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target,
+ startFolder, NULL, NULL, titlePtr);
+ } else if (dialogMode == DialogFolder) {
+ select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder,
+ 0, 0, titlePtr, NULL, NULL);
+ }
+ );
+
+ if (err == KErrNone) {
+ tryCount = 0;
+ } else {
+ // Symbian native file dialog doesn't allow accessing files outside C:/Data
+ // It will always leave in that case, so default into QDir::rootPath() in error cases.
+ QString dir = QDir::toNativeSeparators(QDir::rootPath());
startFolder = qt_QString2TPtrC(dir);
}
- TInt types = AknCommonDialogsDynMem::EMemoryTypeMMCExternal|
- AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage|
- AknCommonDialogsDynMem::EMemoryTypePhone;
-
- TPtrC titlePtr(qt_QString2TPtrC(dialogCaption));
- TFileName target;
- bool select = false;
- if (dialogMode == DialogOpen) {
- CExtensionFilter* extensionFilter = new (ELeave) CExtensionFilter;
- CleanupStack::PushL(extensionFilter);
- extensionFilter->setFilter(filter);
- select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target,
- startFolder, NULL, NULL, titlePtr, extensionFilter);
- CleanupStack::Pop(extensionFilter);
- } else if (dialogMode == DialogSave) {
- select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target,
- startFolder, NULL, NULL, titlePtr);
- } else if (dialogMode == DialogFolder) {
- select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder,
- 0, 0, titlePtr, NULL, NULL);
- }
- if (select)
- selection.append(qt_TDesC2QString(target));
- );
+ }
+ if (select)
+ selection.append(qt_TDesC2QString(target));
#endif
return selection;
}
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index c5d9a7e..3a7be1d 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -775,8 +775,8 @@ QBitmap QPixmap::createHeuristicMask(bool clipTight) const
/*!
Creates and returns a mask for this pixmap based on the given \a
maskColor. If the \a mode is Qt::MaskInColor, all pixels matching the
- maskColor will be opaque. If \a mode is Qt::MaskOutColor, all pixels
- matching the maskColor will be transparent.
+ maskColor will be transparent. If \a mode is Qt::MaskOutColor, all pixels
+ matching the maskColor will be opaque.
This function is slow because it involves converting to/from a
QImage.
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 181fcc7..691c02a 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1071,6 +1071,14 @@ void QSymbianControl::Draw(const TRect& controlRect) const
Q_ASSERT(topExtra);
if (!topExtra->inExpose) {
topExtra->inExpose = true;
+ if (!qwidget->isWindow()) {
+ // If we get here, then it means we have a native child window
+ // Since no content should ever be painted to these windows, we
+ // erase them with a transparent brush when they get an expose.
+ CWindowGc &gc = SystemGc();
+ gc.SetBrushColor(TRgb(0, 0, 0, 0));
+ gc.Clear(controlRect);
+ }
QRect exposeRect = qt_TRect2QRect(controlRect);
qwidget->d_func()->syncBackingStore(exposeRect);
topExtra->inExpose = false;
diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp
index 825edbc..e085d11 100644
--- a/src/gui/kernel/qkeymapper_x11.cpp
+++ b/src/gui/kernel/qkeymapper_x11.cpp
@@ -61,13 +61,6 @@
#include <ctype.h>
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_XKB
-
-// bring in the auto-generated xkbLayoutData
-#include "qkeymapper_x11_p.cpp"
-
#ifdef QT_LINUXBASE
// LSB's IsKeypadKey define is wrong - see
// http://bugs.linuxbase.org/show_bug.cgi?id=2521
@@ -80,6 +73,13 @@ QT_BEGIN_NAMESPACE
(((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
#endif
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_XKB
+
+// bring in the auto-generated xkbLayoutData
+#include "qkeymapper_x11_p.cpp"
+
QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName)
{
int i = 0;
@@ -92,7 +92,6 @@ QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &vari
}
#endif // QT_NO_XKB
-
// from qapplication_x11.cpp
extern uchar qt_alt_mask;
extern uchar qt_meta_mask;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 62af212..4fd90ed 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -712,6 +712,38 @@ static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, i
}
#endif
+#if defined(QT_ALWAYS_HAVE_NEON)
+#define interpolate_4_pixels_16_neon(tl, tr, bl, br, distx, disty, disty_, colorMask, invColorMask, v_256, b) \
+{ \
+ const int16x8_t dxdy = vmulq_s16(distx, disty); \
+ const int16x8_t distx_ = vshlq_n_s16(distx, 4); \
+ const int16x8_t idxidy = vaddq_s16(dxdy, vsubq_s16(v_256, vaddq_s16(distx_, disty_))); \
+ const int16x8_t dxidy = vsubq_s16(distx_, dxdy); \
+ const int16x8_t idxdy = vsubq_s16(disty_, dxdy); \
+ \
+ int16x8_t tlAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(tl), 8)); \
+ int16x8_t tlRB = vandq_s16(tl, colorMask); \
+ int16x8_t trAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(tr), 8)); \
+ int16x8_t trRB = vandq_s16(tr, colorMask); \
+ int16x8_t blAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(bl), 8)); \
+ int16x8_t blRB = vandq_s16(bl, colorMask); \
+ int16x8_t brAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(br), 8)); \
+ int16x8_t brRB = vandq_s16(br, colorMask); \
+ \
+ int16x8_t rAG = vmulq_s16(tlAG, idxidy); \
+ int16x8_t rRB = vmulq_s16(tlRB, idxidy); \
+ rAG = vmlaq_s16(rAG, trAG, dxidy); \
+ rRB = vmlaq_s16(rRB, trRB, dxidy); \
+ rAG = vmlaq_s16(rAG, blAG, idxdy); \
+ rRB = vmlaq_s16(rRB, blRB, idxdy); \
+ rAG = vmlaq_s16(rAG, brAG, dxdy); \
+ rRB = vmlaq_s16(rRB, brRB, dxdy); \
+ \
+ rAG = vandq_s16(invColorMask, rAG); \
+ rRB = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rRB), 8)); \
+ vst1q_s16((int16_t*)(b), vorrq_s16(rAG, rRB)); \
+}
+#endif
template<TextureBlendType blendType>
Q_STATIC_TEMPLATE_FUNCTION inline void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2)
@@ -819,10 +851,9 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
}
}
-#if defined(QT_ALWAYS_HAVE_SSE2)
if (blendType != BlendTransformedBilinearTiled &&
(format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) {
-
+#if defined(QT_ALWAYS_HAVE_SSE2)
const __m128i disty_ = _mm_set1_epi16(disty);
const __m128i idisty_ = _mm_set1_epi16(idisty);
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
@@ -852,8 +883,38 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
rRB = _mm_srli_epi16(rRB, 8);
_mm_storeu_si128((__m128i*)(&intermediate_buffer[0][f]), rRB);
}
- }
+#elif defined(QT_ALWAYS_HAVE_NEON)
+ const int16x8_t disty_ = vdupq_n_s16(disty);
+ const int16x8_t idisty_ = vdupq_n_s16(idisty);
+ const int16x8_t colorMask = vdupq_n_s16(0x00ff);
+
+ lim -= 3;
+ for (; f < lim; x += 4, f += 4) {
+ // Load 4 pixels from s1, and split the alpha-green and red-blue component
+ int16x8_t top = vld1q_s16((int16_t*)((const uint *)(s1)+x));
+ int16x8_t topAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(top), 8));
+ int16x8_t topRB = vandq_s16(top, colorMask);
+ // Multiplies each colour component by idisty
+ topAG = vmulq_s16(topAG, idisty_);
+ topRB = vmulq_s16(topRB, idisty_);
+
+ // Same for the s2 vector
+ int16x8_t bottom = vld1q_s16((int16_t*)((const uint *)(s2)+x));
+ int16x8_t bottomAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(bottom), 8));
+ int16x8_t bottomRB = vandq_s16(bottom, colorMask);
+ bottomAG = vmulq_s16(bottomAG, disty_);
+ bottomRB = vmulq_s16(bottomRB, disty_);
+
+ // Add the values, and shift to only keep 8 significant bits per colors
+ int16x8_t rAG = vaddq_s16(topAG, bottomAG);
+ rAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rAG), 8));
+ vst1q_s16((int16_t*)(&intermediate_buffer[1][f]), rAG);
+ int16x8_t rRB = vaddq_s16(topRB, bottomRB);
+ rRB = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rRB), 8));
+ vst1q_s16((int16_t*)(&intermediate_buffer[0][f]), rRB);
+ }
#endif
+ }
for (; f < count; f++) { // Same as above but without sse2
if (blendType == BlendTransformedBilinearTiled) {
if (x >= image_width) x -= image_width;
@@ -920,35 +981,36 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
const uchar *s2 = data->texture.scanLine(y2);
int disty = (fy & 0x0000ffff) >> 12;
-#if defined(QT_ALWAYS_HAVE_SSE2)
if (blendType != BlendTransformedBilinearTiled &&
(format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) {
- //prolog to get into the bounds
- while (b < end) {
- int x1 = (fx >> 16);
- int x2;
- fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
- if (x1 != x2) //break if we are insided the bounds.
- break;
- uint tl = fetch(s1, x1, data->texture.colorTable);
- uint tr = fetch(s1, x2, data->texture.colorTable);
- uint bl = fetch(s2, x1, data->texture.colorTable);
- uint br = fetch(s2, x2, data->texture.colorTable);
- int distx = (fx & 0x0000ffff) >> 12;
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
- fx += fdx;
- ++b;
- }
- uint *boundedEnd;
- if (fdx > 0)
- boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11));
- else
- boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11));
+#define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \
+ while (b < end) { \
+ int x1 = (fx >> 16); \
+ int x2; \
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \
+ if (x1 != x2) \
+ break; \
+ uint tl = fetch(s1, x1, data->texture.colorTable); \
+ uint tr = fetch(s1, x2, data->texture.colorTable); \
+ uint bl = fetch(s2, x1, data->texture.colorTable); \
+ uint br = fetch(s2, x2, data->texture.colorTable); \
+ int distx = (fx & 0x0000ffff) >> 12; \
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \
+ fx += fdx; \
+ ++b; \
+ } \
+ uint *boundedEnd; \
+ if (fdx > 0) \
+ boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \
+ else \
+ boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \
boundedEnd -= 3;
+#if defined(QT_ALWAYS_HAVE_SSE2)
+ BILINEAR_DOWNSCALE_BOUNDS_PROLOG
+
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
- //const __m128i distShuffleMask = _mm_set_epi8(13, 12, 13, 12, 9, 8, 9, 8, 5, 4, 5, 4, 1, 0, 1, 0);
const __m128i v_256 = _mm_set1_epi16(256);
const __m128i v_disty = _mm_set1_epi16(disty);
__m128i v_fdx = _mm_set1_epi32(fdx*4);
@@ -976,8 +1038,7 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
bl.i[i] = *(addr_tl+secondLine);
br.i[i] = *(addr_tr+secondLine);
}
- __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12); //distx = (fx & 0x0000ffff) >> 12;
- //v_distx = _mm_shuffle_epi8(v_disty, distShuffleMask); //distx |= distx << 16;
+ __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12);
v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
@@ -986,8 +1047,57 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
v_fx.vect = _mm_add_epi32(v_fx.vect, v_fdx);
}
fx = v_fx.i[0];
- }
+#elif defined(QT_ALWAYS_HAVE_NEON)
+ BILINEAR_DOWNSCALE_BOUNDS_PROLOG
+
+ const int16x8_t colorMask = vdupq_n_s16(0x00ff);
+ const int16x8_t invColorMask = vmvnq_s16(colorMask);
+ const int16x8_t v_256 = vdupq_n_s16(256);
+ const int16x8_t v_disty = vdupq_n_s16(disty);
+ const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
+ int32x4_t v_fdx = vdupq_n_s32(fdx*4);
+
+ ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
+
+ union Vect_buffer { int32x4_t vect; quint32 i[4]; };
+ Vect_buffer v_fx;
+
+ for (int i = 0; i < 4; i++) {
+ v_fx.i[i] = fx;
+ fx += fdx;
+ }
+
+ const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+
+ while (b < boundedEnd) {
+
+ Vect_buffer tl, tr, bl, br;
+
+ Vect_buffer v_fx_shifted;
+ v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16);
+
+ int32x4_t v_distx = vshrq_n_s32(vandq_s32(v_fx.vect, v_ffff_mask), 12);
+
+ for (int i = 0; i < 4; i++) {
+ int x1 = v_fx_shifted.i[i];
+ const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
+ const uint *addr_tr = addr_tl + 1;
+ tl.i[i] = *addr_tl;
+ tr.i[i] = *addr_tr;
+ bl.i[i] = *(addr_tl+secondLine);
+ br.i[i] = *(addr_tr+secondLine);
+ }
+
+ v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
+
+ interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b);
+ b+=4;
+ v_fx.vect = vaddq_s32(v_fx.vect, v_fdx);
+ }
+ fx = v_fx.i[0];
#endif
+ }
+
while (b < end) {
int x1 = (fx >> 16);
int x2;
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index ffd0d5c..94e2cd4 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1196,7 +1196,8 @@ void QPainterPath::connectPath(const QPainterPath &other)
int first = d->elements.size();
d->elements += other.d_func()->elements;
- d->elements[first].type = LineToElement;
+ if (first != 0)
+ d->elements[first].type = LineToElement;
// avoid duplicate points
if (first > 0 && QPointF(d->elements[first]) == QPointF(d->elements[first - 1])) {
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 039a6da..1d7c838 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -1403,8 +1403,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
break;
case CE_ProgressBarGroove:
- qDrawShadePanel(p, opt->rect, opt->palette, true, 1,
- &opt->palette.brush(QPalette::Window));
+ if (opt->rect.isValid())
+ qDrawShadePanel(p, opt->rect, opt->palette, true, 1,
+ &opt->palette.brush(QPalette::Window));
break;
case CE_ProgressBarLabel:
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 720dd6d..32a6d8d 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -130,6 +130,7 @@ QWindowsStylePrivate::QWindowsStylePrivate()
pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");
}
#endif
+ startTime.start();
}
// Returns true if the toplevel parent of \a widget has seen the Alt-key
@@ -2396,8 +2397,10 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
#ifndef QT_NO_PROGRESSBAR
case CE_ProgressBarContents:
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
-
QRect rect = pb->rect;
+ if (!rect.isValid())
+ return;
+
bool vertical = false;
bool inverted = false;
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index df9b171..0a6269d 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1531,8 +1531,11 @@ QAction * QDockWidget::toggleViewAction() const
/*!
\since 4.3
+
Sets an arbitrary \a widget as the dock widget's title bar. If \a widget
- is 0, the title bar widget is removed, but not deleted.
+ is 0, any custom title bar widget previously set on the dock widget is
+ removed, but not deleted, and the default title bar will be used
+ instead.
If a title bar widget is set, QDockWidget will not use native window
decorations when it is floated.
@@ -1540,23 +1543,27 @@ QAction * QDockWidget::toggleViewAction() const
Here are some tips for implementing custom title bars:
\list
- \i Mouse events that are not explicitly handled by the title bar widget
+ \o Mouse events that are not explicitly handled by the title bar widget
must be ignored by calling QMouseEvent::ignore(). These events then
propagate to the QDockWidget parent, which handles them in the usual
manner, moving when the title bar is dragged, docking and undocking
when it is double-clicked, etc.
- \i When DockWidgetVerticalTitleBar is set on QDockWidget, the title
+ \o When DockWidgetVerticalTitleBar is set on QDockWidget, the title
bar widget is repositioned accordingly. In resizeEvent(), the title
bar should check what orientation it should assume:
\snippet doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp 0
- \i The title bar widget must have a valid QWidget::sizeHint() and
+ \o The title bar widget must have a valid QWidget::sizeHint() and
QWidget::minimumSizeHint(). These functions should take into account
the current orientation of the title bar.
+
+ \o It is not possible to remove a title bar from a dock widget. However,
+ a similar effect can be achieved by setting a default constructed
+ QWidget as the title bar widget.
\endlist
- Using qobject_cast as shown above, the title bar widget has full access
+ Using qobject_cast() as shown above, the title bar widget has full access
to its parent QDockWidget. Hence it can perform such operations as docking
and hiding in response to user actions.
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index 9c71004..7b05bc5 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -190,6 +190,12 @@ QVariant QDeclarativeFolderListModel::data(const QModelIndex &index, int role) c
return rv;
}
+/*!
+ \qmlproperty int FolderListModel::count
+
+ Returns the number of items in the current folder that match the
+ filter criteria.
+*/
int QDeclarativeFolderListModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
@@ -225,6 +231,11 @@ void QDeclarativeFolderListModel::setFolder(const QUrl &folder)
}
}
+/*!
+ \qmlproperty url FolderListModel::parentFolder
+
+ Returns the URL of the parent of of the current \l folder.
+*/
QUrl QDeclarativeFolderListModel::parentFolder() const
{
QString localFile = d->folder.toLocalFile();
@@ -286,6 +297,21 @@ void QDeclarativeFolderListModel::componentComplete()
QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
}
+/*!
+ \qmlproperty enumeration FolderListModel::sortField
+
+ The \a sortField property contains field to use for sorting. sortField
+ may be one of:
+ \list
+ \o Unsorted - no sorting is applied. The order is system default.
+ \o Name - sort by filename
+ \o Time - sort by time modified
+ \o Size - sort by file size
+ \o Type - sort by file type (extension)
+ \endlist
+
+ \sa sortReversed
+*/
QDeclarativeFolderListModel::SortField QDeclarativeFolderListModel::sortField() const
{
return d->sortField;
@@ -299,6 +325,13 @@ void QDeclarativeFolderListModel::setSortField(SortField field)
}
}
+/*!
+ \qmlproperty bool FolderListModel::sortReversed
+
+ If set to true, reverses the sort order. The default is false.
+
+ \sa sortField
+*/
bool QDeclarativeFolderListModel::sortReversed() const
{
return d->sortReversed;
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 7dc7dc7..b8716ce 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -284,6 +284,7 @@ struct QGLWindowSurfacePrivate
};
QGLFormat QGLWindowSurface::surfaceFormat;
+QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap;
void QGLWindowSurfaceGLPaintDevice::endPaint()
{
@@ -541,6 +542,9 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
const GLenum target = GL_TEXTURE_2D;
Q_UNUSED(target);
+ if (QGLWindowSurface::swapBehavior == QGLWindowSurface::KillSwap)
+ return;
+
if (context()) {
context()->makeCurrent();
@@ -588,7 +592,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
}
#endif
- bool doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2;
+ bool doingPartialUpdate = false;
+ if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap)
+ doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2;
+ else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysFullSwap)
+ doingPartialUpdate = false;
+ else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap)
+ doingPartialUpdate = hasPartialUpdateSupport();
+
QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext);
if (widget != window()) {
if (initializeOffscreenTexture(window()->size()))
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 6906f35..9b0bee3 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -102,6 +102,9 @@ public:
static QGLFormat surfaceFormat;
+ enum SwapMode { AutomaticSwap, AlwaysFullSwap, AlwaysPartialSwap, KillSwap };
+ static SwapMode swapBehavior;
+
private slots:
void deleted(QObject *object);
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index a5a183b..96827f3 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -966,6 +966,9 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
void QIcdEngine::icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner,
const QString &newOwner)
{
+ Q_UNUSED(serviceName);
+ Q_UNUSED(oldOwner);
+
QMutexLocker locker(&mutex);
if (newOwner.isEmpty()) {
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index f025d86..a370d78 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -144,6 +144,10 @@ SymbianEngine::~SymbianEngine()
{
Cancel();
+ //The scanner may be using the connection monitor so it needs to be
+ //deleted first while the handle is still valid.
+ delete ipAccessPointsAvailabilityScanner;
+
iConnectionMonitor.CancelNotifications();
iConnectionMonitor.Close();
@@ -151,8 +155,6 @@ SymbianEngine::~SymbianEngine()
iCmManager.Close();
#endif
- delete ipAccessPointsAvailabilityScanner;
-
// CCommsDatabase destructor uses cleanup stack. Since QNetworkConfigurationManager
// is a global static, but the time we are here, E32Main() has been exited already and
// the thread's default cleanup stack has been deleted. Without this line, a
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 4a86082..b1a8f5f7 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -75,6 +75,8 @@ QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem()
QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+
QMeeGoGraphicsSystem::surfaceWasCreated = true;
QWindowSurface *surface = new QGLWindowSurface(widget);
return surface;
@@ -82,12 +84,6 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
- // Long story short: without this it's possible to hit an
- // uninitialized paintDevice due to a Qt bug too complex to even
- // explain here... not to mention fix without going crazy.
- // MDK
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
return new QRasterPixmapData(type);
}
diff --git a/src/s60main/newallocator_hook.cpp b/src/s60main/newallocator_hook.cpp
index 9ea2ef0..3e259c2 100644
--- a/src/s60main/newallocator_hook.cpp
+++ b/src/s60main/newallocator_hook.cpp
@@ -69,6 +69,16 @@ TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
// So the function is found and called dynamically, by library lookup. If it is not found, we
// use the OS allocator creation functions instead.
+#if defined(QT_LIBINFIX)
+# define QT_LSTRING2(x) L##x
+# define QT_LSTRING(x) QT_LSTRING2(x)
+# define QT_LIBINFIX_UNICODE QT_LSTRING(QT_LIBINFIX)
+#else
+# define QT_LIBINFIX_UNICODE L""
+#endif
+
+_LIT(QtCoreLibName, "qtcore" QT_LIBINFIX_UNICODE L".dll");
+
struct SThreadCreateInfo
{
TAny* iHandle;
@@ -106,7 +116,7 @@ TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
#ifndef __WINS__
// attempt to create the fast allocator through a known export ordinal in qtcore.dll
RLibrary qtcore;
- if (qtcore.Load(_L("qtcore.dll")) == KErrNone)
+ if (qtcore.Load(QtCoreLibName) == KErrNone)
{
const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713;
TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal);
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 2a4e595..bf9685f 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -54,7 +54,6 @@
#include <qstringlist.h>
#include <qmutex.h>
-
#include <libpq-fe.h>
#include <pg_config.h>
@@ -619,6 +618,50 @@ static void setDatestyle(PGconn* connection)
PQclear(result);
}
+static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
+{
+ switch (vMaj) {
+ case 6:
+ return QPSQLDriver::Version6;
+ case 7:
+ {
+ switch (vMin) {
+ case 1:
+ return QPSQLDriver::Version71;
+ case 3:
+ return QPSQLDriver::Version73;
+ case 4:
+ return QPSQLDriver::Version74;
+ default:
+ return QPSQLDriver::Version7;
+ }
+ break;
+ }
+ case 8:
+ {
+ switch (vMin) {
+ case 1:
+ return QPSQLDriver::Version81;
+ case 2:
+ return QPSQLDriver::Version82;
+ case 3:
+ return QPSQLDriver::Version83;
+ case 4:
+ return QPSQLDriver::Version84;
+ default:
+ return QPSQLDriver::Version8;
+ }
+ break;
+ }
+ case 9:
+ return QPSQLDriver::Version9;
+ break;
+ default:
+ break;
+ }
+ return QPSQLDriver::VersionUnknown;
+}
+
static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection)
{
QPSQLDriver::Protocol serverVersion = QPSQLDriver::Version6;
@@ -626,50 +669,44 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection)
int status = PQresultStatus(result);
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
QString val = QString::fromAscii(PQgetvalue(result, 0, 0));
+
QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)"));
rx.setMinimal(true); // enforce non-greedy RegExp
+
if (rx.indexIn(val) != -1) {
int vMaj = rx.cap(1).toInt();
int vMin = rx.cap(2).toInt();
-
- switch (vMaj) {
- case 7:
- switch (vMin) {
- case 0:
- serverVersion = QPSQLDriver::Version7;
- break;
- case 1:
- case 2:
- serverVersion = QPSQLDriver::Version71;
- break;
- default:
- serverVersion = QPSQLDriver::Version73;
- break;
- }
- break;
- case 8:
- switch (vMin) {
- case 0:
- serverVersion = QPSQLDriver::Version8;
- break;
- case 1:
- serverVersion = QPSQLDriver::Version81;
- break;
- case 2:
- default:
- serverVersion = QPSQLDriver::Version82;
- break;
- }
- break;
- default:
- break;
+ serverVersion = qMakePSQLVersion(vMaj, vMin);
+#ifdef PG_MAJORVERSION
+ if (rx.indexIn(QLatin1String(PG_MAJORVERSION)) != -1) {
+ vMaj = rx.cap(1).toInt();
+ vMin = rx.cap(2).toInt();
+ }
+ QPSQLDriver::Protocol clientVersion = qMakePSQLVersion(vMaj, vMin);
+
+ if (serverVersion >= QPSQLDriver::Version9 && clientVersion < QPSQLDriver::Version9) {
+ //Client version before QPSQLDriver::Version9 only supports escape mode for bytea type,
+ //but bytea format is set to hex by default in PSQL 9 and above. So need to force the
+ //server use the old escape mode when connects to the new server with old client library.
+ result = PQexec(connection, "SET bytea_output=escape; ");
+ status = PQresultStatus(result);
+ } else if (serverVersion == QPSQLDriver::VersionUnknown) {
+ serverVersion = clientVersion;
+ if (serverVersion != QPSQLDriver::VersionUnknown)
+ qWarning("The server version of this PostgreSQL is unknown, falling back to the client version.");
}
+#endif
}
}
PQclear(result);
- if (serverVersion < QPSQLDriver::Version71)
+ //keep the old behavior unchanged
+ if (serverVersion == QPSQLDriver::VersionUnknown)
+ serverVersion = QPSQLDriver::Version6;
+
+ if (serverVersion < QPSQLDriver::Version71) {
qWarning("This version of PostgreSQL is not supported and may not work.");
+ }
return serverVersion;
}
@@ -852,7 +889,10 @@ bool QPSQLDriver::commitTransaction()
// This hack can dissapear once there is an API to query this sort of information.
if (d->pro == QPSQLDriver::Version8 ||
d->pro == QPSQLDriver::Version81 ||
- d->pro == QPSQLDriver::Version82) {
+ d->pro == QPSQLDriver::Version82 ||
+ d->pro == QPSQLDriver::Version83 ||
+ d->pro == QPSQLDriver::Version84 ||
+ d->pro == QPSQLDriver::Version9) {
transaction_failed = qstrcmp(PQcmdStatus(res), "ROLLBACK") == 0;
}
@@ -963,6 +1003,9 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
case QPSQLDriver::Version8:
case QPSQLDriver::Version81:
case QPSQLDriver::Version82:
+ case QPSQLDriver::Version83:
+ case QPSQLDriver::Version84:
+ case QPSQLDriver::Version9:
stmt = QLatin1String("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
"pg_class.relname "
"FROM pg_attribute, pg_class "
@@ -1046,6 +1089,9 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
case QPSQLDriver::Version8:
case QPSQLDriver::Version81:
case QPSQLDriver::Version82:
+ case QPSQLDriver::Version83:
+ case QPSQLDriver::Version84:
+ case QPSQLDriver::Version9:
stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
"pg_attrdef.adsrc "
diff --git a/src/sql/drivers/psql/qsql_psql.h b/src/sql/drivers/psql/qsql_psql.h
index 22871ff..107da87 100644
--- a/src/sql/drivers/psql/qsql_psql.h
+++ b/src/sql/drivers/psql/qsql_psql.h
@@ -97,6 +97,7 @@ class Q_EXPORT_SQLDRIVER_PSQL QPSQLDriver : public QSqlDriver
Q_OBJECT
public:
enum Protocol {
+ VersionUnknown = -1,
Version6 = 6,
Version7 = 7,
Version71 = 8,
@@ -104,7 +105,10 @@ public:
Version74 = 10,
Version8 = 11,
Version81 = 12,
- Version82 = 13
+ Version82 = 13,
+ Version83 = 14,
+ Version84 = 15,
+ Version9 = 16,
};
explicit QPSQLDriver(QObject *parent=0);