diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-11-10 23:00:14 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-11-10 23:00:14 (GMT) |
commit | ad925d41019d5e5c47143ab91f775f970995ad0d (patch) | |
tree | ad05cea02ddf9c87b832fc7111bb1b09f5203408 /src | |
parent | b7d91c0d798bc10dd4f8a750723285076fb96935 (diff) | |
parent | 38e1ed3b51d6aad46912eb548490d038e58203d9 (diff) | |
download | Qt-ad925d41019d5e5c47143ab91f775f970995ad0d.zip Qt-ad925d41019d5e5c47143ab91f775f970995ad0d.tar.gz Qt-ad925d41019d5e5c47143ab91f775f970995ad0d.tar.bz2 |
Merge branch '4.7-upstream' into 4.7-water
Diffstat (limited to 'src')
79 files changed, 756 insertions, 330 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 4d8418b..237c9ae 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -833,7 +833,7 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, Post, - Post, None, Below, None, + Pre, None, Below, None, None, Post, None, None, None, None, None, None, None, None, Post, Post, diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index 090998c..028a0a5 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -90,8 +90,6 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align return newptr + 1; } - union { void *ptr; void **pptr; quintptr n; } real, faked; - // qMalloc returns pointers aligned at least at sizeof(size_t) boundaries // but usually more (8- or 16-byte boundaries). // So we overallocate by alignment-sizeof(size_t) bytes, so we're guaranteed to find a @@ -100,19 +98,21 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align // However, we need to store the actual pointer, so we need to allocate actually size + // alignment anyway. - real.ptr = qRealloc(actualptr, newsize + alignment); - if (!real.ptr) + void *real = qRealloc(actualptr, newsize + alignment); + if (!real) return 0; - faked.n = real.n + alignment; - faked.n &= ~(alignment - 1); + quintptr faked = reinterpret_cast<quintptr>(real) + alignment; + faked &= ~(alignment - 1); + + void **faked_ptr = reinterpret_cast<void **>(faked); // now save the value of the real pointer at faked-sizeof(void*) // by construction, alignment > sizeof(void*) and is a power of 2, so // faked-sizeof(void*) is properly aligned for a pointer - faked.pptr[-1] = real.ptr; + faked_ptr[-1] = real; - return faked.ptr; + return faked_ptr; } void qFreeAligned(void *ptr) diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index 207ad2b..b003c12 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -48,6 +48,7 @@ #include <private/qdeclarativeengine_p.h> #include <private/qabstractanimation_p.h> +#include <private/qdeclarativeengine_p.h> QT_BEGIN_NAMESPACE @@ -63,4 +64,11 @@ void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor) timer->setSlowdownFactor(factor); } +void QDeclarativeDebugHelper::enableDebugging() { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + qWarning("Qml debugging is enabled. Only use this in a safe environment!"); + } + QDeclarativeEnginePrivate::qml_debugging_enabled = true; +} + QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h index 5689dff..fcd7115 100644 --- a/src/declarative/debugger/qdeclarativedebughelper_p.h +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -55,11 +55,15 @@ class QDeclarativeEngine; // Helper methods to access private API through a stable interface // This is used in the qmljsdebugger library of QtCreator. -class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugHelper +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); static void setAnimationSlowDownFactor(qreal factor); + + // Enables remote debugging functionality + // Only use this for debugging in a safe environment! + static void enableDebugging(); }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index c39da3d..8c86ae8 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -42,6 +42,7 @@ #include "private/qdeclarativedebugservice_p.h" #include "private/qpacketprotocol_p.h" +#include "private/qdeclarativeengine_p.h" #include <QtCore/qdebug.h> #include <QtNetwork/qtcpserver.h> @@ -205,6 +206,12 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() // format: qmljsdebugger=port:3768[,block] if (!appD->qmljsDebugArgumentsString().isEmpty()) { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + qWarning() << QString::fromLatin1("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Debugging has not been enabled.").arg( + appD->qmljsDebugArgumentsString()).toAscii().constData(); + return 0; + } if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index a88fc2b..c638eec 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE // before we perform a flick. static const int FlickThreshold = 20; -// Really slow flicks can be annoying. -static const int MinimumFlickVelocity = 75; - QDeclarativeFlickableVisibleArea::QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent) : QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.) , m_yPosition(0.), m_heightRatio(0.) @@ -990,8 +987,8 @@ void QDeclarativeFlickable::viewportMoved() { Q_D(QDeclarativeFlickable); - qreal prevY = d->lastFlickablePosition.x(); - qreal prevX = d->lastFlickablePosition.y(); + qreal prevX = d->lastFlickablePosition.x(); + qreal prevY = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); if (d->pressed || d->calcVelocity) { int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); @@ -1012,7 +1009,7 @@ void QDeclarativeFlickable::viewportMoved() } } - d->lastFlickablePosition = QPointF(d->vData.move.value(), d->hData.move.value()); + d->lastFlickablePosition = QPointF(d->hData.move.value(), d->vData.move.value()); d->vTime = d->timeline.time(); d->updateBeginningEnd(); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index afefde2..92cf748 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -66,6 +66,9 @@ QT_BEGIN_NAMESPACE +// Really slow flicks can be annoying. +const qreal MinimumFlickVelocity = 75.0; + class QDeclarativeFlickableVisibleArea; class QDeclarativeFlickablePrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener { diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 08d237f..3b08a9b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -259,8 +259,10 @@ void QDeclarativeImage::setFillMode(FillMode mode) \qmlproperty real Image::paintedHeight These properties hold the size of the image that is actually painted. - In most cases it is the same as \c width and \c height, but when using a \c fillMode like - \c PreserveAspectFit \c paintedWidth or \c paintedHeight can be smaller than \c width and \c height. + In most cases it is the same as \c width and \c height, but when using a + \c fillMode \c PreserveAspectFit or \c fillMode \c PreserveAspectCrop + \c paintedWidth or \c paintedHeight can be smaller or larger than + \c width and \c height of the Image element. */ qreal QDeclarativeImage::paintedWidth() const { @@ -288,23 +290,25 @@ qreal QDeclarativeImage::paintedHeight() const Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: image.status = Image.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: image.status == Image.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml Image { id: image onStatusChanged: if (image.status == Image.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: image.status != Image.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: image.status == Image.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist \sa progress */ @@ -397,6 +401,19 @@ void QDeclarativeImage::updatePaintedGeometry() if (heightValid() && !widthValid()) { setImplicitWidth(d->paintedWidth); } + } else if (d->fillMode == PreserveAspectCrop) { + if (!d->pix.width() || !d->pix.height()) + return; + qreal widthScale = width() / qreal(d->pix.width()); + qreal heightScale = height() / qreal(d->pix.height()); + if (widthScale < heightScale) { + widthScale = heightScale; + } else if(heightScale < widthScale) { + heightScale = widthScale; + } + + d->paintedHeight = heightScale * qreal(d->pix.height()); + d->paintedWidth = widthScale * qreal(d->pix.width()); } else { d->paintedWidth = width(); d->paintedHeight = height(); @@ -410,6 +427,12 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF updatePaintedGeometry(); } +QRectF QDeclarativeImage::boundingRect() const +{ + Q_D(const QDeclarativeImage); + return QRectF(0, 0, qMax(d->mWidth, d->paintedWidth), qMax(d->mHeight, d->paintedHeight)); +} + /*! \qmlproperty url Image::source @@ -494,7 +517,7 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi } if (clip()) { p->save(); - p->setClipRect(boundingRect(), Qt::IntersectClip); + p->setClipRect(QRectF(0, 0, d->mWidth, d->mHeight), Qt::IntersectClip); } scale.scale(widthScale, heightScale); QTransform old = p->transform(); diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index c8bb30b..0e8034e 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -76,6 +76,7 @@ public: qreal paintedHeight() const; void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + QRectF boundingRect() const; Q_SIGNALS: void fillModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 95a4fd6..e0df751 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1955,12 +1955,8 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); } - if (newGeometry.x() != oldGeometry.x()) - emit xChanged(); if (newGeometry.width() != oldGeometry.width()) emit widthChanged(); - if (newGeometry.y() != oldGeometry.y()) - emit yChanged(); if (newGeometry.height() != oldGeometry.height()) emit heightChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 38a4839..94b1cb3 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -334,28 +334,9 @@ public: return model && model->count() && model->isValid(); } - int snapIndex() { - int index = currentIndex; - for (int i = 0; i < visibleItems.count(); ++i) { - FxListItem *item = visibleItems[i]; - if (item->index == -1) - continue; - qreal itemTop = item->position(); - if (itemTop >= highlight->position()-item->size()/2 && itemTop < highlight->position()+item->size()/2) - return item->index; - } - return index; - } - qreal snapPosAt(qreal pos) { - for (int i = 0; i < visibleItems.count(); ++i) { - FxListItem *item = visibleItems[i]; - if (item->index == -1) - continue; - qreal itemTop = item->position(); - if (itemTop+item->size()/2 >= pos && itemTop <= pos) - return item->position(); - } + if (FxListItem *snapItem = snapItemAt(pos)) + return snapItem->position(); if (visibleItems.count()) { qreal firstPos = visibleItems.first()->position(); qreal endPos = visibleItems.last()->position(); @@ -368,17 +349,18 @@ public: } FxListItem *snapItemAt(qreal pos) { + FxListItem *snapItem = 0; for (int i = 0; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems[i]; if (item->index == -1) continue; qreal itemTop = item->position(); - if (item->index == model->count()-1 || (itemTop+item->size()/2 >= pos)) + if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size() - 1) return item; + if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos) + snapItem = item; } - if (visibleItems.count() && visibleItems.first()->position() <= pos) - return visibleItems.first(); - return 0; + return snapItem; } int lastVisibleIndex() const { @@ -768,8 +750,10 @@ void QDeclarativeListViewPrivate::layout() minExtentDirty = true; maxExtentDirty = true; updateHighlight(); - fixupPosition(); - q->refill(); + if (!q->isMoving() && !q->isFlicking()) { + fixupPosition(); + q->refill(); + } if (header) updateHeader(); if (footer) @@ -1173,6 +1157,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m || (orient == QDeclarativeListView::Vertical && &data == &hData)) return; + correctFlick = false; int oldDuration = fixupDuration; fixupDuration = moveReason == Mouse ? fixupDuration : 0; @@ -1350,12 +1335,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal newtarget = data.flickTarget; if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange) newtarget = -snapPosAt(-(data.flickTarget - highlightRangeStart)) + highlightRangeStart; - if (velocity < 0 && newtarget < maxExtent) - newtarget = maxExtent; - else if (velocity > 0 && newtarget > minExtent) - newtarget = minExtent; - if (newtarget == data.flickTarget) // boundary unchanged - nothing to do + if (velocity < 0 && newtarget <= maxExtent) + newtarget = maxExtent - overshootDist; + else if (velocity > 0 && newtarget >= minExtent) + newtarget = minExtent + overshootDist; + if (newtarget == data.flickTarget) { // boundary unchanged - nothing to do + if (qAbs(velocity) < MinimumFlickVelocity) + correctFlick = false; return; + } data.flickTarget = newtarget; qreal dist = -newtarget + data.move.value(); if ((v < 0 && dist < 0) || (v > 0 && dist > 0)) { @@ -1365,7 +1353,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m return; } timeline.reset(data.move); - timeline.accelDistance(data.move, v, -dist + (v < 0 ? -overshootDist : overshootDist)); + timeline.accelDistance(data.move, v, -dist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); } } else { @@ -1696,7 +1684,7 @@ void QDeclarativeListView::setCurrentIndex(int index) if (isComponentComplete() && d->isValid()) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(index); - } else { + } else if (d->currentIndex != index) { d->currentIndex = index; emit currentIndexChanged(); } @@ -2323,9 +2311,10 @@ void QDeclarativeListView::viewportMoved() d->highlight->setPosition(qRound(pos)); // update current index - int idx = d->snapIndex(); - if (idx >= 0 && idx != d->currentIndex) - d->updateCurrent(idx); + if (FxListItem *snapItem = d->snapItemAt(d->highlight->position())) { + if (snapItem->index >= 0 && snapItem->index != d->currentIndex) + d->updateCurrent(snapItem->index); + } } } diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 7777567..109fbbb 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -395,23 +395,25 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: loader.status = Loader.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: loader.status == Loader.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml Loader { id: loader onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: loader.status != Loader.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist Note that if the source is a local file, the status will initially be Ready (or Error). While there will be no onStatusChanged signal in that case, the onLoaded will still be invoked. diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 1ffd3bd..fc3954f 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -477,7 +477,8 @@ void QDeclarativeRectangle::drawRect(QPainter &p) { Q_D(QDeclarativeRectangle); if ((d->gradient && d->gradient->gradient()) - || d->radius > width()/2 || d->radius > height()/2) { + || d->radius > width()/2 || d->radius > height()/2 + || width() < 3 || height() < 3) { // XXX This path is still slower than the image path // Image path won't work for gradients or invalid radius though bool oldAA = p.testRenderHint(QPainter::Antialiasing); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 03c9765..82c444e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -219,6 +219,7 @@ void QDeclarativeTextPrivate::updateSize() QFontMetrics fm(font); if (text.isEmpty()) { + q->setImplicitWidth(0); q->setImplicitHeight(fm.height()); emit q->paintedSizeChanged(); q->update(); @@ -284,37 +285,58 @@ QSize QDeclarativeTextPrivate::setupTextLayout() { // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); - Q_Q(QDeclarativeText); layout.setCacheEnabled(true); qreal height = 0; + qreal widthUsed = 0; qreal lineWidth = 0; //set manual width - if (q->widthValid()) + if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) lineWidth = q->width(); QTextOption textOption = layout.textOption(); textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); - textOption.setAlignment(Qt::Alignment(hAlign)); layout.setTextOption(textOption); layout.beginLayout(); - while (1) { + forever { QTextLine line = layout.createLine(); if (!line.isValid()) break; - if (q->widthValid()) { + if (lineWidth) line.setLineWidth(lineWidth); - line.setPosition(QPointF(0, height)); - height += line.height(); - } } layout.endLayout(); - return QSize(qCeil(layout.boundingRect().width()), layout.boundingRect().height()); + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + widthUsed = qMax(widthUsed, line.naturalTextWidth()); + } + + qreal layoutWidth = q->widthValid() ? q->width() : widthUsed; + + qreal x = 0; + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + line.setPosition(QPointF(0, height)); + height += line.height(); + + if (!cacheAllTextAsImage) { + if (hAlign == QDeclarativeText::AlignLeft) { + x = 0; + } else if (hAlign == QDeclarativeText::AlignRight) { + x = layoutWidth - line.naturalTextWidth(); + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (layoutWidth - line.naturalTextWidth()) / 2; + } + line.setPosition(QPointF(x, line.y())); + } + } + + return layout.boundingRect().toAlignedRect().size(); } /*! @@ -326,6 +348,19 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) //do layout QSize size = layedOutTextSize; + qreal x = 0; + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + if (hAlign == QDeclarativeText::AlignLeft) { + x = 0; + } else if (hAlign == QDeclarativeText::AlignRight) { + x = size.width() - line.naturalTextWidth(); + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (size.width() - line.naturalTextWidth()) / 2; + } + line.setPosition(QPointF(x, line.y())); + } + //paint text QPixmap img(size); if (!size.isEmpty()) { @@ -1028,7 +1063,7 @@ void QDeclarativeText::setTextFormat(TextFormat format) Set this property to elide parts of the text fit to the Text item's width. The text will only elide if an explicit width has been set. - This property cannot be used with wrapping enabled or with rich text. + This property cannot be used with multi-line text or with rich text. Eliding can be: \list diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 2348478..0deacf8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -460,10 +460,9 @@ QRect QDeclarativeTextInput::cursorRectangle() const text edit. Note that if selectionStart == selectionEnd then there is no current - selection. If you attempt to set selectionStart to a value outside of - the current text, selectionStart will not be changed. + selection. - \sa selectionEnd, cursorPosition, selectedText + \sa selectionEnd, cursorPosition, selectedText, select() */ int QDeclarativeTextInput::selectionStart() const { @@ -479,10 +478,9 @@ int QDeclarativeTextInput::selectionStart() const text edit. Note that if selectionStart == selectionEnd then there is no current - selection. If you attempt to set selectionEnd to a value outside of - the current text, selectionEnd will not be changed. + selection. - \sa selectionStart, cursorPosition, selectedText + \sa selectionStart, cursorPosition, selectedText, select() */ int QDeclarativeTextInput::selectionEnd() const { @@ -490,6 +488,19 @@ int QDeclarativeTextInput::selectionEnd() const return d->lastSelectionEnd; } +/*! + \qmlmethod void TextInput::select(int start, int end) + + Causes the text from \a start to \a end to be selected. + + If either start or end is out of range, the selection is not changed. + + After calling this, selectionStart will become the lesser + and selectionEnd will become the greater (regardless of the order passed + to this method). + + \sa selectionStart, selectionEnd +*/ void QDeclarativeTextInput::select(int start, int end) { Q_D(QDeclarativeTextInput); diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp index 89a2158..e8da367 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp @@ -94,7 +94,7 @@ class DrawTextItemRecorder: public QPaintEngine if (!m_inertText->items.isEmpty()) { QStaticTextItem &last = m_inertText->items[m_inertText->items.count() - 1]; - if (last.fontEngine == ti.fontEngine && last.font == ti.font() && + if (last.fontEngine() == ti.fontEngine && last.font == ti.font() && (!m_dirtyPen || last.color == state->pen().color())) { needFreshCurrentItem = false; @@ -107,7 +107,7 @@ class DrawTextItemRecorder: public QPaintEngine if (needFreshCurrentItem) { QStaticTextItem currentItem; - currentItem.fontEngine = ti.fontEngine; + currentItem.setFontEngine(ti.fontEngine); currentItem.font = ti.font(); currentItem.charOffset = charOffset; currentItem.numChars = ti.num_chars; @@ -285,6 +285,19 @@ void QDeclarativeTextLayout::beginLayout() QTextLayout::beginLayout(); } +void QDeclarativeTextLayout::clearLayout() +{ + if (d && d->cached) { + d->cached = false; + d->items.clear(); + d->positions.clear(); + d->glyphs.clear(); + d->chars.clear(); + d->position = QPointF(); + } + QTextLayout::clearLayout(); +} + void QDeclarativeTextLayout::prepare() { if (!d || !d->cached) { diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h index 90bf0e0..8b81db3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h @@ -59,6 +59,7 @@ public: ~QDeclarativeTextLayout(); void beginLayout(); + void clearLayout(); void prepare(); void draw(QPainter *, const QPointF & = QPointF()); diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 0a2a6db..2686ce3 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -98,6 +98,43 @@ class QByteArray; int width = item->width(); // width = 200 \endcode + + \section2 Network Components + + If the URL passed to QDeclarativeComponent is a network resource, or if the QML document references a + network resource, the QDeclarativeComponent has to fetch the network data before it is able to create + objects. In this case, the QDeclarativeComponent will have a \l {QDeclarativeComponent::Loading}{Loading} + \l {QDeclarativeComponent::status()}{status}. An application will have to wait until the component + is \l {QDeclarativeComponent::Ready}{Ready} before calling \l {QDeclarativeComponent::create()}. + + The following example shows how to load a QML file from a network resource. After creating + the QDeclarativeComponent, it tests whether the component is loading. If it is, it connects to the + QDeclarativeComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method + directly. Note that QDeclarativeComponent::isLoading() may be false for a network component if the + component has been cached and is ready immediately. + + \code + MyApplication::MyApplication() + { + // ... + component = new QDeclarativeComponent(engine, QUrl("http://www.example.com/main.qml")); + if (component->isLoading()) + QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), + this, SLOT(continueLoading())); + else + continueLoading(); + } + + void MyApplication::continueLoading() + { + if (component->isError()) { + qWarning() << component->errors(); + } else { + QObject *myObject = component->create(); + } + } + \endcode + \sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code} */ diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 59d5cfa..1e58a71 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -86,9 +86,14 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() QDeclarativeComponent component(&engine); component.setData("import QtQuick 1.0\nListView { model: myModel }", QUrl()); - component.create(context); + QObject *window = component.create(context); \endcode + Note it is the responsibility of the creator to delete any QDeclarativeContext it + constructs. If the \c context object in the example is no longer needed when the + \c window component instance is destroyed, the \c context must be destroyed explicitly. + The simplest way to ensure this is to set \c window as the parent of \c context. + To simplify binding and maintaining larger data sets, a context object can be set on a QDeclarativeContext. All the properties of the context object are available by name in the context, as though they were all individually added through calls @@ -119,11 +124,13 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() All properties added explicitly by QDeclarativeContext::setContextProperty() take precedence over the context object's properties. - Contexts form a hierarchy. The root of this hierarchy is the QDeclarativeEngine's - \l {QDeclarativeEngine::rootContext()}{root context}. A component instance can - access the data in its own context, as well as all its ancestor contexts. Data - can be made available to all instances by modifying the - \l {QDeclarativeEngine::rootContext()}{root context}. + \section2 The Context Hierarchy + + Contexts form a hierarchy. The root of this hierarchy is the QML engine's + \l {QDeclarativeEngine::rootContext()}{root context}. Child contexts inherit + the context properties of their parents; if a child context sets a context property + that already exists in its parent, the new context property overrides that of the + parent. The following example defines two contexts - \c context1 and \c context2. The second context overrides the "b" context property inherited from the first with a @@ -144,7 +151,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. - \note Setting the context object or adding new context properties after an object + \warning Setting the context object or adding new context properties after an object has been created in that context is an expensive operation (essentially forcing all bindings to reevaluate). Thus whenever possible you should complete "setup" of the context before using it to create any objects. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 6906f21..808ba68 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -176,6 +176,7 @@ struct StaticQtMetaObject : public QObject }; static bool qt_QmlQtModule_registered = false; +bool QDeclarativeEnginePrivate::qml_debugging_enabled = false; void QDeclarativeEnginePrivate::defineModule() { diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 8539fbf..deb4a77 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -321,6 +321,8 @@ public: static QString urlToLocalFileOrQrc(const QUrl& url); static void defineModule(); + + static bool qml_debugging_enabled; }; /*! diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index b4753df..77184c2 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -356,7 +356,7 @@ namespace QDeclarativeParser // True if the setting of this property will be deferred. Set by the // QDeclarativeCompiler bool isDeferred; - // True if this property is a value-type psuedo-property + // True if this property is a value-type pseudo-property bool isValueTypeSubProperty; LocationSpan location; diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index d45ddbc..388c92e 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -55,9 +55,6 @@ #include <QtCore/qglobal.h> #include <QtCore/qvariant.h> -#ifndef Q_OS_WIN -#include <stdint.h> -#endif QT_BEGIN_HEADER @@ -105,7 +102,7 @@ namespace QDeclarativePrivate template<class From, class To> struct StaticCastSelectorClass<From, To, sizeof(int)> { - static inline int cast() { return int(reinterpret_cast<intptr_t>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } + static inline int cast() { return int(reinterpret_cast<quintptr>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } }; template<class From, class To> diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 789116e..be7ea0e 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -514,7 +514,7 @@ void QDeclarativeWorkerScriptEngine::run() /*! \qmlclass WorkerScript QDeclarativeWorkerScript - \ingroup qml-utility-elements + \ingroup qml-utility-elements \brief The WorkerScript element enables the use of threads in QML. Use WorkerScript to run operations in a new thread. @@ -528,7 +528,7 @@ void QDeclarativeWorkerScriptEngine::run() \snippet doc/src/snippets/declarative/workerscript.qml 0 - The above worker script specifies a javascript file, "script.js", that handles + The above worker script specifies a JavaScript file, "script.js", that handles the operations to be performed in the new thread. Here is \c script.js: \qml @@ -543,6 +543,19 @@ void QDeclarativeWorkerScriptEngine::run() \tt script.js. This in turn sends a reply message that is then received by the \tt onMessage() handler of \tt myWorker. + + \section3 Restrictions + + Since the \c WorkerScript.onMessage() function is run in a separate thread, the + JavaScript file is evaluated in a context separate from the main QML engine. This means + that unlike an ordinary JavaScript file that is imported into QML, the \c script.js + in the above example cannot access the properties, methods or other attributes + of the QML item, nor can it access any context properties set on the QML object + through QDeclarativeContext. + + Additionally, there are restrictions on the types of values that can be passed to and + from the worker script. See the sendMessage() documentation for details. + \sa {declarative/threading/workerscript}{WorkerScript example}, {declarative/threading/threadedlistmodel}{Threaded ListModel example} */ @@ -586,6 +599,19 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source) Sends the given \a message to a worker script handler in another thread. The other worker script handler can receive this message through the onMessage() handler. + + The \c message object may only contain values of the following + types: + + \list + \o boolean, number, string + \o JavaScript objects and arrays + \o ListModel objects (any other type of QObject* is not allowed) + \endlist + + All objects and arrays are copied to the \c message. With the exception + of ListModel objects, any modifications by the other thread to an object + passed in \c message will not be reflected in the original object. */ void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message) { diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index 58f8811..dfe89f8 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -41,10 +41,6 @@ #include "private/qmetaobjectbuilder_p.h" -#ifndef Q_OS_WIN -#include <stdint.h> -#endif - QT_BEGIN_NAMESPACE /*! @@ -1264,8 +1260,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, char *str = reinterpret_cast<char *>(buf + size); if (buf) { if (relocatable) { - meta->d.stringdata = reinterpret_cast<const char *>((intptr_t)size); - meta->d.data = reinterpret_cast<uint *>((intptr_t)pmetaSize); + meta->d.stringdata = reinterpret_cast<const char *>((quintptr)size); + meta->d.data = reinterpret_cast<uint *>((quintptr)pmetaSize); } else { meta->d.stringdata = str; meta->d.data = reinterpret_cast<uint *>(data); @@ -1502,8 +1498,8 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, const char *buf = data.constData(); const QMetaObject *dataMo = reinterpret_cast<const QMetaObject *>(buf); - intptr_t stringdataOffset = (intptr_t)dataMo->d.stringdata; - intptr_t dataOffset = (intptr_t)dataMo->d.data; + quintptr stringdataOffset = (quintptr)dataMo->d.stringdata; + quintptr dataOffset = (quintptr)dataMo->d.data; output->d.superdata = superclass; output->d.stringdata = buf + stringdataOffset; diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 9fee257..03a0561 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -297,23 +297,25 @@ void QDeclarativeFontLoader::setName(const QString &name) Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: loader.status = FontLoader.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: loader.status == FontLoader.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml FontLoader { id: loader onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: loader.status != FontLoader.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist */ QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const { diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 0f5413e..3915485 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); QDeclarativeAction::QDeclarativeAction() -: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), toBinding(0), event(0), +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0), specifiedObject(0) { } @@ -67,7 +67,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName), toValue(value), - fromBinding(0), toBinding(0), event(0), + fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -78,7 +78,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN QDeclarativeContext *context, const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName, context), toValue(value), - fromBinding(0), toBinding(0), event(0), + fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -503,11 +503,11 @@ void QDeclarativeState::addEntriesToRevertList(const QList<QDeclarativeAction> & const QDeclarativeAction &action = actionListIterator.next(); QDeclarativeSimpleAction simpleAction(action); action.property.write(action.toValue); - if (action.toBinding) { + if (!action.toBinding.isNull()) { QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property()); if (oldBinding) QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0); - QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding, QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding.data(), QDeclarativePropertyPrivate::DontRemoveBinding); } simpleActionList.append(simpleAction); @@ -675,7 +675,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit a.property = d->revertList.at(ii).property(); a.fromValue = cur; a.toValue = d->revertList.at(ii).value(); - a.toBinding = d->revertList.at(ii).binding(); + a.toBinding = QDeclarativeAbstractBinding::getPointer(d->revertList.at(ii).binding()); a.specifiedObject = d->revertList.at(ii).specifiedObject(); a.specifiedProperty = d->revertList.at(ii).specifiedProperty(); a.event = d->revertList.at(ii).event(); diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index fc7c940..7b9c18a 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -45,6 +45,7 @@ #include <qdeclarative.h> #include <qdeclarativeproperty.h> #include <QtCore/qobject.h> +#include <private/qdeclarativebinding_p.h> #include <private/qdeclarativeglobal_p.h> QT_BEGIN_HEADER @@ -75,7 +76,7 @@ public: QVariant toValue; QDeclarativeAbstractBinding *fromBinding; - QDeclarativeAbstractBinding *toBinding; + QDeclarativeAbstractBinding::Pointer toBinding; QDeclarativeActionEvent *event; //strictly for matching diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index 4fd8f21..98c3f7b 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -85,7 +85,7 @@ public: m_reverseEvent = true; } else { m_value = a.toValue; - m_binding = QDeclarativeAbstractBinding::getPointer(a.toBinding); + m_binding = a.toBinding; m_reverseEvent = false; } } diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 478c7f4..c8bc7b3 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -86,12 +86,16 @@ QT_BEGIN_NAMESPACE Item { ... transitions: [ - Transition { ... }, + Transition { to: "state1" ... }, Transition { ... } ] } \endqml + If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular + state change. In the example above, when changing to \c state1, the first transition will be used, rather + than the more generic second transition. + If a state change has a Transition that matches the same property as a \l Behavior, the Transition animation overrides the \l Behavior for that state change. diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 89b0044..d19e6f2 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -99,8 +99,8 @@ void QDeclarativeTransitionManager::complete() void QDeclarativeTransitionManagerPrivate::applyBindings() { foreach(const QDeclarativeAction &action, bindingsList) { - if (action.toBinding) { - QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding); + if (!action.toBinding.isNull()) { + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data()); } else if (action.event) { if (action.reverseEvent) action.event->reverse(); @@ -145,8 +145,8 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & // Apply all the property and binding changes for (int ii = 0; ii < applyList.size(); ++ii) { const QDeclarativeAction &action = applyList.at(ii); - if (action.toBinding) { - QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + if (!action.toBinding.isNull()) { + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (!action.event) { QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (action.event->isReversable()) { @@ -165,7 +165,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & continue; } const QDeclarativeProperty &prop = action->property; - if (action->toBinding || !action->toValue.isValid()) { + if (!action->toBinding.isNull() || !action->toValue.isValid()) { action->toValue = prop.read(); } } @@ -259,10 +259,10 @@ void QDeclarativeTransitionManager::cancel() for(int i = 0; i < d->bindingsList.count(); ++i) { QDeclarativeAction action = d->bindingsList[i]; - if (action.toBinding && action.deletableToBinding) { + if (!action.toBinding.isNull() && action.deletableToBinding) { QDeclarativePropertyPrivate::setBinding(action.property, 0); - action.toBinding->destroy(); - action.toBinding = 0; + action.toBinding.data()->destroy(); + action.toBinding.clear(); action.deletableToBinding = false; } else if (action.event) { //### what do we do here? diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index af3b79a..9b41909 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -210,7 +210,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) else configId = qgetenv("QT_GL_EGL_CONFIG"); if (!configId.isEmpty()) { - // Overriden, so get the EGLConfig for the specified config ID: + // Overridden, so get the EGLConfig for the specified config ID: EGLint properties[] = { EGL_CONFIG_ID, (EGLint)configId.toInt(), EGL_NONE @@ -267,7 +267,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) configAttribs.setValue(EGL_STENCIL_SIZE, 1); configAttribs.setValue(EGL_SAMPLE_BUFFERS, 1); #ifndef QT_OPENGL_ES_2 - // Aditionally, the GL1 engine likes to have a depth buffer for clipping + // Additionally, the GL1 engine likes to have a depth buffer for clipping configAttribs.setValue(EGL_DEPTH_SIZE, 1); #endif } diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 320395e..e0eb3bb 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -1508,7 +1508,7 @@ int QGraphicsProxyWidget::type() const Creates a proxy widget for the given \a child of the widget contained in this proxy. - This function makes it possible to aquire proxies for + This function makes it possible to acquire proxies for non top-level widgets. For instance, you can embed a dialog, and then transform only one of its widgets. diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index a0ecd4c..d9ff655 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -1629,7 +1629,7 @@ QGraphicsSceneMoveEvent::~QGraphicsSceneMoveEvent() } /*! - Returns the old position (i.e., the position immediatly before the widget + Returns the old position (i.e., the position immediately before the widget was moved). \sa newPos(), QGraphicsItem::setPos() diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 4a733be..e48f9a7 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -450,7 +450,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) bottom. Contents margins are used by the assigned layout to define the placement - of subwidgets and layouts. Margins are particularily useful for widgets + of subwidgets and layouts. Margins are particularly useful for widgets that constrain subwidgets to only a section of its own geometry. For example, a group box with a layout will place subwidgets inside its frame, but below the title. diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp index 9aed011..836d7b0 100644 --- a/src/gui/image/qimage_ssse3.cpp +++ b/src/gui/image/qimage_ssse3.cpp @@ -54,7 +54,7 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, con { quint32 *const end = dst + len; - // Prologue, align dst to 16 bytes. The alignement is done on dst because it has 4 store() + // Prologue, align dst to 16 bytes. The alignment is done on dst because it has 4 store() // for each 3 load() of src. const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3; const int prologLength = qMin(len, offsetToAlignOn16Bytes); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 64d8ed2..c5d9a7e 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1102,6 +1102,9 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) return QPixmap(); QPixmap res(r.size()); + if (!qt_widget_private(widget)->isOpaque) + res.fill(Qt::transparent); + widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask, true); return res; diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index b97afd3..453100c 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -766,7 +766,7 @@ static bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb) { XPMRGBData x; x.name = name_no_space; - // Funtion bsearch() is supposed to be + // Function bsearch() is supposed to be // void *bsearch(const void *key, const void *base, ... // So why (char*)? Are there broken bsearch() declarations out there? XPMRGBData *r = (XPMRGBData *)bsearch((char *)&x, (char *)xpmRgbTbl, xpmRgbTblSize, diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 95e92c9..7b81761 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1166,7 +1166,7 @@ QAbstractItemView::EditTriggers QAbstractItemView::editTriggers() const \property QAbstractItemView::verticalScrollMode \brief how the view scrolls its contents in the vertical direction - This property controlls how the view scroll its contents vertically. + This property controls how the view scroll its contents vertically. Scrolling can be done either per pixel or per item. */ @@ -1192,7 +1192,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const \property QAbstractItemView::horizontalScrollMode \brief how the view scrolls its contents in the horizontal direction - This property controlls how the view scroll its contents horizontally. + This property controls how the view scroll its contents horizontally. Scrolling can be done either per pixel or per item. */ @@ -1275,7 +1275,7 @@ bool QAbstractItemView::hasAutoScroll() const \property QAbstractItemView::autoScrollMargin \brief the size of the area when auto scrolling is triggered - This property controlls the size of the area at the edge of the viewport that + This property controls the size of the area at the edge of the viewport that triggers autoscrolling. The default value is 16 pixels. */ void QAbstractItemView::setAutoScrollMargin(int margin) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 4492e53..dc45854 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -114,7 +114,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) } } else if (old_height > span->height()) { //remove the span from all the subspans lists that intersect the columns not covered anymore - Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0 + Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax useful if height is 0 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->top() + old_height -1) { if (-it_y.key() > span->bottom()) { @@ -1411,7 +1411,7 @@ void QTableView::paintEvent(QPaintEvent *event) } if (showGrid) { - // Find the bottom right (the last rows/coloumns might be hidden) + // Find the bottom right (the last rows/columns might be hidden) while (verticalHeader->isSectionHidden(verticalHeader->logicalIndex(bottom))) --bottom; QPen old = painter.pen(); painter.setPen(gridPen); diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 6dd8127..5e9a0cb 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -171,6 +171,10 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ foreach (QGesture *g, gestures) { m_deletedRecognizers.remove(g); m_gestureToRecognizer.remove(g); + m_maybeGestures.remove(g); + m_activeGestures.remove(g); + m_gestureOwners.remove(g); + m_gestureTargets.remove(g); } qDeleteAll(gestures); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 3717ed9..89202ac 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -875,9 +875,10 @@ void QRasterPaintEngine::updateState() if (s->dirty & DirtyTransform) updateMatrix(s->matrix); - if (s->dirty & (DirtyPen|DirtyCompositionMode)) { + if (s->dirty & (DirtyPen|DirtyCompositionMode|DirtyOpacity)) { const QPainter::CompositionMode mode = s->composition_mode; s->flags.fast_text = (s->penData.type == QSpanData::Solid) + && s->intOpacity == 256 && (mode == QPainter::CompositionMode_Source || (mode == QPainter::CompositionMode_SourceOver && qAlpha(s->penData.solid.color) == 255)); @@ -901,6 +902,7 @@ void QRasterPaintEngine::opacityChanged() s->fillFlags |= DirtyOpacity; s->strokeFlags |= DirtyOpacity; s->pixmapFlags |= DirtyOpacity; + s->dirty |= DirtyOpacity; s->intOpacity = (int) (s->opacity * 256); } @@ -3301,7 +3303,7 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) ensureState(); drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, - textItem->fontEngine); + textItem->fontEngine()); } /*! diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 7fed7e4..ab9707d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5746,7 +5746,7 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, const QPointF *posit QStaticTextItem staticTextItem; staticTextItem.color = state->pen.color(); staticTextItem.font = state->font; - staticTextItem.fontEngine = fontEngine; + staticTextItem.setFontEngine(fontEngine); staticTextItem.numGlyphs = glyphCount; staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray)); staticTextItem.glyphPositions = positions.data(); @@ -5938,7 +5938,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText d->extended->drawStaticTextItem(item); drawDecorationForGlyphs(this, item->glyphs, item->glyphPositions, - item->numGlyphs, item->fontEngine, staticText_d->font, + item->numGlyphs, item->fontEngine(), staticText_d->font, QTextCharFormat()); } if (currentColor != oldPen.color()) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 9506006..edf248a 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -445,7 +445,7 @@ namespace { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); QStaticTextItem currentItem; - currentItem.fontEngine = ti.fontEngine; + currentItem.setFontEngine(ti.fontEngine); currentItem.font = ti.font(); currentItem.charOffset = m_chars.size(); currentItem.numChars = ti.num_chars; @@ -713,4 +713,24 @@ void QStaticTextPrivate::init() needsRelayout = false; } +QStaticTextItem::~QStaticTextItem() +{ + if (m_userData != 0 && !m_userData->ref.deref()) + delete m_userData; + if (!m_fontEngine->ref.deref()) + delete m_fontEngine; +} + +void QStaticTextItem::setFontEngine(QFontEngine *fe) +{ + if (m_fontEngine != 0) { + if (!m_fontEngine->ref.deref()) + delete m_fontEngine; + } + + m_fontEngine = fe; + if (m_fontEngine != 0) + m_fontEngine->ref.ref(); +} + QT_END_NAMESPACE diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h index cb60626..87ef0d5 100644 --- a/src/gui/text/qstatictext_p.h +++ b/src/gui/text/qstatictext_p.h @@ -68,27 +68,60 @@ public: OpenGLUserData }; - QStaticTextUserData(Type t) : type(t) {} + QStaticTextUserData(Type t) : type(t) { ref = 0; } virtual ~QStaticTextUserData() {} + QAtomicInt ref; Type type; }; class Q_GUI_EXPORT QStaticTextItem { public: - QStaticTextItem() : chars(0), numChars(0), fontEngine(0), userData(0), - useBackendOptimizations(false), userDataNeedsUpdate(0) {} - ~QStaticTextItem() { delete userData; } + QStaticTextItem() : chars(0), numChars(0), useBackendOptimizations(false), + userDataNeedsUpdate(0), m_fontEngine(0), m_userData(0) {} + + QStaticTextItem(const QStaticTextItem &other) + { + operator=(other); + } + + void operator=(const QStaticTextItem &other) + { + glyphPositions = other.glyphPositions; + glyphs = other.glyphs; + chars = other.chars; + numGlyphs = other.numGlyphs; + numChars = other.numChars; + font = other.font; + color = other.color; + useBackendOptimizations = other.useBackendOptimizations; + userDataNeedsUpdate = other.userDataNeedsUpdate; + + m_fontEngine = 0; + m_userData = 0; + setUserData(other.userData()); + setFontEngine(other.fontEngine()); + } + + ~QStaticTextItem(); void setUserData(QStaticTextUserData *newUserData) { - if (userData == newUserData) + if (m_userData == newUserData) return; - delete userData; - userData = newUserData; + if (m_userData != 0 && !m_userData->ref.deref()) + delete m_userData; + + m_userData = newUserData; + if (m_userData != 0) + m_userData->ref.ref(); } + QStaticTextUserData *userData() const { return m_userData; } + + void setFontEngine(QFontEngine *fe); + QFontEngine *fontEngine() const { return m_fontEngine; } union { QFixedPoint *glyphPositions; // 8 bytes per glyph @@ -108,14 +141,17 @@ public: // 12 bytes for pointers int numGlyphs; // 4 bytes per item int numChars; // 4 bytes per item - QFontEngine *fontEngine; // 4 bytes per item QFont font; // 8 bytes per item QColor color; // 10 bytes per item - QStaticTextUserData *userData; // 8 bytes per item char useBackendOptimizations : 1; // 1 byte per item char userDataNeedsUpdate : 1; // // ================ // 51 bytes per item + +private: // Needs special handling in setters, so private to avoid abuse + QFontEngine *m_fontEngine; // 4 bytes per item + QStaticTextUserData *m_userData; // 8 bytes per item + }; class QStaticText; diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index ae28a26..7b2f9ad 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -42,8 +42,8 @@ mac { wince*:LIBS += -lcoredll } else:symbian { - INCLUDEPATH += /epoc32/include/mmf/common - INCLUDEPATH += /epoc32/include/mmf/server + INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/common + INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/server HEADERS += $$PWD/qaudio_symbian_p.h \ $$PWD/qaudiodeviceinfo_symbian_p.h \ diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index ddafa3d..5265915 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -482,19 +482,18 @@ int QAudioInputPrivate::bytesReady() const qint64 QAudioInputPrivate::read(char* data, qint64 len) { - Q_UNUSED(len) - // Read in some audio data and write it to QIODevice, pull mode if ( !handle ) return 0; - bytesAvailable = checkBytesReady(); + // bytesAvaiable is saved as a side effect of checkBytesReady(). + int bytesToRead = checkBytesReady(); - if (bytesAvailable < 0) { + if (bytesToRead < 0) { // bytesAvailable as negative is error code, try to recover from it. - xrun_recovery(bytesAvailable); - bytesAvailable = checkBytesReady(); - if (bytesAvailable < 0) { + xrun_recovery(bytesToRead); + bytesToRead = checkBytesReady(); + if (bytesToRead < 0) { // recovery failed must stop and set error. close(); errorState = QAudio::IOError; @@ -504,9 +503,11 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) } } + bytesToRead = qMin<qint64>(len, bytesToRead); + bytesToRead -= bytesToRead % period_size; int count=0, err = 0; while(count < 5) { - int chunks = bytesAvailable/period_size; + int chunks = bytesToRead/period_size; int frames = chunks*period_frames; if(frames > (int)buffer_frames) frames = buffer_frames; @@ -554,6 +555,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) emit stateChanged(deviceState); } } else { + bytesAvailable -= err; totalTimeValue += err; resuming = false; if (deviceState != QAudio::ActiveState) { @@ -566,6 +568,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) } else { memcpy(data,audioBuffer,err); + bytesAvailable -= err; totalTimeValue += err; resuming = false; if (deviceState != QAudio::ActiveState) { @@ -661,7 +664,7 @@ bool QAudioInputPrivate::deviceReady() { if(pullMode) { // reads some audio data and writes it to QIODevice - read(0,0); + read(0, buffer_size); } else { // emits readyRead() so user will call read() on QIODevice to get some audio data InputPrivate* a = qobject_cast<InputPrivate*>(audioSource); diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 1cde159..0ec2492 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -400,9 +400,12 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) resuming = false; } } else { + l = qMin<qint64>(len, waveBlocks[header].dwBytesRecorded); // push mode - memcpy(p,waveBlocks[header].lpData,waveBlocks[header].dwBytesRecorded); - l = waveBlocks[header].dwBytesRecorded; + memcpy(p, waveBlocks[header].lpData, l); + + len -= l; + #ifdef DEBUG_AUDIO qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l; #endif @@ -457,7 +460,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) mutex.lock(); if(!pullMode) { - if(l+period_size > len && waveFreeBlockCount == buffer_size/period_size) + if(len < period_size || waveFreeBlockCount == buffer_size/period_size) done = true; } else { if(waveFreeBlockCount == buffer_size/period_size) @@ -568,7 +571,7 @@ bool QAudioInputPrivate::deviceReady() if(pullMode) { // reads some audio data and writes it to QIODevice - read(0,0); + read(0, buffer_size); } else { // emits readyRead() so user will call read() on QIODevice to get some audio data InputPrivate* a = qobject_cast<InputPrivate*>(audioSource); diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 1f304e3..1b054e5 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -586,7 +586,7 @@ bool QAudioOutputPrivate::deviceReady() } } if ( out < l) { - // Didnt write all data + // Didn't write all data audioSource->seek(audioSource->pos()-(l-out)); } if(startup) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 92cf108..536b44a 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -72,7 +72,7 @@ The position shaders for brushes look scary. This is because many of the calculations which logically belong in the fragment shader have been moved into the vertex shader to improve performance. This is why the position - calculation is in a seperate shader. Not only does it calculate the + calculation is in a separate shader. Not only does it calculate the position, but it also calculates some data to be passed to the fragment shader as a varying. It is optimal to move as much of the calculation as possible into the vertex shader as this is executed less often. diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 84c7fed..1dcb773 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1350,8 +1350,8 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) ensureActive(); - QFontEngineGlyphCache::Type glyphType = textItem->fontEngine->glyphFormat >= 0 - ? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat) + QFontEngineGlyphCache::Type glyphType = textItem->fontEngine()->glyphFormat >= 0 + ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) : d->glyphCacheType; if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate @@ -1430,7 +1430,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem { QStaticTextItem staticTextItem; staticTextItem.chars = const_cast<QChar *>(ti.chars); - staticTextItem.fontEngine = ti.fontEngine; + staticTextItem.setFontEngine(ti.fontEngine); staticTextItem.glyphs = glyphs.data(); staticTextItem.numChars = ti.num_chars; staticTextItem.numGlyphs = glyphs.size(); @@ -1475,18 +1475,18 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp QOpenGL2PaintEngineState *s = q->state(); QGLTextureGlyphCache *cache = - (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType, QTransform()); + (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(ctx, glyphType, QTransform()); if (!cache || cache->cacheType() != glyphType) { cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); - staticTextItem->fontEngine->setGlyphCache(ctx, cache); + staticTextItem->fontEngine()->setGlyphCache(ctx, cache); } bool recreateVertexArrays = false; if (staticTextItem->userDataNeedsUpdate) recreateVertexArrays = true; - else if (staticTextItem->userData == 0) + else if (staticTextItem->userData() == 0) recreateVertexArrays = true; - else if (staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData) + else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) recreateVertexArrays = true; // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays. @@ -1494,8 +1494,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp // cache so this text is performed before we test if the cache size has changed. if (recreateVertexArrays) { cache->setPaintEnginePrivate(this); - cache->populate(staticTextItem->fontEngine, staticTextItem->numGlyphs, staticTextItem->glyphs, - staticTextItem->glyphPositions); + cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs, + staticTextItem->glyphs, staticTextItem->glyphPositions); } if (cache->width() == 0 || cache->height() == 0) @@ -1515,14 +1515,14 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp if (staticTextItem->useBackendOptimizations) { QOpenGLStaticTextUserData *userData = 0; - if (staticTextItem->userData == 0 - || staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData) { + if (staticTextItem->userData() == 0 + || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { userData = new QOpenGLStaticTextUserData(); staticTextItem->setUserData(userData); } else { - userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData); + userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData()); } // Use cache if backend optimizations is turned on diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index dbd295f..ed9753e 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -127,7 +127,12 @@ Q_GLOBAL_STATIC(QGLDefaultOverlayFormat, defaultOverlayFormatInstance) Q_GLOBAL_STATIC(QGLSignalProxy, theSignalProxy) QGLSignalProxy *QGLSignalProxy::instance() { - return theSignalProxy(); + QGLSignalProxy *proxy = theSignalProxy(); + if (proxy && proxy->thread() != qApp->thread()) { + if (proxy->thread() == QThread::currentThread()) + proxy->moveToThread(qApp->thread()); + } + return proxy; } @@ -1637,12 +1642,23 @@ const QGLContext *qt_gl_transfer_context(const QGLContext *ctx) return 0; } +QGLContextPrivate::QGLContextPrivate(QGLContext *context) + : internal_context(false) + , q_ptr(context) +{ + group = new QGLContextGroup(context); + texture_destroyer = new QGLTextureDestroyer; + texture_destroyer->moveToThread(qApp->thread()); +} + QGLContextPrivate::~QGLContextPrivate() { if (!group->m_refs.deref()) { Q_ASSERT(group->context() == q_ptr); delete group; } + + delete texture_destroyer; } void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index f85cad5..9ae619d 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -428,6 +428,7 @@ private: friend class QGLSharedResourceGuard; friend class QGLPixmapBlurFilter; friend class QGLExtensions; + friend class QGLTexture; friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); #ifdef Q_WS_MAC public: diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 27f7ad9..8902099 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -88,7 +88,7 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that // if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will - // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well. + // probably get a 32-bit config, even when there's an RGB565 config available. Oh well. // Now normalize the values so -1 becomes 0 redSize = redSize > 0 ? redSize : 0; diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index f86c77f..4742bdb 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -317,6 +317,7 @@ private: }; class QGLTexture; +class QGLTextureDestroyer; // This probably needs to grow to GL_MAX_VERTEX_ATTRIBS, but 3 is ok for now as that's // all the GL2 engine uses: @@ -326,7 +327,7 @@ class QGLContextPrivate { Q_DECLARE_PUBLIC(QGLContext) public: - explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {group = new QGLContextGroup(context);} + explicit QGLContextPrivate(QGLContext *context); ~QGLContextPrivate(); QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options); @@ -417,6 +418,7 @@ public: GLuint current_fbo; GLuint default_fbo; QPaintEngine *active_engine; + QGLTextureDestroyer *texture_destroyer; bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT]; @@ -434,20 +436,6 @@ public: static void setCurrentContext(QGLContext *context); }; -// ### make QGLContext a QObject in 5.0 and remove the proxy stuff -class Q_OPENGL_EXPORT QGLSignalProxy : public QObject -{ - Q_OBJECT -public: - QGLSignalProxy() : QObject() {} - void emitAboutToDestroyContext(const QGLContext *context) { - emit aboutToDestroyContext(context); - } - static QGLSignalProxy *instance(); -Q_SIGNALS: - void aboutToDestroyContext(const QGLContext *context); -}; - Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions) // Temporarily make a context current if not already current or @@ -490,6 +478,56 @@ private: QGLContext *m_ctx; }; +class QGLTextureDestroyer : public QObject +{ + Q_OBJECT +public: + QGLTextureDestroyer() : QObject() { + qRegisterMetaType<GLuint>("GLuint"); + connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)), + this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, GLuint))); + } + void emitFreeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + emit freeTexture(context, boundPixmap, id); + } + +Q_SIGNALS: + void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id); + +private slots: + void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { +#if defined(Q_WS_X11) + if (boundPixmap) { + QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext()); + context->makeCurrent(); + // Although glXReleaseTexImage is a glX call, it must be called while there + // is a current context - the context the pixmap was bound to a texture in. + // Otherwise the release doesn't do anything and you get BadDrawable errors + // when you come to delete the context. + QGLContextPrivate::unbindPixmapFromTexture(boundPixmap); + glDeleteTextures(1, &id); + oldContext->makeCurrent(); + return; + } +#endif + QGLShareContextScope scope(context); + glDeleteTextures(1, &id); + } +}; + +// ### make QGLContext a QObject in 5.0 and remove the proxy stuff +class Q_OPENGL_EXPORT QGLSignalProxy : public QObject +{ + Q_OBJECT +public: + void emitAboutToDestroyContext(const QGLContext *context) { + emit aboutToDestroyContext(context); + } + static QGLSignalProxy *instance(); +Q_SIGNALS: + void aboutToDestroyContext(const QGLContext *context); +}; + class QGLTexture { public: QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D, @@ -506,16 +544,10 @@ public: ~QGLTexture() { if (options & QGLContext::MemoryManagedBindOption) { Q_ASSERT(context); - QGLShareContextScope scope(context); -#if defined(Q_WS_X11) - // Although glXReleaseTexImage is a glX call, it must be called while there - // is a current context - the context the pixmap was bound to a texture in. - // Otherwise the release doesn't do anything and you get BadDrawable errors - // when you come to delete the context. - if (boundPixmap) - QGLContextPrivate::unbindPixmapFromTexture(boundPixmap); +#if !defined(Q_WS_X11) + QPixmapData *boundPixmap = 0; #endif - glDeleteTextures(1, &id); + context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id); } } diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 9d28de0..d33ea56 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -377,7 +377,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons checkedForEglImageTFP = true; // We need to be able to create an EGLImage from a native pixmap, which was split - // into a seperate EGL extension, EGL_KHR_image_pixmap. It is possible to have + // into a separate EGL extension, EGL_KHR_image_pixmap. It is possible to have // eglCreateImageKHR & eglDestroyImageKHR without support for pixmaps, so we must // check we have the EGLImage from pixmap functionality. if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) { diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 74b6b9a..a04d930 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4918,7 +4918,7 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) d->flushDrawQueue(); // make sure the glyphs we want to draw are in the cache - qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine, textItem->glyphs, + qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine(), textItem->glyphs, textItem->numGlyphs); d->setGradientOps(Qt::SolidPattern, QRectF()); // turns off gradient ops @@ -4941,13 +4941,13 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - bool antialias = !(textItem->fontEngine->fontDef.styleStrategy & QFont::NoAntialias) + bool antialias = !(textItem->fontEngine()->fontDef.styleStrategy & QFont::NoAntialias) && (d->matrix.type() > QTransform::TxTranslate); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST); for (int i=0; i< textItem->numGlyphs; ++i) { - QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine, textItem->glyphs[i]); + QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine(), textItem->glyphs[i]); // we don't cache glyphs with no width/height if (!g) @@ -5003,7 +5003,7 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte { QStaticTextItem staticTextItem; staticTextItem.chars = const_cast<QChar *>(ti.chars); - staticTextItem.fontEngine = ti.fontEngine; + staticTextItem.setFontEngine(ti.fontEngine); staticTextItem.glyphs = glyphs.data(); staticTextItem.numChars = ti.num_chars; staticTextItem.numGlyphs = glyphs.size(); diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index 2c11a0b..5cbc836 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -93,7 +93,7 @@ public: if (rgbConfig == argbConfig) argbContext = rgbContext; - // Otherwise, create a seperate context to be used for ARGB pixmaps: + // Otherwise, create a separate context to be used for ARGB pixmaps: if (!argbContext) { argbContext = new QEglContext; argbContext->setConfig(argbConfig); @@ -314,7 +314,7 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const Q_ASSERT(ctx->d_func()->eglContext == 0); ctx->d_func()->eglContext = hasAlphaChannel() ? sharedContexts()->argbContext : sharedContexts()->rgbContext; - // While we use a seperate QGLContext for each pixmap, the underlying QEglContext is + // While we use a separate QGLContext for each pixmap, the underlying QEglContext is // the same. So we must use a "fake" QGLContext and fool the texture cache into thinking // each pixmap's QGLContext is sharing with this central one. The only place this is // going to fail is where we the underlying EGL RGB and ARGB contexts aren't sharing. diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index ee65e48..aea203f 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3475,7 +3475,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) { - drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->font, textItem->fontEngine, + drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->font, textItem->fontEngine(), QPointF(0, 0), textItem->glyphPositions); } diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 85723ce..c5a39e1 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -1078,7 +1078,7 @@ void QNetworkSessionPrivateImpl::RunL() TInt error = KErrNone; QNetworkConfiguration newActiveConfig = activeConfiguration(); if (!newActiveConfig.isValid()) { - // RConnection startup was successfull but no configuration + // RConnection startup was successful but no configuration // was found. That indicates that user has chosen to create a // new WLAN configuration (from scan results), but that new // configuration does not have access to Internet (Internet diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp index b50826c..1a2e3fa 100644 --- a/src/plugins/graphicssystems/meego/dithering.cpp +++ b/src/plugins/graphicssystems/meego/dithering.cpp @@ -68,7 +68,7 @@ // Writes(ads) a new value to the diffusion accumulator. accumulator is a short. // x, y is a position in the accumulation buffer. y can be 0 or 1 -- we operate on two lines at time. -#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x > 0) accumulator[(y * width) + x] += v +#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x >= 0) accumulator[(y * width) + x] += v // Clamps a value to be in 0..255 range. #define CLAMP_256(v) if (v > 255) v = 255; if (v < 0) v = 0; @@ -76,8 +76,13 @@ // Converts incoming RGB32 (QImage::Format_RGB32) to RGB565. Returns the newly allocated data. unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride) { + // Output line stride. Aligned to 4 bytes. + int alignedWidth = width; + if (alignedWidth % 2 > 0) + alignedWidth++; + // Will store output - unsigned short *out = (unsigned short *) malloc(width * height * 2); + unsigned short *out = (unsigned short *) malloc(alignedWidth * height * 2); // Lookup tables for the 8bit => 6bit and 8bit => 5bit conversion unsigned char lookup_8bit_to_5bit[256]; @@ -105,18 +110,18 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // Produce the conversion lookup tables. for (i = 0; i < 256; i++) { lookup_8bit_to_5bit[i] = round(i / 8.0); - if (lookup_8bit_to_5bit[i] > 31) - lookup_8bit_to_5bit[i] -= 1; // Before bitshifts: (i * 8) - (... * 8 * 8) lookup_8bit_to_5bit_diff[i] = (i << 3) - (lookup_8bit_to_5bit[i] << 6); + if (lookup_8bit_to_5bit[i] > 31) + lookup_8bit_to_5bit[i] -= 1; lookup_8bit_to_6bit[i] = round(i / 4.0); - if (lookup_8bit_to_6bit[i] > 63) - lookup_8bit_to_6bit[i] -= 1; // Before bitshifts: (i * 8) - (... * 4 * 8) lookup_8bit_to_6bit_diff[i] = (i << 3) - (lookup_8bit_to_6bit[i] << 5); + if (lookup_8bit_to_6bit[i] > 63) + lookup_8bit_to_6bit[i] -= 1; } // Clear the accumulators @@ -174,7 +179,7 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h } // Write the newly produced pixel - PUT_565(out, x, y, width, component[2], component[1], component[0]); + PUT_565(out, x, y, alignedWidth, component[2], component[1], component[0]); } } @@ -183,10 +188,16 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // Converts incoming RGBA32 (QImage::Format_ARGB32_Premultiplied) to RGB565. Returns the newly allocated data. // This function is similar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity. +// The output has each scan line aligned to 4 bytes (as expected by GL by default). unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride) { + // Output line stride. Aligned to 4 bytes. + int alignedWidth = width; + if (alignedWidth % 2 > 0) + alignedWidth++; + // Will store output - unsigned short *out = (unsigned short *) malloc(width * height * 2); + unsigned short *out = (unsigned short *) malloc(alignedWidth * 2 * height); // Lookup tables for the 8bit => 4bit conversion unsigned char lookup_8bit_to_4bit[256]; @@ -210,11 +221,11 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in // Produce the conversion lookup tables. for (i = 0; i < 256; i++) { lookup_8bit_to_4bit[i] = round(i / 16.0); - if (lookup_8bit_to_4bit[i] > 15) - lookup_8bit_to_4bit[i] -= 1; - // Before bitshifts: (i * 8) - (... * 16 * 8) lookup_8bit_to_4bit_diff[i] = (i << 3) - (lookup_8bit_to_4bit[i] << 7); + + if (lookup_8bit_to_4bit[i] > 15) + lookup_8bit_to_4bit[i] = 15; } // Clear the accumulators @@ -269,7 +280,25 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in } // Write the newly produced pixel - PUT_4444(out, x, y, width, component[0], component[1], component[2], component[3]); + PUT_4444(out, x, y, alignedWidth, component[0], component[1], component[2], component[3]); + } + } + + return out; +} + +unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride) +{ + unsigned char *out = (unsigned char *) malloc(stride * height); + + // For each line... + for (int y = 0; y < height; y++) { + // For each column + for (int x = 0; x < width; x++) { + out[(stride * y) + (x * 4) + 0] = in[(stride * y) + (x * 4) + 2]; + out[(stride * y) + (x * 4) + 1] = in[(stride * y) + (x * 4) + 1]; + out[(stride * y) + (x * 4) + 2] = in[(stride * y) + (x * 4) + 0]; + out[(stride * y) + (x * 4) + 3] = in[(stride * y) + (x * 4) + 3]; } } diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index a633e2f..67d760c 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -83,7 +83,7 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { // Long story short: without this it's possible to hit an - // unitialized paintDevice due to a Qt bug too complex to even + // 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()); @@ -301,4 +301,4 @@ bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image) Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap) { return QMeeGoGraphicsSystem::getLiveTextureHandle(pixmap); -}
\ No newline at end of file +} diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp index 02a4273..eb63692 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp @@ -51,6 +51,7 @@ // from dithering.cpp extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride); extern unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride); +extern unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride); static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; @@ -146,8 +147,8 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()) { - void *converted = convertARGB32_to_RGBA4444(image.bits(), image.width(), image.height(), image.bytesPerLine()); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, converted); + void *converted = convertBGRA32_to_RGBA32(image.bits(), image.width(), image.height(), image.bytesPerLine()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, converted); free(converted); } else { void *converted = convertRGB32_to_RGB565(image.bits(), image.width(), image.height(), image.bytesPerLine()); diff --git a/src/qt3support/canvas/q3canvas.cpp b/src/qt3support/canvas/q3canvas.cpp index 959c435..1b4706d 100644 --- a/src/qt3support/canvas/q3canvas.cpp +++ b/src/qt3support/canvas/q3canvas.cpp @@ -1030,7 +1030,7 @@ void Q3Canvas::setUpdatePeriod(int ms) The advance takes place in two phases. In phase 0, the Q3CanvasItem::advance() function of each Q3CanvasItem::animated() - canvas item is called with paramater 0. Then all these canvas + canvas item is called with parameter 0. Then all these canvas items are called again, with parameter 1. In phase 0, the canvas items should not change position, merely examine other items on the canvas for which special processing is required, such as diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index d82d0f0..e24eeb5 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -2914,7 +2914,7 @@ QString Q3TextDocument::selectedText(int id, bool asRichText) const } } // ### workaround for plain text export until we get proper - // mime types: turn unicode line seperators into the more + // mime types: turn unicode line separators into the more // widely understood \n. Makes copy and pasting code snipplets // from within Assistent possible QChar* uc = (QChar*) s.unicode(); diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index db4012c..9e88df7 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1838,5 +1838,6 @@ EXPORTS ?addChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1837 NONAME ABSENT ; void QDeclarativeBasePositioner::addChanged(void) ?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1838 NONAME ABSENT ; void QDeclarativeAbstractAnimation::start(void) ?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1839 NONAME ABSENT ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *) - ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1840 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *) + ?enableDebugging@QDeclarativeDebugHelper@@SAXXZ @ 1840 NONAME ; void QDeclarativeDebugHelper::enableDebugging(void) + ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1841 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *) diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index a67725e..87b9c7f 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -175,4 +175,5 @@ EXPORTS ?createPixmapForImage@QVGPixmapData@@IAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 174 NONAME ; void QVGPixmapData::createPixmapForImage(class QImage &, class QFlags<enum Qt::ImageConversionFlag>, bool) ?fromData@QVGPixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 175 NONAME ; bool QVGPixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags<enum Qt::ImageConversionFlag>) ?fromImageReader@QVGPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 176 NONAME ; void QVGPixmapData::fromImageReader(class QImageReader *, class QFlags<enum Qt::ImageConversionFlag>) + ?canVgWritePixels@QVGPaintEngine@@ABE_NABVQImage@@@Z @ 177 NONAME ; bool QVGPaintEngine::canVgWritePixels(class QImage const &) const diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 849ca6a..1f69061 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1883,5 +1883,6 @@ EXPORTS _ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1882 NONAME ABSENT _ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1883 NONAME ABSENT _ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1884 NONAME ABSENT - _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1885 NONAME ABSENT + _ZN23QDeclarativeDebugHelper15enableDebuggingEv @ 1885 NONAME + _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1886 NONAME ABSENT diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index f772bcc..75bb026 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12101,4 +12101,7 @@ EXPORTS _ZN19QApplicationPrivate25qmljsDebugArgumentsStringEv @ 12100 NONAME _ZNK5QFont14lastResortFontEv @ 12101 NONAME _ZN11QFontEngine33convertToPostscriptFontFamilyNameERK10QByteArray @ 12102 NONAME + _ZN15QStaticTextItem13setFontEngineEP11QFontEngine @ 12103 NONAME + _ZN15QStaticTextItemD1Ev @ 12104 NONAME + _ZN15QStaticTextItemD2Ev @ 12105 NONAME diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index 99942b8..e1828c1 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -205,4 +205,5 @@ EXPORTS _ZN13QVGPixmapData20createPixmapForImageER6QImage6QFlagsIN2Qt19ImageConversionFlagEEb @ 204 NONAME _ZN13QVGPixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 205 NONAME _ZN13QVGPixmapData8fromFileERK7QStringPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 206 NONAME + _ZNK14QVGPaintEngine16canVgWritePixelsERK6QImage @ 207 NONAME diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp index 551f6c3..9362639 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent.cpp +++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp @@ -116,7 +116,7 @@ QScriptDebuggerAgent::~QScriptDebuggerAgent() /*! Instructs the agent to perform a "step into" operation. This function returns immediately. The agent will report step completion - at a later time, i.e. when script statements are evaluted. + at a later time, i.e. when script statements are evaluated. */ void QScriptDebuggerAgent::enterStepIntoMode(int count) { @@ -129,7 +129,7 @@ void QScriptDebuggerAgent::enterStepIntoMode(int count) /*! Instructs the agent to perform a "step over" operation. This function returns immediately. The agent will report step completion - at a later time, i.e. when script statements are evaluted. + at a later time, i.e. when script statements are evaluated. */ void QScriptDebuggerAgent::enterStepOverMode(int count) { @@ -146,7 +146,7 @@ void QScriptDebuggerAgent::enterStepOverMode(int count) /*! Instructs the agent to perform a "step out" operation. This function returns immediately. The agent will report step completion - at a later time, i.e. when script statements are evaluted. + at a later time, i.e. when script statements are evaluated. */ void QScriptDebuggerAgent::enterStepOutMode() { diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index e11cf75..1bf59bf 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -93,11 +93,13 @@ enum { QOCIEncoding = 2002 }; // AL16UTF16LE enum { QOCIEncoding = 2000 }; // AL16UTF16 #endif +#ifdef OCI_ATTR_CHARSET_FORM // Always set the OCI_ATTR_CHARSET_FORM to SQLCS_NCHAR is safe // because Oracle server will deal with the implicit Conversion // Between CHAR and NCHAR. // see: http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a89857/oci05bnd.htm#422705 static const ub1 qOraCharsetForm = SQLCS_NCHAR; +#endif #if defined (OCI_UTF16ID) static const ub2 qOraCharset = OCI_UTF16ID; @@ -110,13 +112,23 @@ typedef QVarLengthArray<ub2, 32> SizeArray; static QByteArray qMakeOraDate(const QDateTime& dt); static QDateTime qMakeDate(const char* oraDate); + +static QByteArray qMakeOCINumber(const qlonglong &ll, OCIError *err); +static QByteArray qMakeOCINumber(const qulonglong& ull, OCIError* err); + +static qlonglong qMakeLongLong(const char* ociNumber, OCIError* err); +static qulonglong qMakeULongLong(const char* ociNumber, OCIError* err); + static QString qOraWarn(OCIError *err, int *errorCode = 0); + #ifndef Q_CC_SUN static // for some reason, Sun CC can't use qOraWarning when it's declared static #endif void qOraWarning(const char* msg, OCIError *err); static QSqlError qMakeError(const QString& errString, QSqlError::ErrorType type, OCIError *err); + + class QOCIRowId: public QSharedData { public: @@ -164,7 +176,6 @@ struct QOCIResultPrivate int serverVersion; int prefetchRows, prefetchMem; - void setCharset(OCIBind* hbnd); void setStatementAttributes(); int bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos, const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList<QByteArray> &tmpStorage); @@ -176,6 +187,41 @@ struct QOCIResultPrivate { return q->bindValueType(i) & QSql::Out; } inline bool isBinaryValue(int i) const { return q->bindValueType(i) & QSql::Binary; } + + void setCharset(dvoid* handle, ub4 type) const + { + int r = 0; + Q_ASSERT(handle); + +#ifdef OCI_ATTR_CHARSET_FORM + r = OCIAttrSet(handle, + type, + // this const cast is safe since OCI doesn't touch + // the charset. + const_cast<void *>(static_cast<const void *>(&qOraCharsetForm)), + 0, + OCI_ATTR_CHARSET_FORM, + //Strange Oracle bug: some Oracle servers crash the server process with non-zero error handle (mostly for 10g). + //So ignore the error message here. + 0); + #ifdef QOCI_DEBUG + if (r != 0) + qWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_FORM."); + #endif +#endif + + r = OCIAttrSet(handle, + type, + // this const cast is safe since OCI doesn't touch + // the charset. + const_cast<void *>(static_cast<const void *>(&qOraCharset)), + 0, + OCI_ATTR_CHARSET_ID, + err); + if (r != 0) + qOraWarning("QOCIResultPrivate::setCharsetI Couldn't set OCI_ATTR_CHARSET_ID: ", err); + + } }; void QOCIResultPrivate::setStatementAttributes() @@ -208,36 +254,6 @@ void QOCIResultPrivate::setStatementAttributes() } } -void QOCIResultPrivate::setCharset(OCIBind* hbnd) -{ - int r = 0; - - Q_ASSERT(hbnd); - - r = OCIAttrSet(hbnd, - OCI_HTYPE_BIND, - // this const cast is safe since OCI doesn't touch - // the charset. - const_cast<void *>(static_cast<const void *>(&qOraCharsetForm)), - 0, - OCI_ATTR_CHARSET_FORM, - err); - if (r != 0) - qOraWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_FORM: ", err); - - r = OCIAttrSet(hbnd, - OCI_HTYPE_BIND, - // this const cast is safe since OCI doesn't touch - // the charset. - const_cast<void *>(static_cast<const void *>(&qOraCharset)), - 0, - OCI_ATTR_CHARSET_ID, - err); - if (r != 0) - qOraWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_ID: ", err); - -} - int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos, const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList<QByteArray> &tmpStorage) { @@ -283,6 +299,28 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in sizeof(uint), SQLT_UIN, indPtr, 0, 0, 0, 0, OCI_DEFAULT); break; + case QVariant::LongLong: + { + QByteArray ba = qMakeOCINumber(val.toLongLong(), err); + r = OCIBindByPos(sql, hbnd, err, + pos + 1, + ba.data(), + ba.size(), + SQLT_VNU, indPtr, 0, 0, 0, 0, OCI_DEFAULT); + tmpStorage.append(ba); + break; + } + case QVariant::ULongLong: + { + QByteArray ba = qMakeOCINumber(val.toULongLong(), err); + r = OCIBindByPos(sql, hbnd, err, + pos + 1, + ba.data(), + ba.size(), + SQLT_VNU, indPtr, 0, 0, 0, 0, OCI_DEFAULT); + tmpStorage.append(ba); + break; + } case QVariant::Double: r = OCIBindByPos(sql, hbnd, err, pos + 1, @@ -325,7 +363,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in (s.length() + 1) * sizeof(QChar), SQLT_STR, indPtr, 0, 0, 0, 0, OCI_DEFAULT); if (r == OCI_SUCCESS) - setCharset(*hbnd); + setCharset(*hbnd, OCI_HTYPE_BIND); break; } } // fall through for OUT values @@ -349,7 +387,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in SQLT_STR, indPtr, 0, 0, 0, 0, OCI_DEFAULT); } if (r == OCI_SUCCESS) - setCharset(*hbnd); + setCharset(*hbnd, OCI_HTYPE_BIND); tmpStorage.append(ba); break; } // default case @@ -378,7 +416,7 @@ int QOCIResultPrivate::bindValues(QVector<QVariant> &values, IndicatorArray &ind } // will assign out value and remove its temp storage. -static void qOraOutValue(QVariant &value, QList<QByteArray> &storage) +static void qOraOutValue(QVariant &value, QList<QByteArray> &storage, OCIError* err) { switch (value.type()) { case QVariant::Time: @@ -390,6 +428,12 @@ static void qOraOutValue(QVariant &value, QList<QByteArray> &storage) case QVariant::DateTime: value = qMakeDate(storage.takeFirst()); break; + case QVariant::LongLong: + value = qMakeLongLong(storage.takeFirst(), err); + break; + case QVariant::ULongLong: + value = qMakeULongLong(storage.takeFirst(), err); + break; case QVariant::String: value = QString( reinterpret_cast<const QChar *>(storage.takeFirst().constData())); @@ -407,7 +451,7 @@ void QOCIResultPrivate::outValues(QVector<QVariant> &values, IndicatorArray &ind if (!isOutValue(i)) continue; - qOraOutValue(values[i], tmpStorage); + qOraOutValue(values[i], tmpStorage, err); QVariant::Type typ = values.at(i).type(); if (indicators[i] == -1) // NULL @@ -667,6 +711,56 @@ QByteArray qMakeOraDate(const QDateTime& dt) return ba; } +/*! + \internal + + Convert qlonglong to the internal Oracle OCINumber format. + */ +QByteArray qMakeOCINumber(const qlonglong& ll, OCIError* err) +{ + QByteArray ba(sizeof(OCINumber), 0); + + OCINumberFromInt(err, + &ll, + sizeof(qlonglong), + OCI_NUMBER_SIGNED, + reinterpret_cast<OCINumber*>(ba.data())); + return ba; +} + +/*! + \internal + + Convert qulonglong to the internal Oracle OCINumber format. + */ +QByteArray qMakeOCINumber(const qulonglong& ull, OCIError* err) +{ + QByteArray ba(sizeof(OCINumber), 0); + + OCINumberFromInt(err, + &ull, + sizeof(qlonglong), + OCI_NUMBER_UNSIGNED, + reinterpret_cast<OCINumber*>(ba.data())); + return ba; +} + +qlonglong qMakeLongLong(const char* ociNumber, OCIError* err) +{ + qlonglong qll = 0; + OCINumberToInt(err, reinterpret_cast<const OCINumber *>(ociNumber), sizeof(qlonglong), + OCI_NUMBER_SIGNED, &qll); + return qll; +} + +qulonglong qMakeULongLong(const char* ociNumber, OCIError* err) +{ + qulonglong qull = 0; + OCINumberToInt(err, reinterpret_cast<const OCINumber *>(ociNumber), sizeof(qulonglong), + OCI_NUMBER_UNSIGNED, &qull); + return qull; +} + QDateTime qMakeDate(const char* oraDate) { int century = uchar(oraDate[0]); @@ -688,7 +782,6 @@ class QOCICols public: QOCICols(int size, QOCIResultPrivate* dp); ~QOCICols(); - void setCharset(OCIDefine* dfn); int readPiecewise(QVector<QVariant> &values, int index = 0); int readLOBs(QVector<QVariant> &values, int index = 0); int fieldFromDefine(OCIDefine* d); @@ -890,7 +983,7 @@ QOCICols::QOCICols(int size, QOCIResultPrivate* dp) &(fieldInf[idx].ind), 0, 0, OCI_DEFAULT); if (r == 0) - setCharset(dfn); + d->setCharset(dfn, OCI_HTYPE_DEFINE); } break; default: @@ -950,35 +1043,6 @@ OCILobLocator **QOCICols::createLobLocator(int position, OCIEnv* env) return &lob; } -void QOCICols::setCharset(OCIDefine* dfn) -{ - int r = 0; - - Q_ASSERT(dfn); - - r = OCIAttrSet(dfn, - OCI_HTYPE_DEFINE, - // this const cast is safe since OCI doesn't touch - // the charset. - const_cast<void *>(static_cast<const void *>(&qOraCharsetForm)), - 0, - OCI_ATTR_CHARSET_FORM, - d->err); - if (r != 0) - qOraWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_FORM: ", d->err); - - r = OCIAttrSet(dfn, - OCI_HTYPE_DEFINE, - // this const cast is safe since OCI doesn't touch - // the charset. - const_cast<void *>(static_cast<const void *>(&qOraCharset)), - 0, - OCI_ATTR_CHARSET_ID, - d->err); - if (r != 0) - qOraWarning("QOCICols::setCharset: Couldn't set OCI_ATTR_CHARSET_ID: ", d->err); -} - int QOCICols::readPiecewise(QVector<QVariant> &values, int index) { OCIDefine* dfn; @@ -1281,6 +1345,16 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b col.maxLen = sizeof(uint); break; + case QVariant::LongLong: + col.bindAs = SQLT_VNU; + col.maxLen = sizeof(OCINumber); + break; + + case QVariant::ULongLong: + col.bindAs = SQLT_VNU; + col.maxLen = sizeof(OCINumber); + break; + case QVariant::Double: col.bindAs = SQLT_FLT; col.maxLen = sizeof(double); @@ -1352,6 +1426,22 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b *reinterpret_cast<uint*>(dataPtr) = val.toUInt(); break; + case QVariant::LongLong: + { + columns[i].lengths[row] = columns[i].maxLen; + const QByteArray ba = qMakeOCINumber(val.toLongLong(), d->err); + Q_ASSERT(ba.size() == int(columns[i].maxLen)); + memcpy(dataPtr, ba.constData(), columns[i].maxLen); + break; + } + case QVariant::ULongLong: + { + columns[i].lengths[row] = columns[i].maxLen; + const QByteArray ba = qMakeOCINumber(val.toULongLong(), d->err); + Q_ASSERT(ba.size() == int(columns[i].maxLen)); + memcpy(dataPtr, ba.constData(), columns[i].maxLen); + break; + } case QVariant::Double: columns[i].lengths[row] = columns[i].maxLen; *reinterpret_cast<double*>(dataPtr) = val.toDouble(); @@ -1459,7 +1549,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b QVariant::Type tp = boundValues.at(i).type(); if (tp != QVariant::List) { - qOraOutValue(boundValues[i], tmpStorage); + qOraOutValue(boundValues[i], tmpStorage, d->err); if (*columns[i].indicators == -1) boundValues[i] = QVariant(tp); continue; @@ -1489,6 +1579,21 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b (*list)[r] = *reinterpret_cast<uint*>(data + r * columns[i].maxLen); break; + case SQLT_VNU: + { + switch (boundValues.at(i).type()) { + case QVariant::LongLong: + (*list)[r] = qMakeLongLong(data + r * columns[i].maxLen, d->err); + break; + case QVariant::ULongLong: + (*list)[r] = qMakeULongLong(data + r * columns[i].maxLen, d->err); + break; + default: + break; + } + break; + } + case SQLT_FLT: (*list)[r] = *reinterpret_cast<double*>(data + r * columns[i].maxLen); break; diff --git a/src/xmlpatterns/data/qabstractfloat.cpp b/src/xmlpatterns/data/qabstractfloat.cpp index d3384fe..9f0e4e0 100644 --- a/src/xmlpatterns/data/qabstractfloat.cpp +++ b/src/xmlpatterns/data/qabstractfloat.cpp @@ -118,7 +118,7 @@ bool AbstractFloat<isDouble>::isEqual(const xsDouble a, const xsDouble b) return qIsInf(a) && internalSignbit(a) == internalSignbit(b); else { - /* Preferrably, we would use std::numeric_limits<xsDouble>::espilon(), but + /* Preferably, we would use std::numeric_limits<xsDouble>::espilon(), but * we cannot since we cannot depend on the STL. The small xs:double value below, * was extracted by printing the std::numeric_limits<xsDouble>::epsilon() using * gdb. */ diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp index c4f3578..ecc78bf 100644 --- a/src/xmlpatterns/data/qatomicvalue.cpp +++ b/src/xmlpatterns/data/qatomicvalue.cpp @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE /** * @file - * @short Contains the implementation for AtomicValue. The defintion is in qitem_p.h. + * @short Contains the implementation for AtomicValue. The definition is in qitem_p.h. */ using namespace QPatternist; diff --git a/src/xmlpatterns/data/qschematime_p.h b/src/xmlpatterns/data/qschematime_p.h index bd63714..bff065b 100644 --- a/src/xmlpatterns/data/qschematime_p.h +++ b/src/xmlpatterns/data/qschematime_p.h @@ -63,7 +63,7 @@ namespace QPatternist /** * @short Implements the value instance of the @c xs:time type. * - * The header file for this class was orignally called Time.h, but this + * The header file for this class was originally called Time.h, but this * clashed with a system header on MinGW. * * @author Frans Englich <frans.englich@nokia.com> diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index fd0b95c..585cf12 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -914,7 +914,7 @@ void XsdSchemaParser::parseRedefine() redefinedType->setWxsSuperType(contextType); // 3) remove the base type resolving job from the resolver as - // we have set the base type here explicitely + // we have set the base type here explicitly m_parserContext->resolver()->removeSimpleRestrictionBase(redefinedType); // 4) add the redefined type to the schema @@ -963,7 +963,7 @@ void XsdSchemaParser::parseRedefine() redefinedType->setWxsSuperType(contextType); // 3) remove the base type resolving job from the resolver as - // we have set the base type here explicitely + // we have set the base type here explicitly m_parserContext->resolver()->removeComplexBaseType(redefinedType); // 4) add the redefined type to the schema @@ -5781,7 +5781,7 @@ QString XsdSchemaParser::readNamespaceAttribute(const QString &attributeName, co SchemaType::DerivationConstraints XsdSchemaParser::readDerivationConstraintAttribute(const SchemaType::DerivationConstraints &allowedConstraints, const char *elementName) { - // first convert the flags into strings for easier comparision + // first convert the flags into strings for easier comparison QSet<QString> allowedContent; if (allowedConstraints & SchemaType::RestrictionConstraint) allowedContent.insert(QString::fromLatin1("restriction")); @@ -5844,7 +5844,7 @@ SchemaType::DerivationConstraints XsdSchemaParser::readDerivationConstraintAttri NamedSchemaComponent::BlockingConstraints XsdSchemaParser::readBlockingConstraintAttribute(const NamedSchemaComponent::BlockingConstraints &allowedConstraints, const char *elementName) { - // first convert the flags into strings for easier comparision + // first convert the flags into strings for easier comparison QSet<QString> allowedContent; if (allowedConstraints & NamedSchemaComponent::RestrictionConstraint) allowedContent.insert(QString::fromLatin1("restriction")); diff --git a/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp index 88e5f93..dc4730e 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp @@ -53,7 +53,7 @@ using namespace QPatternist; * This page describes how to use DFAs for validating that the XML child tags of an * XML parent tag occur in the right order. * - * To validate the occurence of XML tags one need a regular expression that describes + * To validate the occurrence of XML tags one need a regular expression that describes * which tags can appear how often in what context. For example the regular expression * of the global <em>attribute</em> tag in XML Schema is (annotation?, simpleType?). * That means the <em>attribute</em> tag can contain an <em>annotation</em> tag followed diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h index 294eb50..62c6ab0 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -138,7 +138,7 @@ namespace QPatternist /** * Continues execution of the machine with the given input @p transition. * - * @return @c true if the transition was successfull, @c false otherwise. + * @return @c true if the transition was successful, @c false otherwise. */ bool proceed(TransitionType transition); @@ -154,7 +154,7 @@ namespace QPatternist * @note To use this method, inputEqualsTransition must be implemented * to find the right transition to use. * - * @return @c true if the transition was successfull, @c false otherwise. + * @return @c true if the transition was successful, @c false otherwise. */ template <typename InputType> bool proceed(InputType input); diff --git a/src/xmlpatterns/type/qtypechecker.cpp b/src/xmlpatterns/type/qtypechecker.cpp index 879fe0e..73f83b7 100644 --- a/src/xmlpatterns/type/qtypechecker.cpp +++ b/src/xmlpatterns/type/qtypechecker.cpp @@ -168,7 +168,7 @@ Expression::Ptr TypeChecker::verifyType(const Expression::Ptr &operand, /* Since we haven't exited yet, it means that the operandType is a super type * of reqType, and that there hence is a path down to it through the - * type hierachy -- but that doesn't neccessarily mean that a up-cast(down the + * type hierachy -- but that doesn't necessarily mean that a up-cast(down the * hierarchy) would succeed. */ Expression::Ptr result(operand); |