diff --git a/src/declarative/items/context2d/qsgcontext2d.cpp b/src/declarative/items/context2d/qsgcontext2d.cpp index e75713de8abee2363659e26483158721501766e3..5944a026581c86b3345d0214318a45996d729f36 100644 --- a/src/declarative/items/context2d/qsgcontext2d.cpp +++ b/src/declarative/items/context2d/qsgcontext2d.cpp @@ -1648,7 +1648,7 @@ static v8::Handle<v8::Value> ctx2d_strokeRect(const v8::Arguments &args) r->context->buffer()->strokeRect(x, y, w, h); } - + return args.This(); } @@ -1837,7 +1837,7 @@ static v8::Handle<v8::Value> ctx2d_clip(const v8::Arguments &args) else r->context->state.clipPath = clipPath; r->context->buffer()->clip(r->context->state.clipPath); - + return args.This(); } @@ -2626,7 +2626,7 @@ static v8::Handle<v8::Value> ctx2d_imageData_filter(const v8::Arguments &args) if (args.Length() >= 1) { int filterFlag = args[0]->IntegerValue(); - switch(filterFlag) { + switch (filterFlag) { case QSGCanvasItem::Mono : { r->image = r->image.convertToFormat(QImage::Format_Mono).convertToFormat(QImage::Format_ARGB32_Premultiplied); diff --git a/src/declarative/items/qsganchors.cpp b/src/declarative/items/qsganchors.cpp index 6d5b5a3d834a3e4c1a818e987e1d2164401ab318..67ca0317c4e2afc795e03c3b46622db85c898ea1 100644 --- a/src/declarative/items/qsganchors.cpp +++ b/src/declarative/items/qsganchors.cpp @@ -76,7 +76,7 @@ static qreal vcenter(QSGItem *item) static qreal position(QSGItem *item, QSGAnchorLine::AnchorLine anchorLine) { qreal ret = 0.0; - switch(anchorLine) { + switch (anchorLine) { case QSGAnchorLine::Left: ret = item->x(); break; @@ -109,7 +109,7 @@ static qreal position(QSGItem *item, QSGAnchorLine::AnchorLine anchorLine) static qreal adjustedPosition(QSGItem *item, QSGAnchorLine::AnchorLine anchorLine) { qreal ret = 0.0; - switch(anchorLine) { + switch (anchorLine) { case QSGAnchorLine::Left: ret = 0.0; break; @@ -253,7 +253,7 @@ void QSGAnchorsPrivate::addDepend(QSGItem *item) { if (!item) return; - + QSGItemPrivate *p = QSGItemPrivate::get(item); p->addItemChangeListener(this, QSGItemPrivate::Geometry); } @@ -887,7 +887,7 @@ void QSGAnchors::setLeftMargin(qreal offset) if (d->leftMargin == offset) return; d->leftMargin = offset; - if(d->fill) + if (d->fill) d->fillChanged(); else d->updateHorizontalAnchors(); @@ -906,7 +906,7 @@ void QSGAnchors::setRightMargin(qreal offset) if (d->rightMargin == offset) return; d->rightMargin = offset; - if(d->fill) + if (d->fill) d->fillChanged(); else d->updateHorizontalAnchors(); @@ -925,13 +925,13 @@ void QSGAnchors::setMargins(qreal offset) if (d->margins == offset) return; //###Is it significantly faster to set them directly so we can call fillChanged only once? - if(!d->rightMargin || d->rightMargin == d->margins) + if (!d->rightMargin || d->rightMargin == d->margins) setRightMargin(offset); - if(!d->leftMargin || d->leftMargin == d->margins) + if (!d->leftMargin || d->leftMargin == d->margins) setLeftMargin(offset); - if(!d->topMargin || d->topMargin == d->margins) + if (!d->topMargin || d->topMargin == d->margins) setTopMargin(offset); - if(!d->bottomMargin || d->bottomMargin == d->margins) + if (!d->bottomMargin || d->bottomMargin == d->margins) setBottomMargin(offset); d->margins = offset; emit marginsChanged(); @@ -950,7 +950,7 @@ void QSGAnchors::setHorizontalCenterOffset(qreal offset) if (d->hCenterOffset == offset) return; d->hCenterOffset = offset; - if(d->centerIn) + if (d->centerIn) d->centerInChanged(); else d->updateHorizontalAnchors(); @@ -969,7 +969,7 @@ void QSGAnchors::setTopMargin(qreal offset) if (d->topMargin == offset) return; d->topMargin = offset; - if(d->fill) + if (d->fill) d->fillChanged(); else d->updateVerticalAnchors(); @@ -988,7 +988,7 @@ void QSGAnchors::setBottomMargin(qreal offset) if (d->bottomMargin == offset) return; d->bottomMargin = offset; - if(d->fill) + if (d->fill) d->fillChanged(); else d->updateVerticalAnchors(); @@ -1007,7 +1007,7 @@ void QSGAnchors::setVerticalCenterOffset(qreal offset) if (d->vCenterOffset == offset) return; d->vCenterOffset = offset; - if(d->centerIn) + if (d->centerIn) d->centerInChanged(); else d->updateVerticalAnchors(); diff --git a/src/declarative/items/qsganimatedimage.cpp b/src/declarative/items/qsganimatedimage.cpp index e4bba512af5c94367e937a4d970436f0019b3156..93e028441727a9542d99b3a239ffd202451c4869 100644 --- a/src/declarative/items/qsganimatedimage.cpp +++ b/src/declarative/items/qsganimatedimage.cpp @@ -144,7 +144,7 @@ QSGAnimatedImage::~QSGAnimatedImage() bool QSGAnimatedImage::isPaused() const { Q_D(const QSGAnimatedImage); - if(!d->_movie) + if (!d->_movie) return false; return d->_movie->state()==QMovie::Paused; } @@ -152,10 +152,10 @@ bool QSGAnimatedImage::isPaused() const void QSGAnimatedImage::setPaused(bool pause) { Q_D(QSGAnimatedImage); - if(pause == d->paused) + if (pause == d->paused) return; d->paused = pause; - if(!d->_movie) + if (!d->_movie) return; d->_movie->setPaused(pause); } @@ -179,7 +179,7 @@ bool QSGAnimatedImage::isPlaying() const void QSGAnimatedImage::setPlaying(bool play) { Q_D(QSGAnimatedImage); - if(play == d->playing) + if (play == d->playing) return; d->playing = play; if (!d->_movie) @@ -282,11 +282,11 @@ void QSGAnimatedImage::load() connect(d->_movie, SIGNAL(frameChanged(int)), this, SLOT(movieUpdate())); d->_movie->setCacheMode(QMovie::CacheAll); - if(d->playing) + if (d->playing) d->_movie->start(); else d->_movie->jumpToFrame(0); - if(d->paused) + if (d->paused) d->_movie->setPaused(true); d->setPixmap(d->_movie->currentPixmap()); d->status = Ready; @@ -347,13 +347,13 @@ void QSGAnimatedImage::movieRequestFinished() connect(d->_movie, SIGNAL(frameChanged(int)), this, SLOT(movieUpdate())); d->_movie->setCacheMode(QMovie::CacheAll); - if(d->playing) + if (d->playing) d->_movie->start(); if (d->paused || !d->playing) { d->_movie->jumpToFrame(d->preset_currentframe); d->preset_currentframe = 0; } - if(d->paused) + if (d->paused) d->_movie->setPaused(true); d->setPixmap(d->_movie->currentPixmap()); d->status = Ready; @@ -370,11 +370,11 @@ void QSGAnimatedImage::movieUpdate() void QSGAnimatedImage::playingStatusChanged() { Q_D(QSGAnimatedImage); - if((d->_movie->state() != QMovie::NotRunning) != d->playing){ + if ((d->_movie->state() != QMovie::NotRunning) != d->playing) { d->playing = (d->_movie->state() != QMovie::NotRunning); emit playingChanged(); } - if((d->_movie->state() == QMovie::Paused) != d->paused){ + if ((d->_movie->state() == QMovie::Paused) != d->paused) { d->playing = (d->_movie->state() == QMovie::Paused); emit pausedChanged(); } diff --git a/src/declarative/items/qsganimation.cpp b/src/declarative/items/qsganimation.cpp index b0dc8207638f0e3ffa8ccc2c0b776575758b8208..81c83913c173856ddca2dc2ffe67d847ddac417e 100644 --- a/src/declarative/items/qsganimation.cpp +++ b/src/declarative/items/qsganimation.cpp @@ -129,7 +129,7 @@ void QSGParentAnimation::setVia(QSGItem *via) //### mirrors same-named function in QSGItem QPointF QSGParentAnimationPrivate::computeTransformOrigin(QSGItem::TransformOrigin origin, qreal width, qreal height) const { - switch(origin) { + switch (origin) { default: case QSGItem::TopLeft: return QPointF(0, 0); diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 9efd17ae11addd46764cb650e96dbf10975f26c3..879beb931060dbe0dd529b13c53be38910254f70 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -992,10 +992,9 @@ bool QSGCanvasPrivate::deliverMouseEvent(QMouseEvent *event) lastMousePosition = event->windowPos(); - if (!mouseGrabberItem && + if (!mouseGrabberItem && event->type() == QEvent::MouseButtonPress && (event->button() & event->buttons()) == event->buttons()) { - return deliverInitialMousePressEvent(rootItem, event); } @@ -1542,7 +1541,7 @@ bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e) case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: case QEvent::MouseMove: - // XXX todo - should sendEvent be doing this? how does it relate to forwarded events? + // XXX todo - should sendEvent be doing this? how does it relate to forwarded events? { QMouseEvent *se = static_cast<QMouseEvent *>(e); if (!d->sendFilteredMouseEvent(item->parentItem(), item, se)) { @@ -1929,7 +1928,7 @@ QImage QSGCanvas::grabFrameBuffer() } /*! - Returns an incubation controller that splices incubation between frames + Returns an incubation controller that splices incubation between frames for this canvas. QSGView automatically installs this controller for you. The controller is owned by the canvas and will be destroyed when the canvas diff --git a/src/declarative/items/qsgflickable.cpp b/src/declarative/items/qsgflickable.cpp index 09bb8e3c2e471368cfbdc7eb710157612a37850c..4871a43e8d50f484ba13f7d20ff3f21276cd5670 100644 --- a/src/declarative/items/qsgflickable.cpp +++ b/src/declarative/items/qsgflickable.cpp @@ -943,7 +943,7 @@ void QSGFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) // if we drag then pause before release we should not cause a flick. qint64 elapsed = QSGItemPrivate::elapsed(lastPosTime); - + vData.updateVelocity(); hData.updateVelocity(); @@ -1655,7 +1655,7 @@ bool QSGFlickable::sendMouseEvent(QMouseEvent *event) mouseEvent.setAccepted(false); - switch(mouseEvent.type()) { + switch (mouseEvent.type()) { case QEvent::MouseMove: d->handleMouseMoveEvent(&mouseEvent); break; diff --git a/src/declarative/items/qsgimage.cpp b/src/declarative/items/qsgimage.cpp index a23d9ede1b3e17b01223b14e79e821c2369770de..9461de4278821289606409b4a5a7a530f5ef48f2 100644 --- a/src/declarative/items/qsgimage.cpp +++ b/src/declarative/items/qsgimage.cpp @@ -489,7 +489,7 @@ void QSGImage::updatePaintedGeometry() if (widthScale <= heightScale) { d->paintedWidth = w; d->paintedHeight = widthScale * qreal(d->pix.height()); - } else if(heightScale < widthScale) { + } else if (heightScale < widthScale) { d->paintedWidth = heightScale * qreal(d->pix.width()); d->paintedHeight = h; } @@ -510,7 +510,7 @@ void QSGImage::updatePaintedGeometry() qreal heightScale = height() / qreal(d->pix.height()); if (widthScale < heightScale) { widthScale = heightScale; - } else if(heightScale < widthScale) { + } else if (heightScale < widthScale) { heightScale = widthScale; } @@ -574,7 +574,7 @@ QSGNode *QSGImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) } QSGImageNode *node = static_cast<QSGImageNode *>(oldNode); - if (!node) { + if (!node) { d->pixmapChanged = true; node = d->sceneGraphContext()->createImageNode(); node->setTexture(texture); diff --git a/src/declarative/items/qsgitem.cpp b/src/declarative/items/qsgitem.cpp index 8ede2a490e77b08d00f584666cef14065fd8a311..bdea19b3e076a4d5a378b92017d2af4d7fd8f236 100644 --- a/src/declarative/items/qsgitem.cpp +++ b/src/declarative/items/qsgitem.cpp @@ -604,7 +604,7 @@ void QSGKeyNavigationAttached::setDown(QSGItem *i) d->downSet = true; QSGKeyNavigationAttached* other = qobject_cast<QSGKeyNavigationAttached*>(qmlAttachedPropertiesObject<QSGKeyNavigationAttached>(i)); - if(other && !other->d_func()->upSet){ + if (other && !other->d_func()->upSet) { other->d_func()->up = qobject_cast<QSGItem*>(parent()); emit other->upChanged(); } @@ -626,7 +626,7 @@ void QSGKeyNavigationAttached::setTab(QSGItem *i) d->tabSet = true; QSGKeyNavigationAttached* other = qobject_cast<QSGKeyNavigationAttached*>(qmlAttachedPropertiesObject<QSGKeyNavigationAttached>(i)); - if(other && !other->d_func()->backtabSet){ + if (other && !other->d_func()->backtabSet) { other->d_func()->backtab = qobject_cast<QSGItem*>(parent()); emit other->backtabChanged(); } @@ -648,7 +648,7 @@ void QSGKeyNavigationAttached::setBacktab(QSGItem *i) d->backtabSet = true; QSGKeyNavigationAttached* other = qobject_cast<QSGKeyNavigationAttached*>(qmlAttachedPropertiesObject<QSGKeyNavigationAttached>(i)); - if(other && !other->d_func()->tabSet){ + if (other && !other->d_func()->tabSet) { other->d_func()->tab = qobject_cast<QSGItem*>(parent()); emit other->tabChanged(); } @@ -695,7 +695,7 @@ void QSGKeyNavigationAttached::keyPressed(QKeyEvent *event, bool post) } bool mirror = false; - switch(event->key()) { + switch (event->key()) { case Qt::Key_Left: { if (QSGItem *parentItem = qobject_cast<QSGItem*>(parent())) mirror = QSGItemPrivate::get(parentItem)->effectiveLayoutMirror; @@ -758,7 +758,7 @@ void QSGKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) } bool mirror = false; - switch(event->key()) { + switch (event->key()) { case Qt::Key_Left: if (QSGItem *parentItem = qobject_cast<QSGItem*>(parent())) mirror = QSGItemPrivate::get(parentItem)->effectiveLayoutMirror; @@ -2697,7 +2697,7 @@ QSGItemPrivate::AnchorLines *QSGItemPrivate::anchorLines() const void QSGItemPrivate::siblingOrderChanged() { Q_Q(QSGItem); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::SiblingOrder) { change.listener->itemSiblingOrderChanged(q); @@ -2758,7 +2758,7 @@ void QSGItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeomet if (d->_anchors) QSGAnchorsPrivate::get(d->_anchors)->updateMe(); - for(int ii = 0; ii < d->changeListeners.count(); ++ii) { + for (int ii = 0; ii < d->changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = d->changeListeners.at(ii); if (change.types & QSGItemPrivate::Geometry) change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); @@ -3022,7 +3022,7 @@ void QSGItem::setBaselineOffset(qreal offset) d->baselineOffset = offset; - for(int ii = 0; ii < d->changeListeners.count(); ++ii) { + for (int ii = 0; ii < d->changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = d->changeListeners.at(ii); if (change.types & QSGItemPrivate::Geometry) { QSGAnchorsPrivate *anchor = change.listener->anchorPrivate(); @@ -3272,7 +3272,7 @@ QSGItemPrivate::AnchorLines::AnchorLines(QSGItem *q) QPointF QSGItemPrivate::computeTransformOrigin() const { - switch(origin) { + switch (origin) { default: case QSGItem::TopLeft: return QPointF(0, 0); @@ -3377,7 +3377,7 @@ void QSGItemPrivate::deliverMouseEvent(QMouseEvent *e) Q_ASSERT(e->isAccepted()); - switch(e->type()) { + switch (e->type()) { default: Q_ASSERT(!"Unknown event type"); case QEvent::MouseMove: @@ -3410,7 +3410,7 @@ void QSGItemPrivate::deliverTouchEvent(QTouchEvent *e) void QSGItemPrivate::deliverHoverEvent(QHoverEvent *e) { Q_Q(QSGItem); - switch(e->type()) { + switch (e->type()) { default: Q_ASSERT(!"Unknown event type"); case QEvent::HoverEnter: @@ -3775,7 +3775,7 @@ void QSGItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible) for (int ii = 0; ii < childItems.count(); ++ii) QSGItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Visibility) change.listener->itemVisibilityChanged(q); @@ -3929,12 +3929,12 @@ void QSGItemPrivate::derefFromEffectItem(bool unhide) void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemChangeData &data) { Q_Q(QSGItem); - switch(change) { + switch (change) { case QSGItem::ItemChildAddedChange: q->itemChange(change, data); if (_contents && componentComplete) _contents->childAdded(data.item); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Children) { change.listener->itemChildAdded(q, data.item); @@ -3945,7 +3945,7 @@ void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemC q->itemChange(change, data); if (_contents && componentComplete) _contents->childRemoved(data.item); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Children) { change.listener->itemChildRemoved(q, data.item); @@ -3957,7 +3957,7 @@ void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemC break; case QSGItem::ItemVisibleHasChanged: q->itemChange(change, data); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Visibility) { change.listener->itemVisibilityChanged(q); @@ -3966,7 +3966,7 @@ void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemC break; case QSGItem::ItemParentHasChanged: q->itemChange(change, data); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Parent) { change.listener->itemParentChanged(q, data.item); @@ -3975,7 +3975,7 @@ void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemC break; case QSGItem::ItemOpacityHasChanged: q->itemChange(change, data); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Opacity) { change.listener->itemOpacityChanged(q); @@ -3987,7 +3987,7 @@ void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemC break; case QSGItem::ItemRotationHasChanged: q->itemChange(change, data); - for(int ii = 0; ii < changeListeners.count(); ++ii) { + for (int ii = 0; ii < changeListeners.count(); ++ii) { const QSGItemPrivate::ChangeListener &change = changeListeners.at(ii); if (change.types & QSGItemPrivate::Rotation) { change.listener->itemRotationChanged(q); @@ -4468,7 +4468,7 @@ void QSGItem::setAcceptHoverEvents(bool enabled) d->hoverEnabled = enabled; } -void QSGItem::grabMouse() +void QSGItem::grabMouse() { Q_D(QSGItem); if (!d->canvas) diff --git a/src/declarative/items/qsgitem_p.h b/src/declarative/items/qsgitem_p.h index 02c3f8772f7bad6fa3b0f630c6078cf332b7bfa4..c0ed1dbc8b81b837d33b2a85f0fdeb8d99f3ba61 100644 --- a/src/declarative/items/qsgitem_p.h +++ b/src/declarative/items/qsgitem_p.h @@ -670,7 +670,7 @@ private: }; QSGTransformNode *QSGItemPrivate::itemNode() -{ +{ if (!itemNodeInstance) { itemNodeInstance = createTransformNode(); itemNodeInstance->setFlag(QSGNode::OwnedByParent, false); @@ -679,7 +679,7 @@ QSGTransformNode *QSGItemPrivate::itemNode() itemNodeInstance->description = QString::fromLatin1("QSGItem(%1)").arg(QString::fromLatin1(q->metaObject()->className())); #endif } - return itemNodeInstance; + return itemNodeInstance; } QSGNode *QSGItemPrivate::childContainerNode() diff --git a/src/declarative/items/qsgmousearea.cpp b/src/declarative/items/qsgmousearea.cpp index de7913c3d1d7156d32380369a0d6b662087f55b1..4d14eaa565f2ec876ace3f818dcd12e2a1181554 100644 --- a/src/declarative/items/qsgmousearea.cpp +++ b/src/declarative/items/qsgmousearea.cpp @@ -263,7 +263,7 @@ bool QSGMouseAreaPrivate::propagateHelper(QSGMouseEvent *ev, QSGItem *item,const QSGMouseArea* ma = qobject_cast<QSGMouseArea*>(item); if (ma && ma != q && itemPrivate->acceptedMouseButtons & ev->button()) { - switch(sig){ + switch (sig) { case Click: if (!ma->d_func()->isClickConnected()) return false; @@ -282,7 +282,7 @@ bool QSGMouseAreaPrivate::propagateHelper(QSGMouseEvent *ev, QSGItem *item,const ev->setX(p.x()); ev->setY(p.y()); ev->setAccepted(true);//It is connected, they have to explicitly ignore to let it slide - switch(sig){ + switch (sig) { case Click: emit ma->clicked(ev); break; case DoubleClick: emit ma->doubleClicked(ev); break; case PressAndHold: emit ma->pressAndHold(ev); break; diff --git a/src/declarative/items/qsgpathview.cpp b/src/declarative/items/qsgpathview.cpp index 590fa93782f3afced12c20e3ec34f50d3965be39..5e2ad84e3b7ca8fadf48a0bc5f7b7f7ceba26675 100644 --- a/src/declarative/items/qsgpathview.cpp +++ b/src/declarative/items/qsgpathview.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE inline qreal qmlMod(qreal x, qreal y) { #ifdef QT_USE_MATH_H_FLOATS - if(sizeof(qreal) == sizeof(float)) + if (sizeof(qreal) == sizeof(float)) return fmodf(float(x), float(y)); else #endif @@ -115,7 +115,7 @@ QSGItem *QSGPathViewPrivate::getItem(int modelIndex, bool onPath) if (!attType) { // pre-create one metatype to share with all attached objects attType = new QDeclarativeOpenMetaObjectType(&QSGPathViewAttached::staticMetaObject, qmlEngine(q)); - foreach(const QString &attr, path->attributes()) + foreach (const QString &attr, path->attributes()) attType->createProperty(attr.toUtf8()); } qPathViewAttachedType = attType; @@ -322,7 +322,7 @@ void QSGPathViewPrivate::updateItem(QSGItem *item, qreal percent) if (qFuzzyCompare(att->m_percent, percent)) return; att->m_percent = percent; - foreach(const QString &attr, path->attributes()) + foreach (const QString &attr, path->attributes()) att->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); } QPointF pf = path->pointAt(percent); @@ -1262,7 +1262,7 @@ bool QSGPathView::sendMouseEvent(QMouseEvent *event) event->button(), event->buttons(), event->modifiers()); mouseEvent.setAccepted(false); - switch(mouseEvent.type()) { + switch (mouseEvent.type()) { case QEvent::MouseMove: d->handleMouseMoveEvent(&mouseEvent); break; @@ -1581,7 +1581,7 @@ void QSGPathView::createdItem(int index, QSGItem *item) if (!d->attType) { // pre-create one metatype to share with all attached objects d->attType = new QDeclarativeOpenMetaObjectType(&QSGPathViewAttached::staticMetaObject, qmlEngine(this)); - foreach(const QString &attr, d->path->attributes()) + foreach (const QString &attr, d->path->attributes()) d->attType->createProperty(attr.toUtf8()); } qPathViewAttachedType = d->attType; diff --git a/src/declarative/items/qsgpincharea.cpp b/src/declarative/items/qsgpincharea.cpp index d02477ee34209e4ee34219f8d384eacb330a5efc..2dbe683f261294852fb902347954e68e41ef350f 100644 --- a/src/declarative/items/qsgpincharea.cpp +++ b/src/declarative/items/qsgpincharea.cpp @@ -516,7 +516,7 @@ bool QSGPinchArea::sendMouseEvent(QMouseEvent *event) event->button(), event->buttons(), event->modifiers()); mouseEvent.setAccepted(false); - switch(mouseEvent.type()) { + switch (mouseEvent.type()) { case QEvent::MouseMove: mouseMoveEvent(&mouseEvent); break; diff --git a/src/declarative/items/qsgpositioners.cpp b/src/declarative/items/qsgpositioners.cpp index 0401494d3b6b420d718284d8101f424efd02e3b7..eaca2101e259ed39802c6489e480cd57ebb5af91 100644 --- a/src/declarative/items/qsgpositioners.cpp +++ b/src/declarative/items/qsgpositioners.cpp @@ -252,7 +252,7 @@ void QSGBasePositioner::prePositioning() void QSGBasePositioner::positionX(int x, const PositionedItem &target) { Q_D(QSGBasePositioner); - if(d->type == Horizontal || d->type == Both){ + if (d->type == Horizontal || d->type == Both) { if (target.isNew) { if (!d->addTransition || !d->addTransition->enabled()) target.item->setX(x); @@ -270,7 +270,7 @@ void QSGBasePositioner::positionX(int x, const PositionedItem &target) void QSGBasePositioner::positionY(int y, const PositionedItem &target) { Q_D(QSGBasePositioner); - if(d->type == Vertical || d->type == Both){ + if (d->type == Vertical || d->type == Both) { if (target.isNew) { if (!d->addTransition || !d->addTransition->enabled()) target.item->setY(y); @@ -541,7 +541,7 @@ void QSGColumn::doPositioning(QSizeF *contentSize) if (!child.item || !child.isVisible) continue; - if(child.item->y() != voffset) + if (child.item->y() != voffset) positionY(voffset, child); contentSize->setWidth(qMax(contentSize->width(), child.item->width())); @@ -1081,8 +1081,8 @@ void QSGGrid::doPositioning(QSizeF *contentSize) //Is allocating the extra QPODVector too much overhead? QPODVector<PositionedItem, 8> visibleItems;//we aren't concerned with invisible items visibleItems.reserve(positionedItems.count()); - for(int i=0; i<positionedItems.count(); i++) - if(positionedItems[i].item && positionedItems[i].isVisible) + for (int i=0; i<positionedItems.count(); i++) + if (positionedItems[i].item && positionedItems[i].isVisible) visibleItems.append(positionedItems[i]); int numVisible = visibleItems.count(); @@ -1095,7 +1095,7 @@ void QSGGrid::doPositioning(QSizeF *contentSize) c = (numVisible+(m_rows-1))/m_rows; } - if(r==0 || c==0) + if (r==0 || c==0) return; //Nothing to do QList<int> maxColWidth; diff --git a/src/declarative/items/qsgscalegrid.cpp b/src/declarative/items/qsgscalegrid.cpp index e1b76c4158d1db765728afcee5e7f2d803486a4d..1c4ce8d289a0080b2152133032d1c1fd9ea2848d 100644 --- a/src/declarative/items/qsgscalegrid.cpp +++ b/src/declarative/items/qsgscalegrid.cpp @@ -129,7 +129,7 @@ QSGGridScaledImage::QSGGridScaledImage(QIODevice *data) QString imgFile; QByteArray raw; - while(raw = data->readLine(), !raw.isEmpty()) { + while (raw = data->readLine(), !raw.isEmpty()) { QString line = QString::fromUtf8(raw.trimmed()); if (line.isEmpty() || line.startsWith(QLatin1Char('#'))) continue; diff --git a/src/declarative/items/qsgshadereffect.cpp b/src/declarative/items/qsgshadereffect.cpp index 81adf8d70562488ba644c1d618ff5f4b16766643..f84d0239060964ae7dfa35b6c7d22cab59259c1a 100644 --- a/src/declarative/items/qsgshadereffect.cpp +++ b/src/declarative/items/qsgshadereffect.cpp @@ -621,7 +621,7 @@ QSGNode *QSGShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData QVector<QPair<QByteArray, QSGTextureProvider *> > textures; const QVector<QPair<QByteArray, QSGTextureProvider *> > &oldTextures = material->textureProviders(); - for (QSet<QByteArray>::const_iterator it = m_source.uniformNames.begin(); + for (QSet<QByteArray>::const_iterator it = m_source.uniformNames.begin(); it != m_source.uniformNames.end(); ++it) { values.append(qMakePair(*it, property(*it))); } diff --git a/src/declarative/items/qsgshadereffect_p.h b/src/declarative/items/qsgshadereffect_p.h index a8c3f084e46f15557382e89d9578daccf55b2efb..08af5f6bffec469cf4a62825de12dba8076eabfb 100644 --- a/src/declarative/items/qsgshadereffect_p.h +++ b/src/declarative/items/qsgshadereffect_p.h @@ -89,7 +89,7 @@ public: QByteArray fragmentShader() const { return m_source.fragmentCode; } void setFragmentShader(const QByteArray &code); - + QByteArray vertexShader() const { return m_source.vertexCode; } void setVertexShader(const QByteArray &code); diff --git a/src/declarative/items/qsgshadereffectsource.cpp b/src/declarative/items/qsgshadereffectsource.cpp index 3b0983863fb5e1a43cb81114d423e64dafc5454d..4bbabe1701ade6ad7bd02e2e5079121bf59c7d47 100644 --- a/src/declarative/items/qsgshadereffectsource.cpp +++ b/src/declarative/items/qsgshadereffectsource.cpp @@ -419,7 +419,7 @@ QImage QSGShaderEffectTexture::toImage() const The complex element can be rendered once into the texture, which can then be animated freely without the need to render the complex element again every frame. - \o an opacity layer. + \o an opacity layer. ShaderEffectSource allows you to apply an opacity to elements as a group rather than each element individually. \endlist diff --git a/src/declarative/items/qsgspriteimage.cpp b/src/declarative/items/qsgspriteimage.cpp index 20544ad28b3e1abdfb48052e2be51bad6e1833fb..f6cd35f4f3e7b7ee0c13c966895f4ed28d4f817b 100644 --- a/src/declarative/items/qsgspriteimage.cpp +++ b/src/declarative/items/qsgspriteimage.cpp @@ -278,9 +278,9 @@ QDeclarativeListProperty<QSGSprite> QSGSpriteImage::sprites() void QSGSpriteImage::createEngine() { //TODO: delay until component complete - if(m_spriteEngine) + if (m_spriteEngine) delete m_spriteEngine; - if(m_sprites.count()) + if (m_sprites.count()) m_spriteEngine = new QSGSpriteEngine(m_sprites, this); else m_spriteEngine = 0; @@ -308,7 +308,7 @@ QSGGeometryNode* QSGSpriteImage::buildNode() m_material = new QSGSpriteMaterial(); QImage image = m_spriteEngine->assembledImage(); - if(image.isNull()) + if (image.isNull()) return 0; m_material->texture = sceneGraphEngine()->createTextureFromImage(image); m_material->texture->setFiltering(QSGTexture::Linear); @@ -369,7 +369,7 @@ void QSGSpriteImage::reset() QSGNode *QSGSpriteImage::updatePaintNode(QSGNode *, UpdatePaintNodeData *) { - if(m_pleaseReset){ + if (m_pleaseReset) { delete m_node; delete m_material; @@ -380,7 +380,7 @@ QSGNode *QSGSpriteImage::updatePaintNode(QSGNode *, UpdatePaintNodeData *) prepareNextFrame(); - if(m_running){ + if (m_running) { update(); if (m_node) m_node->markDirty(QSGNode::DirtyMaterial); diff --git a/src/declarative/items/qsgtext.cpp b/src/declarative/items/qsgtext.cpp index 3c525c0f2189faced73e62e19ebd41855798eade..6c55e82802abb403d120f4bc9e1140313b07b392 100644 --- a/src/declarative/items/qsgtext.cpp +++ b/src/declarative/items/qsgtext.cpp @@ -756,7 +756,7 @@ void QSGTextPrivate::invalidateImageCache() { Q_Q(QSGText); - if(richTextAsImage || cacheAllTextAsImage || (qmlDisableDistanceField() && style != QSGText::Normal)){//If actually using the image cache + if (richTextAsImage || cacheAllTextAsImage || (qmlDisableDistanceField() && style != QSGText::Normal)) { // If actually using the image cache if (imageCacheDirty) return; @@ -1064,8 +1064,8 @@ QSGText::~QSGText() \list \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. \o Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \o Font.SmallCaps - This alters the text to be rendered in small-caps type. + \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. + \o Font.SmallCaps - This alters the text to be rendered in small-caps type. \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. \endlist diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp index cec3bd8b204638799d2daa0d002a325d5d9b08d0..bbc751f99c14be888c3c5abfe3f8e2a5bc98780f 100644 --- a/src/declarative/items/qsgtextedit.cpp +++ b/src/declarative/items/qsgtextedit.cpp @@ -231,8 +231,8 @@ QString QSGTextEdit::text() const \list \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. \o Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \o Font.SmallCaps - This alters the text to be rendered in small-caps type. + \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. + \o Font.SmallCaps - This alters the text to be rendered in small-caps type. \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. \endlist @@ -361,7 +361,7 @@ void QSGTextEdit::setFont(const QFont &font) if (oldFont != d->font) { d->document->setDefaultFont(d->font); - if(d->cursor){ + if (d->cursor) { d->cursor->setHeight(QFontMetrics(d->font).height()); moveCursorDelegate(); } @@ -866,8 +866,8 @@ QDeclarativeComponent* QSGTextEdit::cursorDelegate() const void QSGTextEdit::setCursorDelegate(QDeclarativeComponent* c) { Q_D(QSGTextEdit); - if(d->cursorComponent){ - if(d->cursor){ + if (d->cursorComponent) { + if (d->cursor) { d->control->setCursorWidth(-1); updateCursor(); delete d->cursor; @@ -875,10 +875,10 @@ void QSGTextEdit::setCursorDelegate(QDeclarativeComponent* c) } } d->cursorComponent = c; - if(c && c->isReady()){ + if (c && c->isReady()) { loadCursorDelegate(); - }else{ - if(c) + } else { + if (c) connect(c, SIGNAL(statusChanged()), this, SLOT(loadCursorDelegate())); } @@ -889,12 +889,12 @@ void QSGTextEdit::setCursorDelegate(QDeclarativeComponent* c) void QSGTextEdit::loadCursorDelegate() { Q_D(QSGTextEdit); - if(d->cursorComponent->isLoading()) + if (d->cursorComponent->isLoading()) return; QDeclarativeContext *creationContext = d->cursorComponent->creationContext(); QObject *object = d->cursorComponent->create(creationContext ? creationContext : qmlContext(this)); d->cursor = qobject_cast<QSGItem*>(object); - if(d->cursor){ + if (d->cursor) { d->control->setCursorWidth(0); updateCursor(); QDeclarative_setParent_noEvent(d->cursor, this); @@ -1665,7 +1665,7 @@ void QSGTextEdit::moveCursorDelegate() d->determineHorizontalAlignment(); updateMicroFocus(); emit cursorRectangleChanged(); - if(!d->cursor) + if (!d->cursor) return; QRectF cursorRect = cursorRectangle(); d->cursor->setX(cursorRect.x()); @@ -1683,20 +1683,20 @@ void QSGTextEditPrivate::updateSelection() cursor.setPosition(lastSelectionEnd, QTextCursor::KeepAnchor); cursor.endEditBlock(); control->setTextCursor(cursor); - if(startChange) + if (startChange) q->selectionStartChanged(); - if(endChange) + if (endChange) q->selectionEndChanged(); } void QSGTextEdit::updateSelectionMarkers() { Q_D(QSGTextEdit); - if(d->lastSelectionStart != d->control->textCursor().selectionStart()){ + if (d->lastSelectionStart != d->control->textCursor().selectionStart()) { d->lastSelectionStart = d->control->textCursor().selectionStart(); emit selectionStartChanged(); } - if(d->lastSelectionEnd != d->control->textCursor().selectionEnd()){ + if (d->lastSelectionEnd != d->control->textCursor().selectionEnd()) { d->lastSelectionEnd = d->control->textCursor().selectionEnd(); emit selectionEndChanged(); } @@ -1707,9 +1707,9 @@ QRectF QSGTextEdit::boundingRect() const Q_D(const QSGTextEdit); QRectF r = QSGImplicitSizeItem::boundingRect(); int cursorWidth = 1; - if(d->cursor) + if (d->cursor) cursorWidth = d->cursor->width(); - if(!d->document->isEmpty()) + if (!d->document->isEmpty()) cursorWidth += 3;// ### Need a better way of accounting for space between char and cursor // Could include font max left/right bearings to either side of rectangle. @@ -1951,7 +1951,7 @@ void QSGTextEdit::openSoftwareInputPanel() \endcode */ void QSGTextEdit::closeSoftwareInputPanel() -{ +{ if (qGuiApp) qGuiApp->inputPanel()->hide(); } @@ -1969,7 +1969,7 @@ void QSGTextEdit::q_canPasteChanged() Q_D(QSGTextEdit); bool old = d->canPaste; d->canPaste = d->control->canPaste(); - if(old!=d->canPaste) + if (old!=d->canPaste) emit canPasteChanged(); } diff --git a/src/declarative/items/qsgtextedit_p.h b/src/declarative/items/qsgtextedit_p.h index b07292b2963e9086bfa1b29e977b1000e971ab32..fced11808f79f6adf3714e4bcf1d874b656e9cd4 100644 --- a/src/declarative/items/qsgtextedit_p.h +++ b/src/declarative/items/qsgtextedit_p.h @@ -274,7 +274,7 @@ private: void updateImageCache(const QRectF &rect = QRectF()); protected: - virtual void geometryChanged(const QRectF &newGeometry, + virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); bool event(QEvent *); diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp index e6e2d217734b6f0dc8107c677c3d513210efb843..1eddbde60839b0bdf0a88ef9dc75ef09b568da36 100644 --- a/src/declarative/items/qsgtextinput.cpp +++ b/src/declarative/items/qsgtextinput.cpp @@ -103,7 +103,7 @@ QString QSGTextInput::text() const void QSGTextInput::setText(const QString &s) { Q_D(QSGTextInput); - if(s == text()) + if (s == text()) return; d->control->setText(s); } @@ -203,8 +203,8 @@ void QSGTextInput::setText(const QString &s) \list \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. \o Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \o Font.SmallCaps - This alters the text to be rendered in small-caps type. + \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. + \o Font.SmallCaps - This alters the text to be rendered in small-caps type. \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. \endlist @@ -237,7 +237,7 @@ void QSGTextInput::setFont(const QFont &font) d->control->setFont(d->font); updateSize(); updateCursorRectangle(); - if(d->cursorItem){ + if (d->cursorItem) { d->cursorItem->setHeight(QFontMetrics(d->font).height()); } } @@ -795,7 +795,7 @@ void QSGTextInput::setValidator(QValidator* v) return; d->control->setValidator(v); - if(!d->control->hasAcceptableInput()){ + if (!d->control->hasAcceptableInput()) { d->oldValidity = false; emit acceptableInputChanged(); } @@ -935,10 +935,10 @@ void QSGTextInput::setCursorDelegate(QDeclarativeComponent* c) return; d->cursorComponent = c; - if(!c){ + if (!c) { //note that the components are owned by something else delete d->cursorItem; - }else{ + } else { d->startCreatingCursor(); } @@ -948,12 +948,12 @@ void QSGTextInput::setCursorDelegate(QDeclarativeComponent* c) void QSGTextInputPrivate::startCreatingCursor() { Q_Q(QSGTextInput); - if(cursorComponent->isReady()){ + if (cursorComponent->isReady()) { q->createCursor(); - }else if(cursorComponent->isLoading()){ + } else if (cursorComponent->isLoading()) { q->connect(cursorComponent, SIGNAL(statusChanged(int)), q, SLOT(createCursor())); - }else {//isError + } else { // isError qmlInfo(q, cursorComponent->errors()) << QSGTextInput::tr("Could not load cursor delegate"); } } @@ -961,20 +961,20 @@ void QSGTextInputPrivate::startCreatingCursor() void QSGTextInput::createCursor() { Q_D(QSGTextInput); - if(d->cursorComponent->isError()){ + if (d->cursorComponent->isError()) { qmlInfo(this, d->cursorComponent->errors()) << tr("Could not load cursor delegate"); return; } - if(!d->cursorComponent->isReady()) + if (!d->cursorComponent->isReady()) return; - if(d->cursorItem) + if (d->cursorItem) delete d->cursorItem; QDeclarativeContext *creationContext = d->cursorComponent->creationContext(); QObject *object = d->cursorComponent->create(creationContext ? creationContext : qmlContext(this)); d->cursorItem = qobject_cast<QSGItem*>(object); - if(!d->cursorItem){ + if (!d->cursorItem) { delete object; qmlInfo(this, d->cursorComponent->errors()) << tr("Could not instantiate cursor delegate"); return; @@ -1105,7 +1105,7 @@ void QSGTextInput::mousePressEvent(QMouseEvent *event) Q_D(QSGTextInput); if (d->sendMouseEventToInputContext(event)) return; - if(d->focusOnPress){ + if (d->focusOnPress) { bool hadActiveFocus = hasActiveFocus(); forceActiveFocus(); // re-open input panel on press if already focused @@ -1197,7 +1197,7 @@ bool QSGTextInput::event(QEvent* ev) Q_D(QSGTextInput); //Anything we don't deal with ourselves, pass to the control bool handled = false; - switch(ev->type()){ + switch (ev->type()) { case QEvent::KeyPress: case QEvent::KeyRelease://###Should the control be doing anything with release? case QEvent::InputMethod: @@ -1209,7 +1209,7 @@ bool QSGTextInput::event(QEvent* ev) default: handled = d->control->processEvent(ev); } - if(!handled) + if (!handled) handled = QSGImplicitSizeItem::event(ev); return handled; } @@ -1347,7 +1347,7 @@ QSGNode *QSGTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *da QVariant QSGTextInput::inputMethodQuery(Qt::InputMethodQuery property) const { Q_D(const QSGTextInput); - switch(property) { + switch (property) { case Qt::ImEnabled: return QVariant((bool)(flags() & ItemAcceptsInputMethod)); case Qt::ImHints: @@ -1499,7 +1499,7 @@ QString QSGTextInput::passwordCharacter() const void QSGTextInput::setPasswordCharacter(const QString &str) { Q_D(QSGTextInput); - if(str.length() < 1) + if (str.length() < 1) return; d->control->setPasswordCharacter(str.constData()[0]); EchoMode echoMode_ = echoMode(); @@ -1795,7 +1795,7 @@ void QSGTextInput::itemChange(ItemChange change, const ItemChangeData &value) bool hasFocus = value.boolValue; d->focused = hasFocus; setCursorVisible(hasFocus); // ### refactor: && d->canvas && d->canvas->hasFocus() - if(echoMode() == QSGTextInput::PasswordEchoOnEdit && !hasFocus) + if (echoMode() == QSGTextInput::PasswordEchoOnEdit && !hasFocus) d->control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events if (!hasFocus) d->control->deselect(); @@ -1881,12 +1881,12 @@ void QSGTextInput::cursorPosChanged() d->control->resetCursorBlinkTimer(); #endif - if(!d->control->hasSelectedText()){ - if(d->lastSelectionStart != d->control->cursor()){ + if (!d->control->hasSelectedText()) { + if (d->lastSelectionStart != d->control->cursor()) { d->lastSelectionStart = d->control->cursor(); emit selectionStartChanged(); } - if(d->lastSelectionEnd != d->control->cursor()){ + if (d->lastSelectionEnd != d->control->cursor()) { d->lastSelectionEnd = d->control->cursor(); emit selectionEndChanged(); } @@ -1911,15 +1911,15 @@ void QSGTextInput::selectionChanged() updateRect();//TODO: Only update rect in selection emit selectedTextChanged(); - if(d->lastSelectionStart != d->control->selectionStart()){ + if (d->lastSelectionStart != d->control->selectionStart()) { d->lastSelectionStart = d->control->selectionStart(); - if(d->lastSelectionStart == -1) + if (d->lastSelectionStart == -1) d->lastSelectionStart = d->control->cursor(); emit selectionStartChanged(); } - if(d->lastSelectionEnd != d->control->selectionEnd()){ + if (d->lastSelectionEnd != d->control->selectionEnd()) { d->lastSelectionEnd = d->control->selectionEnd(); - if(d->lastSelectionEnd == -1) + if (d->lastSelectionEnd == -1) d->lastSelectionEnd = d->control->cursor(); emit selectionEndChanged(); } @@ -1934,7 +1934,7 @@ void QSGTextInput::q_textChanged() d->determineHorizontalAlignment(); d->updateHorizontalScroll(); updateMicroFocus(); - if(hasAcceptableInput() != d->oldValidity){ + if (hasAcceptableInput() != d->oldValidity) { d->oldValidity = hasAcceptableInput(); emit acceptableInputChanged(); } @@ -1985,7 +1985,7 @@ void QSGTextInput::updateSize(bool needsRedraw) int h = height(); setImplicitHeight(d->control->height()-1); // -1 to counter QLineControl's +1 which is not consistent with Text. setImplicitWidth(d->calculateTextWidth()); - if(w==width() && h==height() && needsRedraw) + if (w==width() && h==height() && needsRedraw) update(); } @@ -1996,7 +1996,7 @@ void QSGTextInput::q_canPasteChanged() #ifndef QT_NO_CLIPBOARD d->canPaste = !d->control->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; #endif - if(d->canPaste != old) + if (d->canPaste != old) emit canPasteChanged(); } diff --git a/src/declarative/items/qsgview.cpp b/src/declarative/items/qsgview.cpp index 7d9a451e338e0c062791a4e0a1e6af27f9732ca8..cd20f6c9734500c93b55203da3964aef9fc89bab 100644 --- a/src/declarative/items/qsgview.cpp +++ b/src/declarative/items/qsgview.cpp @@ -268,7 +268,7 @@ void QSGView::continueExecute() QObject *obj = d->component->create(); - if(d->component->isError()) { + if (d->component->isError()) { QList<QDeclarativeError> errorList = d->component->errors(); foreach (const QDeclarativeError &error, errorList) { qWarning() << error; diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index b359ba6722bfd65c53461904ddf51a4e7c5dde76..817738ad8a23b83c4f0950942691de5eee76402f 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -408,13 +408,13 @@ void tst_qdeclarativeimageprovider::threadTest() QList<QSGImage *> images = obj->findChildren<QSGImage *>(); QCOMPARE(images.count(), 4); QTest::qWait(100); - foreach(QSGImage *img, images) { + foreach (QSGImage *img, images) { QCOMPARE(img->status(), QSGImage::Loading); } provider->ok = true; provider->cond.wakeAll(); QTest::qWait(250); - foreach(QSGImage *img, images) { + foreach (QSGImage *img, images) { QTRY_VERIFY(img->status() == QSGImage::Ready); } } diff --git a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp index 7777b5c3b5b4f499a08adaa100816b6574691f5c..0920f0f65cdd358e02a8d7e38b1c583692ce9ce1 100644 --- a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp +++ b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp @@ -644,7 +644,7 @@ T *tst_qsgflickable::findItem(QSGItem *parent, const QString &objectName) //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp index 5d6cd47a6f8481b0b3f98ab5eb35ae95e6f70d4e..de191130a233a5522c28e00ad0062fa258c5ab43 100644 --- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp +++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp @@ -2066,14 +2066,14 @@ void tst_QSGGridView::mirroring() QCOMPARE(gridviewA->layoutDirection(), gridviewA->effectiveLayoutDirection()); // LTR != RTL - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QVERIFY(findItem<QSGItem>(gridviewA, objectName)->x() != findItem<QSGItem>(gridviewB, objectName)->x()); gridviewA->setProperty("layoutDirection", Qt::LeftToRight); gridviewB->setProperty("layoutDirection", Qt::LeftToRight); // LTR == LTR - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QCOMPARE(findItem<QSGItem>(gridviewA, objectName)->x(), findItem<QSGItem>(gridviewB, objectName)->x()); QVERIFY(gridviewB->layoutDirection() == gridviewB->effectiveLayoutDirection()); @@ -2081,25 +2081,25 @@ void tst_QSGGridView::mirroring() QVERIFY(gridviewB->layoutDirection() != gridviewB->effectiveLayoutDirection()); // LTR != LTR+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QVERIFY(findItem<QSGItem>(gridviewA, objectName)->x() != findItem<QSGItem>(gridviewB, objectName)->x()); gridviewA->setProperty("layoutDirection", Qt::RightToLeft); // RTL == LTR+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QCOMPARE(findItem<QSGItem>(gridviewA, objectName)->x(), findItem<QSGItem>(gridviewB, objectName)->x()); gridviewB->setProperty("layoutDirection", Qt::RightToLeft); // RTL != RTL+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QVERIFY(findItem<QSGItem>(gridviewA, objectName)->x() != findItem<QSGItem>(gridviewB, objectName)->x()); gridviewA->setProperty("layoutDirection", Qt::LeftToRight); // LTR == RTL+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QCOMPARE(findItem<QSGItem>(gridviewA, objectName)->x(), findItem<QSGItem>(gridviewB, objectName)->x()); delete canvasA; @@ -3290,7 +3290,7 @@ T *tst_QSGGridView::findItem(QSGItem *parent, const QString &objectName, int ind //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { @@ -3321,7 +3321,7 @@ QList<T*> tst_QSGGridView::findItems(QSGItem *parent, const QString &objectName) //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { @@ -3339,7 +3339,7 @@ void tst_QSGGridView::dumpTree(QSGItem *parent, int depth) static QString padding(" "); for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; QDeclarativeContext *context = QDeclarativeEngine::contextForObject(item); qDebug() << padding.left(depth*2) << item << (context ? context->contextProperty("index").toInt() : -1); diff --git a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp index 81f00e8aa4bb884cc8435611b9b0e913ae728961..fd22f486842eeafa71eea042edb6b5c702fcd649 100644 --- a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp +++ b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp @@ -669,7 +669,7 @@ T *tst_qsgimage::findItem(QSGItem *parent, const QString &objectName, int index) //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { diff --git a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp index 5949b7b76da807fc8544ac19c2ba06b320da11fb..c914d31783451bf52ef488ec4411a6d7d4761aed 100644 --- a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp +++ b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp @@ -84,7 +84,7 @@ protected: } public slots: - void doPolish() { + void doPolish() { polish(); } }; @@ -227,13 +227,13 @@ struct FocusState : public QHash<QSGItem *, FocusData> } else { \ QCOMPARE(canvas.activeFocusItem(), canvas.rootItem()); \ } \ - for(QHash<QSGItem *, FocusData>::Iterator iter = focusState.begin(); \ + for (QHash<QSGItem *, FocusData>::Iterator iter = focusState.begin(); \ iter != focusState.end(); \ iter++) { \ QCOMPARE(iter.key()->hasFocus(), iter.value().focus); \ QCOMPARE(iter.key()->hasActiveFocus(), iter.value().activeFocus); \ } \ - } while(false) + } while (false) // Tests a simple set of top-level scoped items void tst_qsgitem::simpleFocus() @@ -632,7 +632,7 @@ void tst_qsgitem::changeParent() focusState[item].set(false, false); FVERIFY(); } - + } void tst_qsgitem::constructor() diff --git a/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp index fd1f9cd37343356491d49a65922da4fd2065c97d..08a3071e5166685f310cadae72a94a9dff85032d 100644 --- a/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp +++ b/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp @@ -97,7 +97,7 @@ T *findItem(QSGItem *parent, const QString &objectName) //qDebug() << parent->QSGItem::children().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) @@ -496,7 +496,7 @@ void tst_QSGItem::layoutMirroring() QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, true); QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, true); QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, true); - + // // dynamic parenting // @@ -526,7 +526,7 @@ void tst_QSGItem::layoutMirroring() childItem2->setParentItem(parentItem2); QCOMPARE(QSGItemPrivate::get(childItem2)->effectiveLayoutMirror, false); QCOMPARE(QSGItemPrivate::get(childItem2)->inheritMirrorFromParent, false); - + delete parentItem1; delete parentItem2; } @@ -1024,7 +1024,7 @@ void tst_QSGItem::transforms() void tst_QSGItem::childrenProperty() { QDeclarativeComponent component(&engine, TESTDATA("childrenProperty.qml")); - + QObject *o = component.create(); QVERIFY(o != 0); @@ -1039,7 +1039,7 @@ void tst_QSGItem::childrenProperty() void tst_QSGItem::resourcesProperty() { QDeclarativeComponent component(&engine, TESTDATA("resourcesProperty.qml")); - + QObject *o = component.create(); QVERIFY(o != 0); diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp index fc1b7551ed40d7a0553d3ceb1ed8b46fc8fb7cce..c2a6920b48f0b8a2045cf13509461ce9811d5b27 100644 --- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp +++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp @@ -258,7 +258,7 @@ public: QList<int> roles() const { return QList<int>() << Name << Number; } QString toString(int role) const { - switch(role) { + switch (role) { case Name: return "name"; case Number: @@ -282,7 +282,7 @@ public: for (int i = 0; i < roles.size(); ++i) { int role = roles.at(i); QVariant info; - switch(role) { + switch (role) { case Name: info = list.at(index).first; break; @@ -3736,14 +3736,14 @@ void tst_QSGListView::test_mirroring() QCOMPARE(listviewA->layoutDirection(), listviewA->effectiveLayoutDirection()); // LTR != RTL - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QVERIFY(findItem<QSGItem>(listviewA, objectName)->x() != findItem<QSGItem>(listviewB, objectName)->x()); listviewA->setProperty("layoutDirection", Qt::LeftToRight); listviewB->setProperty("layoutDirection", Qt::LeftToRight); // LTR == LTR - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QCOMPARE(findItem<QSGItem>(listviewA, objectName)->x(), findItem<QSGItem>(listviewB, objectName)->x()); QVERIFY(listviewB->layoutDirection() == listviewB->effectiveLayoutDirection()); @@ -3751,25 +3751,25 @@ void tst_QSGListView::test_mirroring() QVERIFY(listviewB->layoutDirection() != listviewB->effectiveLayoutDirection()); // LTR != LTR+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QVERIFY(findItem<QSGItem>(listviewA, objectName)->x() != findItem<QSGItem>(listviewB, objectName)->x()); listviewA->setProperty("layoutDirection", Qt::RightToLeft); // RTL == LTR+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QCOMPARE(findItem<QSGItem>(listviewA, objectName)->x(), findItem<QSGItem>(listviewB, objectName)->x()); listviewB->setProperty("layoutDirection", Qt::RightToLeft); // RTL != RTL+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QVERIFY(findItem<QSGItem>(listviewA, objectName)->x() != findItem<QSGItem>(listviewB, objectName)->x()); listviewA->setProperty("layoutDirection", Qt::LeftToRight); // LTR == RTL+mirror - foreach(const QString objectName, objectNames) + foreach (const QString objectName, objectNames) QCOMPARE(findItem<QSGItem>(listviewA, objectName)->x(), findItem<QSGItem>(listviewB, objectName)->x()); delete canvasA; @@ -3799,7 +3799,7 @@ void tst_QSGListView::margins() QCOMPARE(listview->contentY(), -30.); QCOMPARE(listview->yOrigin(), 0.); - + // check end bound listview->positionViewAtEnd(); qreal pos = listview->contentY(); @@ -3821,7 +3821,7 @@ void tst_QSGListView::margins() listview->setTopMargin(20); QCOMPARE(listview->yOrigin(), 20.); QTRY_COMPARE(listview->contentY(), 0.); - + // check end bound listview->positionViewAtEnd(); pos = listview->contentY(); @@ -4096,7 +4096,7 @@ T *tst_QSGListView::findItem(QSGItem *parent, const QString &objectName, int ind //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { @@ -4124,7 +4124,7 @@ QList<T*> tst_QSGListView::findItems(QSGItem *parent, const QString &objectName) //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item || !item->isVisible()) + if (!item || !item->isVisible()) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) @@ -4140,7 +4140,7 @@ void tst_QSGListView::dumpTree(QSGItem *parent, int depth) static QString padding(" "); for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; qDebug() << padding.left(depth*2) << item; dumpTree(item, depth+1); diff --git a/tests/auto/declarative/qsgloader/tst_qsgloader.cpp b/tests/auto/declarative/qsgloader/tst_qsgloader.cpp index 4b0921f5268d8771358d5090ec8d173a99b2e6ca..7f307e01bdea69055be82df88e891f59de88d4dd 100644 --- a/tests/auto/declarative/qsgloader/tst_qsgloader.cpp +++ b/tests/auto/declarative/qsgloader/tst_qsgloader.cpp @@ -248,7 +248,7 @@ void tst_QSGLoader::clear() QSGItem *item = qobject_cast<QSGItem*>(component.create()); QVERIFY(item); - QSGLoader *loader = qobject_cast<QSGLoader*>(item->QSGItem::childItems().at(0)); + QSGLoader *loader = qobject_cast<QSGLoader*>(item->QSGItem::childItems().at(0)); QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); @@ -294,7 +294,7 @@ void tst_QSGLoader::componentToUrl() QSGItem *item = qobject_cast<QSGItem*>(component.create()); QVERIFY(item); - QSGLoader *loader = qobject_cast<QSGLoader*>(item->QSGItem::childItems().at(0)); + QSGLoader *loader = qobject_cast<QSGLoader*>(item->QSGItem::childItems().at(0)); QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); @@ -455,7 +455,7 @@ void tst_QSGLoader::networkComponent() QSGItem *item = qobject_cast<QSGItem*>(component.create()); QVERIFY(item); - QSGLoader *loader = qobject_cast<QSGLoader*>(item->QSGItem::children().at(1)); + QSGLoader *loader = qobject_cast<QSGLoader*>(item->QSGItem::children().at(1)); QVERIFY(loader); QTRY_VERIFY(loader->status() == QSGLoader::Ready); diff --git a/tests/auto/declarative/qsgpathview/qsgpathview.pro b/tests/auto/declarative/qsgpathview/qsgpathview.pro index 91520673f70e67ba2814bd74f18aa07ca1328e05..d4c237d168a0a7c9e8cc12d62d4b8c37764d6ab1 100644 --- a/tests/auto/declarative/qsgpathview/qsgpathview.pro +++ b/tests/auto/declarative/qsgpathview/qsgpathview.pro @@ -8,5 +8,5 @@ testDataFiles.files = data testDataFiles.path = . DEPLOYMENT += testDataFiles -CONFIG += parallel_test +CONFIG += parallel_test QT += core-private gui-private v8-private declarative-private widgets testlib diff --git a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp index 691a115cf5581be88d5195b60d01946e6729db48..c4648603cbbbc591b10a72f01bb80539728b9bef 100644 --- a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp +++ b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp @@ -514,7 +514,7 @@ void tst_QSGPathView::pathMoved() QCOMPARE(firstItem->pos() + offset, start); pathview->setOffset(1.0); - for(int i=0; i<model.count(); i++){ + for (int i=0; i<model.count(); i++) { QSGRectangle *curItem = findItem<QSGRectangle>(pathview, "wrapper", i); QPointF itemPos(path->pointAt(0.25 + i*0.25)); QCOMPARE(curItem->pos() + offset, QPointF(qRound(itemPos.x()), qRound(itemPos.y()))); @@ -1101,7 +1101,7 @@ T *tst_QSGPathView::findItem(QSGItem *parent, const QString &objectName, int ind //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { @@ -1129,7 +1129,7 @@ QList<T*> tst_QSGPathView::findItems(QSGItem *parent, const QString &objectName) //qDebug() << parent->QSGItem::children().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) diff --git a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp index 84225ca02a2e5895eafc08862e1dd154ac933605..3afc7dfb27c5261587b31e0e14efe251d88e506c 100644 --- a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp +++ b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp @@ -1283,7 +1283,7 @@ void tst_qsgpositioners::test_mirroring() QList<QString> objectNames; objectNames << "one" << "two" << "three" << "four" << "five"; - foreach(const QString qmlFile, qmlFiles) { + foreach (const QString qmlFile, qmlFiles) { QSGView *canvasA = createView(TESTDATA(qmlFile)); QSGItem *rootA = qobject_cast<QSGItem*>(canvasA->rootObject()); @@ -1293,7 +1293,7 @@ void tst_qsgpositioners::test_mirroring() rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft // LTR != RTL - foreach(const QString objectName, objectNames) { + foreach (const QString objectName, objectNames) { // horizontal.qml only has three items if (qmlFile == QString("horizontal.qml") && objectName == QString("four")) break; @@ -1310,7 +1310,7 @@ void tst_qsgpositioners::test_mirroring() rootPrivateB->resolveLayoutMirror(); // RTL == mirror - foreach(const QString objectName, objectNames) { + foreach (const QString objectName, objectNames) { // horizontal.qml only has three items if (qmlFile == QString("horizontal.qml") && objectName == QString("four")) break; @@ -1323,7 +1323,7 @@ void tst_qsgpositioners::test_mirroring() rootB->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft // LTR == RTL + mirror - foreach(const QString objectName, objectNames) { + foreach (const QString objectName, objectNames) { // horizontal.qml only has three items if (qmlFile == QString("horizontal.qml") && objectName == QString("four")) break; diff --git a/tests/auto/declarative/qsgrepeater/tst_qsgrepeater.cpp b/tests/auto/declarative/qsgrepeater/tst_qsgrepeater.cpp index cb8b81e69998599d10681f3a1e7f70cbae8212aa..40d7b77827ce1e4af037b365c11b898ba4c4be7c 100644 --- a/tests/auto/declarative/qsgrepeater/tst_qsgrepeater.cpp +++ b/tests/auto/declarative/qsgrepeater/tst_qsgrepeater.cpp @@ -215,7 +215,7 @@ void tst_QSGRepeater::objectList() { QSGView *canvas = createView(); QObjectList data; - for(int i=0; i<100; i++) + for (int i=0; i<100; i++) data << new MyObject(i); QDeclarativeContext *ctxt = canvas->rootContext(); @@ -651,7 +651,7 @@ T *tst_QSGRepeater::findItem(QObject *parent, const QString &objectName, int ind //qDebug() << parent->children().count() << "children"; for (int i = 0; i < parent->children().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->children().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { diff --git a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp index a59b00072a9f4524c7bc1825b125e3c797fdbc28..8dc32b2cc0081bd296d1c80f3beb5b8d20979707 100644 --- a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp +++ b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp @@ -83,7 +83,7 @@ private slots: void lineCount(); void lineHeight(); - // ### these tests may be trivial + // ### these tests may be trivial void horizontalAlignment(); void horizontalAlignment_RightToLeft(); void verticalAlignment(); @@ -781,7 +781,7 @@ void tst_qsgtext::font() delete textObject; } - { + { QString componentStr = "import QtQuick 2.0\nText { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -793,7 +793,7 @@ void tst_qsgtext::font() delete textObject; } - { + { QString componentStr = "import QtQuick 2.0\nText { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -805,7 +805,7 @@ void tst_qsgtext::font() delete textObject; } - { + { QString componentStr = "import QtQuick 2.0\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -818,7 +818,7 @@ void tst_qsgtext::font() delete textObject; } - { + { QString componentStr = "import QtQuick 2.0\nText { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -834,7 +834,7 @@ void tst_qsgtext::style() { //test style for (int i = 0; i < styles.size(); i++) - { + { QString componentStr = "import QtQuick 2.0\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -864,7 +864,7 @@ void tst_qsgtext::color() { //test style for (int i = 0; i < colorStrings.size(); i++) - { + { QString componentStr = "import QtQuick 2.0\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -877,7 +877,7 @@ void tst_qsgtext::color() } for (int i = 0; i < colorStrings.size(); i++) - { + { QString componentStr = "import QtQuick 2.0\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -889,9 +889,9 @@ void tst_qsgtext::color() delete textObject; } - + for (int i = 0; i < colorStrings.size(); i++) - { + { for (int j = 0; j < colorStrings.size(); j++) { QString componentStr = "import QtQuick 2.0\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; @@ -1288,7 +1288,7 @@ void tst_qsgtext::embeddedImages() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toLatin1()); - + QDeclarativeComponent textComponent(&engine, qmlfile); QSGText *textObject = qobject_cast<QSGText*>(textComponent.create()); diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp index 6ab4b93a2376b24bfaccd3ded869b5659255fb06..945b2d2c45adfd6c7c0bdcd992fab55296beb60b 100644 --- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp +++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp @@ -108,7 +108,7 @@ private slots: void alignments(); void alignments_data(); - // ### these tests may be trivial + // ### these tests may be trivial void hAlign(); void hAlign_RightToLeft(); void vAlign(); @@ -223,7 +223,7 @@ tst_qsgtextedit::tst_qsgtextedit() // need a different test to do alpha channel test // << "#AA0011DD" // << "#00F16B11"; - // + // } void tst_qsgtextedit::text() @@ -642,7 +642,7 @@ void tst_qsgtextedit::vAlign() void tst_qsgtextedit::font() { //test size, then bold, then italic, then family - { + { QString componentStr = "import QtQuick 2.0\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -654,7 +654,7 @@ void tst_qsgtextedit::font() QCOMPARE(textEditObject->font().italic(), false); } - { + { QString componentStr = "import QtQuick 2.0\nTextEdit { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -665,7 +665,7 @@ void tst_qsgtextedit::font() QCOMPARE(textEditObject->font().italic(), false); } - { + { QString componentStr = "import QtQuick 2.0\nTextEdit { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -676,7 +676,7 @@ void tst_qsgtextedit::font() QCOMPARE(textEditObject->font().bold(), false); } - { + { QString componentStr = "import QtQuick 2.0\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -688,7 +688,7 @@ void tst_qsgtextedit::font() QCOMPARE(textEditObject->font().italic(), false); } - { + { QString componentStr = "import QtQuick 2.0\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -720,7 +720,7 @@ void tst_qsgtextedit::color() } //test normal for (int i = 0; i < colorStrings.size(); i++) - { + { QString componentStr = "import QtQuick 2.0\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -769,7 +769,7 @@ void tst_qsgtextedit::color() void tst_qsgtextedit::textMargin() { - for(qreal i=0; i<=10; i+=0.3){ + for (qreal i=0; i<=10; i+=0.3) { QString componentStr = "import QtQuick 2.0\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); @@ -832,7 +832,7 @@ void tst_qsgtextedit::selection() //Test selection follows cursor - for(int i=0; i<= testStr.size(); i++) { + for (int i=0; i<= testStr.size(); i++) { textEditObject->setCursorPosition(i); QCOMPARE(textEditObject->cursorPosition(), i); QCOMPARE(textEditObject->selectionStart(), i); @@ -860,11 +860,11 @@ void tst_qsgtextedit::selection() QVERIFY(textEditObject->selectedText().isNull()); //Test selection - for(int i=0; i<= testStr.size(); i++) { + for (int i=0; i<= testStr.size(); i++) { textEditObject->select(0,i); QCOMPARE(testStr.mid(0,i), textEditObject->selectedText()); } - for(int i=0; i<= testStr.size(); i++) { + for (int i=0; i<= testStr.size(); i++) { textEditObject->select(i,testStr.size()); QCOMPARE(testStr.mid(i,testStr.size()-i), textEditObject->selectedText()); } @@ -1591,7 +1591,7 @@ void tst_qsgtextedit::cursorDelegate() QVERIFY(delegateObject); QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved - for(int i=0; i<= textEditObject->text().length(); i++){ + for (int i=0; i<= textEditObject->text().length(); i++) { textEditObject->setCursorPosition(i); QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); @@ -1899,7 +1899,7 @@ void tst_qsgtextedit::readOnly() QTRY_VERIFY(edit->hasActiveFocus() == true); QVERIFY(edit->isReadOnly() == true); QString initial = edit->text(); - for(int k=Qt::Key_0; k<=Qt::Key_Z; k++) + for (int k=Qt::Key_0; k<=Qt::Key_Z; k++) simulateKey(&canvas, k); simulateKey(&canvas, Qt::Key_Return); simulateKey(&canvas, Qt::Key_Space); diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index 5cc0f8ee62c28b7b7d5d1e70d93d89158ced10e7..618915134c665aabf68ebb08f4359f0e6c84aaea 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -276,7 +276,7 @@ void tst_qsgtextinput::width() void tst_qsgtextinput::font() { //test size, then bold, then italic, then family - { + { QString componentStr = "import QtQuick 2.0\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -290,7 +290,7 @@ void tst_qsgtextinput::font() delete textinputObject; } - { + { QString componentStr = "import QtQuick 2.0\nTextInput { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -303,7 +303,7 @@ void tst_qsgtextinput::font() delete textinputObject; } - { + { QString componentStr = "import QtQuick 2.0\nTextInput { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -315,8 +315,8 @@ void tst_qsgtextinput::font() delete textinputObject; } - - { + + { QString componentStr = "import QtQuick 2.0\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -330,7 +330,7 @@ void tst_qsgtextinput::font() delete textinputObject; } - { + { QString componentStr = "import QtQuick 2.0\nTextInput { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -347,7 +347,7 @@ void tst_qsgtextinput::color() { //test color for (int i = 0; i < colorStrings.size(); i++) - { + { QString componentStr = "import QtQuick 2.0\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -373,7 +373,7 @@ void tst_qsgtextinput::color() //test selected text color for (int i = 0; i < colorStrings.size(); i++) - { + { QString componentStr = "import QtQuick 2.0\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -412,7 +412,7 @@ void tst_qsgtextinput::selection() //Test selection follows cursor - for(int i=0; i<= testStr.size(); i++) { + for (int i=0; i<= testStr.size(); i++) { textinputObject->setCursorPosition(i); QCOMPARE(textinputObject->cursorPosition(), i); QCOMPARE(textinputObject->selectionStart(), i); @@ -440,11 +440,11 @@ void tst_qsgtextinput::selection() QVERIFY(textinputObject->selectedText().isNull()); //Test selection - for(int i=0; i<= testStr.size(); i++) { + for (int i=0; i<= testStr.size(); i++) { textinputObject->select(0,i); QCOMPARE(testStr.mid(0,i), textinputObject->selectedText()); } - for(int i=0; i<= testStr.size(); i++) { + for (int i=0; i<= testStr.size(); i++) { textinputObject->select(i,testStr.size()); QCOMPARE(testStr.mid(i,testStr.size()-i), textinputObject->selectedText()); } @@ -1324,7 +1324,7 @@ void tst_qsgtextinput::maxLength() QVERIFY(textinputObject != 0); QVERIFY(textinputObject->text().isEmpty()); QVERIFY(textinputObject->maxLength() == 10); - foreach(const QString &str, standard){ + foreach (const QString &str, standard) { QVERIFY(textinputObject->text().length() <= 10); textinputObject->setText(str); QVERIFY(textinputObject->text().length() <= 10); @@ -1332,7 +1332,7 @@ void tst_qsgtextinput::maxLength() textinputObject->setText(""); QTRY_VERIFY(textinputObject->hasActiveFocus() == true); - for(int i=0; i<20; i++){ + for (int i=0; i<20; i++) { QTRY_COMPARE(textinputObject->text().length(), qMin(i,10)); //simulateKey(&canvas, Qt::Key_A); QTest::keyPress(&canvas, Qt::Key_A); @@ -1354,7 +1354,7 @@ void tst_qsgtextinput::masks() QTRY_VERIFY(textinputObject->hasActiveFocus() == true); QVERIFY(textinputObject->text().length() == 0); QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); - for(int i=0; i<10; i++){ + for (int i=0; i<10; i++) { QTRY_COMPARE(qMin(i,8), textinputObject->text().length()); QCOMPARE(i>=4, textinputObject->hasAcceptableInput()); //simulateKey(&canvas, Qt::Key_A); @@ -1745,7 +1745,7 @@ void tst_qsgtextinput::cursorDelegate() QVERIFY(delegateObject); QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved - for(int i=0; i<= textInputObject->text().length(); i++){ + for (int i=0; i<= textInputObject->text().length(); i++) { textInputObject->setCursorPosition(i); QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x())); QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y())); @@ -1890,7 +1890,7 @@ void tst_qsgtextinput::readOnly() QTRY_VERIFY(input->hasActiveFocus() == true); QVERIFY(input->isReadOnly() == true); QString initial = input->text(); - for(int k=Qt::Key_0; k<=Qt::Key_Z; k++) + for (int k=Qt::Key_0; k<=Qt::Key_Z; k++) simulateKey(&canvas, k); simulateKey(&canvas, Qt::Key_Return); simulateKey(&canvas, Qt::Key_Space); diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp index 33558fe8a2c4e6c39b6ba87a2fda6d3ceff557a5..d9fec3f8b3e1217ec6f2cf5d4b386e8f2459bad4 100644 --- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp +++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp @@ -1531,7 +1531,7 @@ T *tst_qsgvisualdatamodel::findItem(QSGItem *parent, const QString &objectName, //qDebug() << parent->childItems().count() << "children"; for (int i = 0; i < parent->childItems().count(); ++i) { QSGItem *item = qobject_cast<QSGItem*>(parent->childItems().at(i)); - if(!item) + if (!item) continue; //qDebug() << "try" << item; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {