summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/canvas/qsimplecanvas.cpp194
-rw-r--r--src/declarative/canvas/qsimplecanvas.h2
-rw-r--r--src/declarative/canvas/qsimplecanvas_graphicsview.cpp28
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl.cpp70
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl1.cpp50
-rw-r--r--src/declarative/canvas/qsimplecanvas_p.h2
-rw-r--r--src/declarative/canvas/qsimplecanvas_software.cpp36
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter.cpp26
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.cpp394
-rw-r--r--src/declarative/canvas/qsimplecanvasitem_p.h2
-rw-r--r--src/declarative/canvas/qsimplecanvasserver.cpp8
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp2
-rw-r--r--src/declarative/fx/qfxanchors.cpp10
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp20
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp24
-rw-r--r--src/declarative/fx/qfxblurfilter.cpp16
-rw-r--r--src/declarative/fx/qfxcomponentinstance.cpp14
-rw-r--r--src/declarative/fx/qfxcontentwrapper.cpp2
-rw-r--r--src/declarative/fx/qfxflickable.cpp92
-rw-r--r--src/declarative/fx/qfxflipable.cpp24
-rw-r--r--src/declarative/fx/qfxfocuspanel.cpp2
-rw-r--r--src/declarative/fx/qfxgridview.cpp4
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp20
-rw-r--r--src/declarative/fx/qfximage.cpp84
-rw-r--r--src/declarative/fx/qfximage_p.h2
-rw-r--r--src/declarative/fx/qfximageitem.cpp8
-rw-r--r--src/declarative/fx/qfxitem.cpp88
-rw-r--r--src/declarative/fx/qfxitem_p.h6
-rw-r--r--src/declarative/fx/qfxkeyactions.cpp38
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp12
-rw-r--r--src/declarative/fx/qfxlayouts.cpp106
-rw-r--r--src/declarative/fx/qfxlistview.cpp6
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp32
-rw-r--r--src/declarative/fx/qfxparticles.cpp8
-rw-r--r--src/declarative/fx/qfxpath.cpp42
-rw-r--r--src/declarative/fx/qfxpathview.cpp58
-rw-r--r--src/declarative/fx/qfxpixmap.cpp20
-rw-r--r--src/declarative/fx/qfxrect.cpp52
-rw-r--r--src/declarative/fx/qfxrect_p.h2
-rw-r--r--src/declarative/fx/qfxreflectionfilter.cpp16
-rw-r--r--src/declarative/fx/qfxrepeater.cpp20
-rw-r--r--src/declarative/fx/qfxscalegrid.cpp16
-rw-r--r--src/declarative/fx/qfxshadowfilter.cpp4
-rw-r--r--src/declarative/fx/qfxtext.cpp34
-rw-r--r--src/declarative/fx/qfxtext_p.h2
-rw-r--r--src/declarative/fx/qfxtextedit.cpp4
-rw-r--r--src/declarative/fx/qfxtransform.cpp40
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp80
-rw-r--r--src/declarative/fx/qfxwebview.cpp12
-rw-r--r--src/declarative/fx/qfxwidgetcontainer.cpp8
-rw-r--r--src/declarative/opengl/glbasicshaders.cpp30
-rw-r--r--src/declarative/opengl/glsave.h2
-rw-r--r--src/declarative/opengl/gltexture.cpp36
-rw-r--r--src/declarative/qml/parser/javascriptlexer.cpp2
-rw-r--r--src/declarative/qml/qml.h4
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp30
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp12
-rw-r--r--src/declarative/qml/qmlcompiledcomponent.cpp24
-rw-r--r--src/declarative/qml/qmlcompiler.cpp364
-rw-r--r--src/declarative/qml/qmlcomponent.cpp42
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp54
-rw-r--r--src/declarative/qml/qmlcontext.cpp32
-rw-r--r--src/declarative/qml/qmldom.cpp98
-rw-r--r--src/declarative/qml/qmlengine.cpp138
-rw-r--r--src/declarative/qml/qmlinfo.cpp2
-rw-r--r--src/declarative/qml/qmlinstruction.cpp2
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp220
-rw-r--r--src/declarative/qml/qmlmetatype.cpp108
-rw-r--r--src/declarative/qml/qmlmetatype.h4
-rw-r--r--src/declarative/qml/qmlparser.cpp20
-rw-r--r--src/declarative/qml/qmlprivate.h6
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp18
-rw-r--r--src/declarative/qml/qmlrefcount.cpp2
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp6
-rw-r--r--src/declarative/qml/qmlstringconverters.cpp34
-rw-r--r--src/declarative/qml/qmlvme.cpp128
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp22
-rw-r--r--src/declarative/qml/qmlxmlparser.cpp34
-rw-r--r--src/declarative/qml/script/generator/main.cpp12
-rw-r--r--src/declarative/qml/script/qmlbasicscript.cpp108
-rw-r--r--src/declarative/test/qfxtestengine.cpp90
-rw-r--r--src/declarative/test/qfxtestobjects.cpp32
-rw-r--r--src/declarative/timeline/qmltimeline.cpp126
-rw-r--r--src/declarative/timeline/qmltimelinevalueproxy.h4
-rw-r--r--src/declarative/util/qfxglobal.h4
-rw-r--r--src/declarative/util/qfxview.cpp22
-rw-r--r--src/declarative/util/qmlanimation.cpp252
-rw-r--r--src/declarative/util/qmlbehaviour.cpp10
-rw-r--r--src/declarative/util/qmlbind.cpp2
-rw-r--r--src/declarative/util/qmlconnection.cpp4
-rw-r--r--src/declarative/util/qmllistaccessor.cpp12
-rw-r--r--src/declarative/util/qmllistmodel.cpp78
-rw-r--r--src/declarative/util/qmlopenmetaobject.cpp22
-rw-r--r--src/declarative/util/qmlpackage.cpp12
-rw-r--r--src/declarative/util/qmlscript.cpp2
-rw-r--r--src/declarative/util/qmlsetproperties.cpp10
-rw-r--r--src/declarative/util/qmlstate.cpp66
-rw-r--r--src/declarative/util/qmlstategroup.cpp70
-rw-r--r--src/declarative/util/qmlstateoperations.cpp16
-rw-r--r--src/declarative/util/qmltransition.cpp6
-rw-r--r--src/declarative/util/qperformancelog.cpp20
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp6
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp6
103 files changed, 2154 insertions, 2154 deletions
diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp
index 572bc43..1911b35 100644
--- a/src/declarative/canvas/qsimplecanvas.cpp
+++ b/src/declarative/canvas/qsimplecanvas.cpp
@@ -73,7 +73,7 @@ public:
{
int entry = (_first + _size) % s;
_array[entry] = t;
- if(_size == s)
+ if (_size == s)
_first = (_first + 1) % s;
else
_size++;
@@ -127,14 +127,14 @@ void QSimpleCanvasRootLayer::remDirty(QSimpleCanvasItem *i)
void QSimpleCanvasPrivate::clearFocusPanel(QSimpleCanvasItem *panel)
{
- if(q->activeFocusPanel() == panel) {
+ if (q->activeFocusPanel() == panel) {
focusPanels.pop();
switchToFocusPanel(q->activeFocusPanel(), panel, Qt::OtherFocusReason);
panel->activePanelOutEvent();
} else {
- for(int ii = 0; ii < focusPanels.count(); ++ii)
- if(focusPanels.at(ii) == panel) {
+ for (int ii = 0; ii < focusPanels.count(); ++ii)
+ if (focusPanels.at(ii) == panel) {
focusPanels.remove(ii);
break;
}
@@ -143,35 +143,35 @@ void QSimpleCanvasPrivate::clearFocusPanel(QSimpleCanvasItem *panel)
void QSimpleCanvasPrivate::switchToFocusPanel(QSimpleCanvasItem *panel, QSimpleCanvasItem *wasPanel, Qt::FocusReason focusReason)
{
- if(panel)
+ if (panel)
panel->activePanelInEvent();
QSimpleCanvasItem *wasFocusRoot = focusPanelData.value(wasPanel);
- if(wasFocusRoot)
+ if (wasFocusRoot)
clearActiveFocusItem(wasFocusRoot, focusReason);
QSimpleCanvasItem *newFocusRoot = focusPanelData.value(panel);
- if(newFocusRoot)
+ if (newFocusRoot)
setFocusItem(newFocusRoot, focusReason);
}
void QSimpleCanvasPrivate::setActiveFocusPanel(QSimpleCanvasItem *panel, Qt::FocusReason focusReason)
{
- if(q->activeFocusPanel() == panel)
+ if (q->activeFocusPanel() == panel)
return;
- if(panel) {
- for(int ii = 0; ii < focusPanels.count(); ++ii)
- if(focusPanels.at(ii) == panel) {
+ if (panel) {
+ for (int ii = 0; ii < focusPanels.count(); ++ii)
+ if (focusPanels.at(ii) == panel) {
focusPanels.remove(ii);
break;
}
}
QSimpleCanvasItem *old = q->activeFocusPanel();
- if(panel)
+ if (panel)
focusPanels << panel;
switchToFocusPanel(panel, old, focusReason);
- if(old)
+ if (old)
old->activePanelOutEvent();
}
@@ -181,13 +181,13 @@ void QSimpleCanvasPrivate::clearActiveFocusItem(QSimpleCanvasItem *item,
if (!item || !item->d_func())
return;
- if(!item->d_func()->hasActiveFocus)
+ if (!item->d_func()->hasActiveFocus)
return;
item->d_func()->hasActiveFocus = false;
- if(item->options() & QSimpleCanvasItem::IsFocusRealm) {
+ if (item->options() & QSimpleCanvasItem::IsFocusRealm) {
QSimpleCanvasItem *newItem = focusPanelData.value(item);
- if(newItem) {
+ if (newItem) {
clearActiveFocusItem(newItem, focusReason);
} else {
focusItem = 0;
@@ -200,8 +200,8 @@ void QSimpleCanvasPrivate::clearActiveFocusItem(QSimpleCanvasItem *item,
item->focusOutEvent(&event);
}
- if(item->options() & QSimpleCanvasItem::AcceptsInputMethods){
- if(q->testAttribute(Qt::WA_InputMethodEnabled))
+ if (item->options() & QSimpleCanvasItem::AcceptsInputMethods){
+ if (q->testAttribute(Qt::WA_InputMethodEnabled))
q->setAttribute(Qt::WA_InputMethodEnabled,false);
}
item->activeFocusChanged(true);
@@ -213,9 +213,9 @@ void QSimpleCanvasPrivate::setActiveFocusItem(QSimpleCanvasItem *item,
while(true) {
item->d_func()->setActiveFocus(true);
item->activeFocusChanged(true);
- if(item->options() & QSimpleCanvasItem::IsFocusRealm) {
+ if (item->options() & QSimpleCanvasItem::IsFocusRealm) {
QSimpleCanvasItem *newItem = focusPanelData.value(item);
- if(newItem)
+ if (newItem)
item = newItem;
else
break;
@@ -224,8 +224,8 @@ void QSimpleCanvasPrivate::setActiveFocusItem(QSimpleCanvasItem *item,
}
}
- if(item->options() & QSimpleCanvasItem::AcceptsInputMethods){
- if(!q->testAttribute(Qt::WA_InputMethodEnabled))
+ if (item->options() & QSimpleCanvasItem::AcceptsInputMethods){
+ if (!q->testAttribute(Qt::WA_InputMethodEnabled))
q->setAttribute(Qt::WA_InputMethodEnabled,true);
}
focusItem = item;
@@ -244,9 +244,9 @@ void QSimpleCanvasPrivate::clearFocusItem(QSimpleCanvasItem *item)
QSimpleCanvasItem *scope = 0;
QSimpleCanvasItem *citem = item;
while(citem && !scope) {
- if(citem->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (citem->options() & QSimpleCanvasItem::IsFocusPanel)
scope = citem;
- else if(citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
scope = citem;
citem = citem->parent();
}
@@ -254,23 +254,23 @@ void QSimpleCanvasPrivate::clearFocusItem(QSimpleCanvasItem *item)
bool isActive = false;
- if(scope->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (scope->options() & QSimpleCanvasItem::IsFocusPanel)
isActive = (scope == q->activeFocusPanel());
- else if(scope->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (scope->options() & QSimpleCanvasItem::IsFocusRealm)
isActive = scope->hasActiveFocus();
- if(isActive) clearActiveFocusItem(item, Qt::OtherFocusReason);
+ if (isActive) clearActiveFocusItem(item, Qt::OtherFocusReason);
item->d_func()->setFocus(false);
item->focusChanged(false);
focusPanelData.insert(scope, 0);
- if(lastFocusItem == item)
+ if (lastFocusItem == item)
lastFocusItem = 0;
- if(focusItem == item)
+ if (focusItem == item)
focusItem = 0;
- if(scope->options() & QSimpleCanvasItem::IsFocusRealm && scope->hasActiveFocus()) {
+ if (scope->options() & QSimpleCanvasItem::IsFocusRealm && scope->hasActiveFocus()) {
setActiveFocusItem(scope, Qt::OtherFocusReason);
} else {
QSimpleCanvasItem *item = QSimpleCanvasItem::findNextFocus(scope);
@@ -291,21 +291,21 @@ void QSimpleCanvasPrivate::setFocusItem(QSimpleCanvasItem *item,
item = item->focusProxy();
#endif
- if(item == focusItem)
+ if (item == focusItem)
return;
QSimpleCanvasItem *scope = 0;
QSimpleCanvasItem *citem = item;
while(citem && !scope) {
- if(citem->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (citem->options() & QSimpleCanvasItem::IsFocusPanel)
scope = citem;
- else if(citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
scope = citem;
citem = citem->parent();
}
Q_ASSERT(scope); // At the very least we'll find the canvas root
- if(!overwrite && focusPanelData.contains(scope)) {
+ if (!overwrite && focusPanelData.contains(scope)) {
item->d_func()->setFocus(false);
item->focusChanged(false);
return;
@@ -314,26 +314,26 @@ void QSimpleCanvasPrivate::setFocusItem(QSimpleCanvasItem *item,
QSimpleCanvasItem *oldFocus = focusPanelData.value(scope);
bool isActive = false;
- if(scope->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (scope->options() & QSimpleCanvasItem::IsFocusPanel)
isActive = (scope == q->activeFocusPanel());
- else if(scope->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (scope->options() & QSimpleCanvasItem::IsFocusRealm)
isActive = scope->hasActiveFocus();
- if(oldFocus) {
- if(isActive) clearActiveFocusItem(oldFocus, focusReason);
+ if (oldFocus) {
+ if (isActive) clearActiveFocusItem(oldFocus, focusReason);
oldFocus->d_func()->setFocus(false);
oldFocus->focusChanged(false);
}
focusPanelData.insert(scope, item);
- if(isActive)
+ if (isActive)
lastFocusItem = item;
if (item) {
item->d_func()->setFocus(true);
item->focusChanged(true);
- if(isActive)
+ if (isActive)
setActiveFocusItem(item, focusReason);
}
}
@@ -351,8 +351,8 @@ bool QSimpleCanvas::eventFilter(QObject *obj, QEvent *event)
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseRelease: {
//same logic as filter() function
- for(int ii = 0; ii < d->mouseFilters.count(); ++ii) {
- if(d->mouseFilters.at(ii)->mouseFilter((QGraphicsSceneMouseEvent*)event))
+ for (int ii = 0; ii < d->mouseFilters.count(); ++ii) {
+ if (d->mouseFilters.at(ii)->mouseFilter((QGraphicsSceneMouseEvent*)event))
return true;
}
break;
@@ -375,12 +375,12 @@ void QSimpleCanvasPrivate::removeMouseFilter(QSimpleCanvasItem *item)
bool QSimpleCanvasPrivate::filter(QMouseEvent *e)
{
- if(mouseFilters.isEmpty())
+ if (mouseFilters.isEmpty())
return false;
QGraphicsSceneMouseEvent *me = mouseEventToSceneMouseEvent(e, e->pos());
- for(int ii = 0; ii < mouseFilters.count(); ++ii) {
- if(mouseFilters.at(ii)->mouseFilter(me)) {
+ for (int ii = 0; ii < mouseFilters.count(); ++ii) {
+ if (mouseFilters.at(ii)->mouseFilter(me)) {
delete me;
return true;
}
@@ -420,36 +420,36 @@ QGraphicsSceneMouseEvent *QSimpleCanvasPrivate::mouseEventToSceneMouseEvent(QMou
bool QSimpleCanvasPrivate::deliverMousePress(QSimpleCanvasItem *base, QMouseEvent *e, bool seenChildFilter)
{
- if(base->clipType()) {
+ if (base->clipType()) {
QRectF br = base->boundingRect();
QPointF pos = base->mapFromScene(e->pos());
- if(!br.contains(pos.toPoint()))
+ if (!br.contains(pos.toPoint()))
return false;
}
const QList<QSimpleCanvasItem *> &children = base->d_func()->children;
- if(base->options() & QSimpleCanvasItem::ChildMouseFilter)
+ if (base->options() & QSimpleCanvasItem::ChildMouseFilter)
seenChildFilter = true;
- for(int ii = children.count() - 1; ii >= 0; --ii) {
- if(children.at(ii)->visible() != 0.)
- if(deliverMousePress(children.at(ii), e, seenChildFilter))
+ for (int ii = children.count() - 1; ii >= 0; --ii) {
+ if (children.at(ii)->visible() != 0.)
+ if (deliverMousePress(children.at(ii), e, seenChildFilter))
return true;
}
- if(base->acceptedMouseButtons() & e->button() || base->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (base->acceptedMouseButtons() & e->button() || base->options() & QSimpleCanvasItem::ChildMouseFilter) {
QRectF br = base->boundingRect();
QPoint pos = base->mapFromScene(e->pos()).toPoint();
- if(br.contains(pos)) {
+ if (br.contains(pos)) {
QGraphicsSceneMouseEvent *me = mouseEventToSceneMouseEvent(e, pos);
sendMouseEvent(base, me);
bool isAccepted = me->isAccepted();
delete me;
- if(isAccepted) {
+ if (isAccepted) {
lastMouseItem = base;
return true;
}
@@ -463,8 +463,8 @@ void QSimpleCanvasPrivate::sendMouseEvent(QSimpleCanvasItem *item, QGraphicsScen
{
QSimpleCanvasItem *p = item->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(e))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(e))
return;
}
p = p->parent();
@@ -533,7 +533,7 @@ void QSimpleCanvasGraphicsView::paintEvent(QPaintEvent *pe)
int frametimer = canvas->frameTimer.elapsed();
gfxCanvasTiming.append(QSimpleCanvasTiming(r, frametimer, canvas->lrpTime, tbf));
canvas->lrpTime = 0;
- if(canvas->canvasServer)
+ if (canvas->canvasServer)
canvas->canvasServer->addTiming(canvas->lrpTime, frametimer, tbf);
}
@@ -563,20 +563,20 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode)
{
this->mode = mode;
- if(mode == QSimpleCanvas::SimpleCanvas)
+ if (mode == QSimpleCanvas::SimpleCanvas)
qWarning("QSimpleCanvas: Using simple canvas");
else
qWarning("QSimpleCanvas: Using GraphicsView canvas");
- if(fullUpdate())
+ if (fullUpdate())
qWarning("QSimpleCanvas: Full update enabled");
- if(continuousUpdate())
+ if (continuousUpdate())
qWarning("QSimpleCanvas: Continuous update enabled");
QByteArray env = qgetenv("GFX_CANVAS_SERVER_PORT");
- if(!env.isEmpty()){
+ if (!env.isEmpty()){
int port = env.toInt();
- if(port >= 1024)
+ if (port >= 1024)
canvasServer = new QSimpleCanvasServer(port, q);
}
@@ -584,7 +584,7 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode)
root->setActiveFocusPanel(true);
q->setFocusPolicy(Qt::StrongFocus);
- if(mode == QSimpleCanvas::GraphicsView) {
+ if (mode == QSimpleCanvas::GraphicsView) {
view = new QSimpleCanvasGraphicsView(this);
QHBoxLayout *layout = new QHBoxLayout(q);
layout->setSpacing(0);
@@ -621,7 +621,7 @@ QSimpleCanvas::~QSimpleCanvas()
void QSimpleCanvasPrivate::paint(QPainter &p)
{
#if defined(QFX_RENDER_QPAINTER)
- if(!isSetup)
+ if (!isSetup)
root->d_func()->setupPainting(0, q->rect());
lrpTimer.start();
@@ -660,7 +660,7 @@ void QSimpleCanvas::keyReleaseEvent(QKeyEvent *event)
void QSimpleCanvas::inputMethodEvent(QInputMethodEvent *event)
{
- if(d->focusItem)
+ if (d->focusItem)
d->focusItem->inputMethodEvent(event);
else
QWidget::inputMethodEvent(event);
@@ -668,14 +668,14 @@ void QSimpleCanvas::inputMethodEvent(QInputMethodEvent *event)
QVariant QSimpleCanvas::inputMethodQuery(Qt::InputMethodQuery query) const
{
- if(d->focusItem)
+ if (d->focusItem)
return d->focusItem->inputMethodQuery(query);
return QWidget::inputMethodQuery(query);
}
void QSimpleCanvas::mousePressEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() &&
+ if (d->isSimpleCanvas() &&
(d->filter(e) || d->deliverMousePress(d->root, e))) {
e->accept();
} else {
@@ -685,7 +685,7 @@ void QSimpleCanvas::mousePressEvent(QMouseEvent *e)
void QSimpleCanvas::mouseDoubleClickEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() &&
+ if (d->isSimpleCanvas() &&
(d->filter(e) || d->deliverMousePress(d->root, e))) {
e->accept();
} else {
@@ -695,9 +695,9 @@ void QSimpleCanvas::mouseDoubleClickEvent(QMouseEvent *e)
void QSimpleCanvas::mouseMoveEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() && d->filter(e)) {
+ if (d->isSimpleCanvas() && d->filter(e)) {
e->accept();
- } else if(d->isSimpleCanvas() && d->lastMouseItem) {
+ } else if (d->isSimpleCanvas() && d->lastMouseItem) {
QPoint p = d->lastMouseItem->mapFromScene(e->pos()).toPoint();
QGraphicsSceneMouseEvent *me = d->mouseEventToSceneMouseEvent(e, p);
d->sendMouseEvent(d->lastMouseItem, me);
@@ -710,9 +710,9 @@ void QSimpleCanvas::mouseMoveEvent(QMouseEvent *e)
void QSimpleCanvas::mouseReleaseEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() && d->filter(e)) {
+ if (d->isSimpleCanvas() && d->filter(e)) {
e->accept();
- } else if(d->isSimpleCanvas() && d->lastMouseItem) {
+ } else if (d->isSimpleCanvas() && d->lastMouseItem) {
QPoint p = d->lastMouseItem->mapFromScene(e->pos()).toPoint();
QGraphicsSceneMouseEvent *me = d->mouseEventToSceneMouseEvent(e, p);
d->sendMouseEvent(d->lastMouseItem, me);
@@ -734,7 +734,7 @@ void QSimpleCanvas::focusInEvent(QFocusEvent *event)
} else {
QSimpleCanvasItem *panel = activeFocusPanel();
QSimpleCanvasItem *focusItem = 0;
- if(panel->isFocusable())
+ if (panel->isFocusable())
focusItem = panel;
else
focusItem = QSimpleCanvasItem::findNextFocus(panel);
@@ -775,7 +775,7 @@ bool QSimpleCanvas::focusNextPrevChild(bool)
QSimpleCanvasItem *panel = activeFocusPanel();
QSimpleCanvasItem *item = 0;
- if(panel->isFocusable())
+ if (panel->isFocusable())
item = panel;
else
item = next ? QSimpleCanvasItem::findNextFocus(panel) : QSimpleCanvasItem::findPrevFocus(panel);
@@ -798,7 +798,7 @@ void QSimpleCanvas::showEvent(QShowEvent *e)
#if defined(QFX_RENDER_OPENGL)
d->egl.resize(width(), height());
#endif
- if(d->isGraphicsView())
+ if (d->isGraphicsView())
d->view->setSceneRect(rect());
QWidget::showEvent(e);
@@ -809,7 +809,7 @@ void QSimpleCanvas::resizeEvent(QResizeEvent *e)
#if defined(QFX_RENDER_OPENGL)
d->egl.resize(width(), height());
#endif
- if(d->isGraphicsView())
+ if (d->isGraphicsView())
d->view->setSceneRect(rect());
QWidget::resizeEvent(e);
}
@@ -822,7 +822,7 @@ void QSimpleCanvas::remDirty(QSimpleCanvasItem *c)
void QSimpleCanvas::queueUpdate()
{
- if(!d->timer) {
+ if (!d->timer) {
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
d->timer = 1;
}
@@ -831,15 +831,15 @@ void QSimpleCanvas::queueUpdate()
void QSimpleCanvas::addDirty(QSimpleCanvasItem *c)
{
queueUpdate();
- if(d->isSimpleCanvas()) {
+ if (d->isSimpleCanvas()) {
d->oldDirty |= c->d_func()->data()->lastPaintRect;
#if defined(QFX_RENDER_OPENGL)
// Check for filters
QSimpleCanvasItem *fi = c->parent();
while(fi) {
- if(fi->d_func()->data()->dirty) {
+ if (fi->d_func()->data()->dirty) {
break;
- } else if(fi->filter()) {
+ } else if (fi->filter()) {
fi->update();
break;
}
@@ -853,14 +853,14 @@ void QSimpleCanvas::addDirty(QSimpleCanvasItem *c)
QRect QSimpleCanvasPrivate::dirtyItemClip() const
{
QRect rv;
- if(isSimpleCanvas()) {
+ if (isSimpleCanvas()) {
#if defined(QFX_RENDER_OPENGL)
QRectF r;
- for(int ii = 0; ii < dirtyItems.count(); ++ii)
+ for (int ii = 0; ii < dirtyItems.count(); ++ii)
r |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect;
rv = egl.map(r);
#else
- for(int ii = 0; ii < dirtyItems.count(); ++ii)
+ for (int ii = 0; ii < dirtyItems.count(); ++ii)
rv |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect;
#endif
}
@@ -869,7 +869,7 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const
QRegion QSimpleCanvasPrivate::resetDirty()
{
- if(isSimpleCanvas()) {
+ if (isSimpleCanvas()) {
#if defined(QFX_RENDER_OPENGL)
QRect r = egl.map(oldDirty) | dirtyItemClip();
#else
@@ -877,12 +877,12 @@ QRegion QSimpleCanvasPrivate::resetDirty()
#endif
if (!r.isEmpty())
r.adjust(-1,-1,2,2); //make sure we get everything (since we rounded from floats to ints)
- for(int ii = 0; ii < dirtyItems.count(); ++ii)
+ for (int ii = 0; ii < dirtyItems.count(); ++ii)
static_cast<QSimpleCanvasItemPrivate*>(dirtyItems.at(ii)->d_ptr)->data()->dirty = false;
dirtyItems.clear();
oldDirty = QRect();
- if(fullUpdate())
+ if (fullUpdate())
return QRegion();
else
return QRegion(r);
@@ -898,7 +898,7 @@ QSimpleCanvasItem *QSimpleCanvas::focusItem() const
QSimpleCanvasItem *QSimpleCanvas::activeFocusPanel() const
{
- if(d->focusPanels.isEmpty())
+ if (d->focusPanels.isEmpty())
return 0;
else
return d->focusPanels.top();
@@ -906,7 +906,7 @@ QSimpleCanvasItem *QSimpleCanvas::activeFocusPanel() const
bool QSimpleCanvas::event(QEvent *e)
{
- if(e->type() == QEvent::User && d->isSimpleCanvas()) {
+ if (e->type() == QEvent::User && d->isSimpleCanvas()) {
d->timer = 0;
d->isSetup = true;
#if defined(QFX_RENDER_OPENGL1)
@@ -921,7 +921,7 @@ bool QSimpleCanvas::event(QEvent *e)
int tbf = d->frameTimer.restart();
#if defined(QFX_RENDER_QPAINTER)
- if(r.isEmpty() || fullUpdate())
+ if (r.isEmpty() || fullUpdate())
repaint();
else
repaint(r);
@@ -930,7 +930,7 @@ bool QSimpleCanvas::event(QEvent *e)
QRect br = r.boundingRect();
QRect nr(br.x(), height() - br.y() - br.height(), br.width(), br.height());
- if(r.isEmpty() || fullUpdate())
+ if (r.isEmpty() || fullUpdate())
d->egl.updateGL();
else
d->egl.updateGL(nr);
@@ -940,10 +940,10 @@ bool QSimpleCanvas::event(QEvent *e)
int frametimer = d->frameTimer.elapsed();
gfxCanvasTiming.append(QSimpleCanvasTiming(r, frametimer, d->lrpTime, tbf));
- if(d->canvasServer)
+ if (d->canvasServer)
d->canvasServer->addTiming(d->lrpTime, frametimer, tbf);
d->lrpTime = 0;
- if(continuousUpdate())
+ if (continuousUpdate())
queueUpdate();
return true;
@@ -955,7 +955,7 @@ bool QSimpleCanvas::event(QEvent *e)
void QSimpleCanvas::paintEvent(QPaintEvent *)
{
#if defined(QFX_RENDER_QPAINTER)
- if(d->mode == SimpleCanvas) {
+ if (d->mode == SimpleCanvas) {
QPainter p(this);
d->paint(p);
}
@@ -964,7 +964,7 @@ void QSimpleCanvas::paintEvent(QPaintEvent *)
void QSimpleCanvas::dumpTiming()
{
- for(int ii = 0; ii < gfxCanvasTiming.size(); ++ii) {
+ for (int ii = 0; ii < gfxCanvasTiming.size(); ++ii) {
const QSimpleCanvasTiming &t = gfxCanvasTiming[ii];
qreal repaintFps = 1000. / qreal(t.time);
@@ -985,9 +985,9 @@ void QSimpleCanvas::dumpItems()
void QSimpleCanvas::checkState()
{
- if(d->isSimpleCanvas()) {
+ if (d->isSimpleCanvas()) {
QSimpleCanvasItemPrivate::FocusStateCheckRDatas r;
- if(d->root->d_func()->checkFocusState(0, &r))
+ if (d->root->d_func()->checkFocusState(0, &r))
qWarning() << "State OK";
}
}
@@ -997,7 +997,7 @@ void QSimpleCanvas::checkState()
*/
QImage QSimpleCanvas::asImage() const
{
- if(d->isSimpleCanvas()) {
+ if (d->isSimpleCanvas()) {
#if defined(QFX_RENDER_QPAINTER)
QImage img(width(),height(),QImage::Format_RGB32);
QPainter p(&img);
diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h
index 3da7251..a35cbf5 100644
--- a/src/declarative/canvas/qsimplecanvas.h
+++ b/src/declarative/canvas/qsimplecanvas.h
@@ -100,7 +100,7 @@ namespace QSimpleCanvasConfig
(type == Translucent && f == QImage::Format_ARGB32_Premultiplied));
}
inline Image convert(ImageType type, const Image &img) {
- if(type == Opaque)
+ if (type == Opaque)
return img.convertToFormat(QImage::Format_RGB16);
else
return img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
diff --git a/src/declarative/canvas/qsimplecanvas_graphicsview.cpp b/src/declarative/canvas/qsimplecanvas_graphicsview.cpp
index e3cdf19..dd4012b 100644
--- a/src/declarative/canvas/qsimplecanvas_graphicsview.cpp
+++ b/src/declarative/canvas/qsimplecanvas_graphicsview.cpp
@@ -90,8 +90,8 @@ void QSimpleGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -103,8 +103,8 @@ void QSimpleGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -117,8 +117,8 @@ void QSimpleGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -130,8 +130,8 @@ void QSimpleGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -142,14 +142,14 @@ void QSimpleGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool QSimpleGraphicsItem::sceneEvent(QEvent *event)
{
bool rv = QGraphicsItem::sceneEvent(event);
- if(event->type() == QEvent::UngrabMouse)
+ if (event->type() == QEvent::UngrabMouse)
owner->mouseUngrabEvent();
return rv;
}
QVariant QSimpleGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
- if(change == ItemSceneHasChanged) {
+ if (change == ItemSceneHasChanged) {
QSimpleCanvasItemPrivate *owner_d = static_cast<QSimpleCanvasItemPrivate*>(owner->d_ptr);
QSimpleCanvas *oldCanvas = owner_d->canvas;
owner_d->canvas = sceneMap[scene()];
@@ -164,13 +164,13 @@ QVariant QSimpleGraphicsItem::itemChange(GraphicsItemChange change, const QVaria
}
}
}
- if(owner->options() & QSimpleCanvasItem::MouseFilter)
+ if (owner->options() & QSimpleCanvasItem::MouseFilter)
owner_d->gvRemoveMouseFilter();
if (oldCanvas != owner_d->canvas)
owner->canvasChanged();
- if(owner->options() & QSimpleCanvasItem::MouseFilter)
+ if (owner->options() & QSimpleCanvasItem::MouseFilter)
owner_d->gvAddMouseFilter();
}
@@ -198,7 +198,7 @@ void QSimpleGraphicsItem::focusInEvent(QFocusEvent *)
void QSimpleCanvasItemPrivate::gvRemoveMouseFilter()
{
QGraphicsScene *scene = graphicsItem->scene();
- if(!scene) return;
+ if (!scene) return;
scene->removeEventFilter(q_ptr);
}
@@ -206,7 +206,7 @@ void QSimpleCanvasItemPrivate::gvRemoveMouseFilter()
void QSimpleCanvasItemPrivate::gvAddMouseFilter()
{
QGraphicsScene *scene = graphicsItem->scene();
- if(!scene) return;
+ if (!scene) return;
scene->installEventFilter(q_ptr);
}
diff --git a/src/declarative/canvas/qsimplecanvas_opengl.cpp b/src/declarative/canvas/qsimplecanvas_opengl.cpp
index f508aea..98f92d7 100644
--- a/src/declarative/canvas/qsimplecanvas_opengl.cpp
+++ b/src/declarative/canvas/qsimplecanvas_opengl.cpp
@@ -66,7 +66,7 @@ void CanvasEGLWidget::updateGL()
void CanvasEGLWidget::updateGL(const QRect &r)
{
- if(r.isEmpty())
+ if (r.isEmpty())
return;
_clip = r;
@@ -117,7 +117,7 @@ void QSimpleCanvasPrivate::paintGL()
p.stencilValue = 0;
p.opacity = 1;
p.forceParamRefresh = false;
- if(!isSetup)
+ if (!isSetup)
root->d_func()->setupPainting(0, QRect());
root->d_func()->paint(p);
@@ -126,12 +126,12 @@ void QSimpleCanvasPrivate::paintGL()
QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int w, int h)
{
- if(w <= 0 || h <= 0)
+ if (w <= 0 || h <= 0)
return 0;
int size = qMax(w, h);
- for(int ii = 0; ii < frameBuffers.count(); ++ii) {
- if(frameBuffers.at(ii)->width() >= size) {
+ for (int ii = 0; ii < frameBuffers.count(); ++ii) {
+ if (frameBuffers.at(ii)->width() >= size) {
QGLFramebufferObject *rv = frameBuffers.at(ii);
frameBuffers.removeAt(ii);
return rv;
@@ -154,8 +154,8 @@ QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int w, int h)
void QSimpleCanvasPrivate::release(QGLFramebufferObject *buf)
{
int size = qMax(buf->width(), buf->height());
- for(int ii = 0; ii < frameBuffers.count(); ++ii) {
- if(frameBuffers.at(ii)->width() >= size) {
+ for (int ii = 0; ii < frameBuffers.count(); ++ii) {
+ if (frameBuffers.at(ii)->width() >= size) {
frameBuffers.insert(ii, buf);
return;
}
@@ -178,7 +178,7 @@ QSimpleCanvas::Matrix QSimpleCanvasItemPrivate::localTransform() const
trans.translate(to.x(), to.y());
trans.scale(q->scale(), q->scale());
trans.translate(-to.x(), -to.y());
- if(data()->transformUser)
+ if (data()->transformUser)
trans *= *data()->transformUser;
return trans;
}
@@ -188,13 +188,13 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
Q_Q(QSimpleCanvasItem);
GLPaintParameters childParams = params;
- if(clip)
+ if (clip)
++childParams.stencilValue;
- if(child->d_func()->data()->activeOpacity != 0) {
+ if (child->d_func()->data()->activeOpacity != 0) {
childParams.boundingRect = child->boundingRect();
- if(child->filter() && child->filter()->enabled()) {
+ if (child->filter() && child->filter()->enabled()) {
QSimpleCanvasItem::GLPainter painter(q);
painter.activeTransform = child->d_func()->data()->transformActive;
painter.activeOpacity = child->d_func()->data()->activeOpacity;
@@ -209,7 +209,7 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters &params,
QSimpleCanvasItem *child)
{
- if(params.forceParamRefresh) {
+ if (params.forceParamRefresh) {
QSimpleCanvas::Matrix t = child->d_func()->data()->transformActive;
qreal o = child->d_func()->data()->activeOpacity;
setupChildState(child);
@@ -226,10 +226,10 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
{
qreal visible = child->visible();
child->d_func()->data()->activeOpacity = data()->activeOpacity;
- if(visible != 1)
+ if (visible != 1)
child->d_func()->data()->activeOpacity *= visible;
- if(child->d_func()->data()->activeOpacity != 0) {
+ if (child->d_func()->data()->activeOpacity != 0) {
// Calculate child's transform
qreal x = child->x();
qreal y = child->y();
@@ -238,19 +238,19 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive;
am = data()->transformActive;
- if(x != 0 || y != 0)
+ if (x != 0 || y != 0)
am.translate(x, y);
- if(scale != 1) {
+ if (scale != 1) {
QPointF to = child->d_func()->transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(to.x(), to.y());
am.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(-to.x(), -to.y());
}
- if(child->d_func()->data()->transformUser)
+ if (child->d_func()->data()->transformUser)
am *= *child->d_func()->data()->transformUser;
- if(flip) {
+ if (flip) {
QRectF br = child->boundingRect();
am.translate(br.width() / 2., br.height() / 2);
am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
@@ -265,15 +265,15 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin
Q_Q(QSimpleCanvasItem);
QRectF filteredBoundRect = q->boundingRect();
- if(filter)
+ if (filter)
filteredBoundRect = filter->itemBoundingRect(filteredBoundRect);
QRectF rv = data()->transformActive.mapRect(filteredBoundRect);
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QSimpleCanvasItem *child = children.at(ii);
setupChildState(child);
- if(child->d_func()->data()->activeOpacity != 0)
+ if (child->d_func()->data()->activeOpacity != 0)
rv |= child->d_func()->setupPainting(version, bounding);
}
@@ -283,7 +283,7 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin
void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvasFilter::Layer layer)
{
- if(!layer)
+ if (!layer)
return;
Q_Q(QSimpleCanvasItem);
@@ -299,8 +299,8 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
width, 0 };
// XXX Handle separate cliping modes
- if(clip) {
- if(params.stencilValue == 255)
+ if (clip) {
+ if (params.stencilValue == 255)
qWarning()
<< "OpenGL: Clip recursion greater than 255 not permitted.";
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -341,17 +341,17 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
zOrderChildren();
int upto = 0;
- for(upto = 0; upto < children.count(); ++upto) {
+ for (upto = 0; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
- if(c->z() < 0) {
- if(layer & QSimpleCanvasFilter::ChildrenUnderItem)
+ if (c->z() < 0) {
+ if (layer & QSimpleCanvasFilter::ChildrenUnderItem)
paintChild(params, c);
} else {
break;
}
}
- if(layer & QSimpleCanvasFilter::Item &&
+ if (layer & QSimpleCanvasFilter::Item &&
q->options() & QSimpleCanvasItem::HasContents) {
QSimpleCanvasItem::GLPainter painter(q);
painter.activeTransform = data()->transformActive;
@@ -361,14 +361,14 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
q->paintGLContents(painter);
}
- if(layer & QSimpleCanvasFilter::ChildrenAboveItem) {
- for(; upto < children.count(); ++upto) {
+ if (layer & QSimpleCanvasFilter::ChildrenAboveItem) {
+ for (; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
paintChild(params, c);
}
}
- if(clip) {
+ if (clip) {
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glStencilFunc(GL_EQUAL, params.stencilValue + 1, 0xFFFFFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
@@ -389,7 +389,7 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
QGLShaderProgram *QSimpleCanvasItem::GLPainter::useTextureShader()
{
- if(activeOpacity == 1.) {
+ if (activeOpacity == 1.) {
item->basicShaders()->singleTexture()->enable();
item->basicShaders()->singleTexture()->setTransform(activeTransform);
return item->basicShaders()->singleTexture();
@@ -406,7 +406,7 @@ QGLShaderProgram *QSimpleCanvasItem::GLPainter::useColorShader(const QColor &col
{
QColor c = color;
item->basicShaders()->constantColor()->enable();
- if(activeOpacity != 1.) {
+ if (activeOpacity != 1.) {
c.setAlpha(int(c.alpha() * activeOpacity));
}
diff --git a/src/declarative/canvas/qsimplecanvas_opengl1.cpp b/src/declarative/canvas/qsimplecanvas_opengl1.cpp
index ad21c77..3fd8490 100644
--- a/src/declarative/canvas/qsimplecanvas_opengl1.cpp
+++ b/src/declarative/canvas/qsimplecanvas_opengl1.cpp
@@ -57,7 +57,7 @@ void CanvasEGLWidget::updateGL()
void CanvasEGLWidget::updateGL(const QRect &r)
{
- if(r.isEmpty())
+ if (r.isEmpty())
return;
_clip = r;
@@ -66,7 +66,7 @@ void CanvasEGLWidget::updateGL(const QRect &r)
void CanvasEGLWidget::paintGL()
{
- if(!_clip.isEmpty()) {
+ if (!_clip.isEmpty()) {
glEnable(GL_SCISSOR_TEST);
glScissor(_clip.x(), _clip.y(), _clip.width(), _clip.height());
} else {
@@ -124,7 +124,7 @@ void QSimpleCanvasPrivate::paintGL()
p.clipRect = p.sceneRect;
p.opacity = 1;
p.forceParamRefresh = false;
- if(!isSetup) {
+ if (!isSetup) {
unsigned int zero = 0;
root->d_func()->setupPainting(0, QRect(), &zero);
}
@@ -151,7 +151,7 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
{
GLPaintParameters childParams = params;
- if(child->d_func()->activeOpacity != 0) {
+ if (child->d_func()->activeOpacity != 0) {
childParams.boundingRect = child->boundingRect();
child->d_func()->paint(childParams);
}
@@ -160,7 +160,7 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters &params,
QSimpleCanvasItem *child)
{
- if(params.forceParamRefresh) {
+ if (params.forceParamRefresh) {
QSimpleCanvas::Matrix t = child->d_func()->transformActive;
qreal o = child->d_func()->activeOpacity;
setupChildState(child);
@@ -177,10 +177,10 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
{
qreal visible = child->visible().value();
child->d_func()->activeOpacity = activeOpacity;
- if(visible != 1)
+ if (visible != 1)
child->d_func()->activeOpacity *= visible;
- if(child->d_func()->activeOpacity != 0) {
+ if (child->d_func()->activeOpacity != 0) {
// Calculate child's transform
qreal x = child->x();
qreal y = child->y();
@@ -189,19 +189,19 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
QSimpleCanvas::Matrix &am = child->d_func()->transformActive;
am = transformActive;
- if(x != 0 || y != 0)
+ if (x != 0 || y != 0)
am.translate(x, y);
- if(scale != 1) {
+ if (scale != 1) {
QPointF to = child->d_func()->transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(to.x(), to.y());
am.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(-to.x(), -to.y());
}
- if(child->d_func()->transformUserSet)
+ if (child->d_func()->transformUserSet)
am *= child->d_func()->transformUser;
- if(flip) {
+ if (flip) {
QRectF br = child->boundingRect();
am.translate(br.width() / 2., br.height() / 2);
am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
@@ -218,15 +218,15 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin
unsigned int oldZero = *zero;
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QSimpleCanvasItem *child = children.at(ii);
setupChildState(child);
- if(child->d_func()->activeOpacity != 0)
+ if (child->d_func()->activeOpacity != 0)
rv |= child->d_func()->setupPainting(version, bounding, zero);
}
- if(clip || oldZero != *zero)
+ if (clip || oldZero != *zero)
(*zero)++;
transformActive.translate(0, 0, *zero);
@@ -241,17 +241,17 @@ void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCan
zOrderChildren();
int upto = 0;
- for(upto = 0; upto < children.count(); ++upto) {
+ for (upto = 0; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
- if(c->zValue().value() < 0) {
- if(layer & QSimpleCanvasFilter::ChildrenUnderItem)
+ if (c->zValue().value() < 0) {
+ if (layer & QSimpleCanvasFilter::ChildrenUnderItem)
paintChild(params, c);
} else {
break;
}
}
- if(layer & QSimpleCanvasFilter::Item &&
+ if (layer & QSimpleCanvasFilter::Item &&
q->options() & QSimpleCanvasItem::HasContents) {
QSimpleCanvasItem::GLPainter painter(q);
painter.activeTransform = transformActive;
@@ -261,8 +261,8 @@ void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCan
q->paintGLContents(painter);
}
- if(layer & QSimpleCanvasFilter::ChildrenAboveItem) {
- for(; upto < children.count(); ++upto) {
+ if (layer & QSimpleCanvasFilter::ChildrenAboveItem) {
+ for (; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
paintChild(params, c);
}
@@ -271,11 +271,11 @@ void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCan
void QSimpleCanvasItemPrivate::paint(GLPaintParameters &params, QSimpleCanvasFilter::Layer layer)
{
- if(!layer)
+ if (!layer)
return;
// XXX Handle separate cliping modes
- if(clip) {
+ if (clip) {
GLSaveScissor ss;
qreal width = params.boundingRect.width();
@@ -331,7 +331,7 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &params, QSimpleCanvasFil
int sr_height = ::ceilf(r.bottom()) - sr_y;
QRect sr(sr_x, sr_y, sr_width, sr_height);
- if(ss.wasEnabled())
+ if (ss.wasEnabled())
sr &= ss.rect();
glScissor(sr.x(), sr.y(), sr.width(), sr.height());
diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h
index 44e5a7e..7bc7330 100644
--- a/src/declarative/canvas/qsimplecanvas_p.h
+++ b/src/declarative/canvas/qsimplecanvas_p.h
@@ -176,7 +176,7 @@ public:
GLBasicShaders *basicShaders() const
{
#if defined(QFX_RENDER_OPENGL2)
- if(!basicShadersInstance)
+ if (!basicShadersInstance)
basicShadersInstance = new GLBasicShaders;
return basicShadersInstance;
#else
diff --git a/src/declarative/canvas/qsimplecanvas_software.cpp b/src/declarative/canvas/qsimplecanvas_software.cpp
index 06e221e..c130a62 100644
--- a/src/declarative/canvas/qsimplecanvas_software.cpp
+++ b/src/declarative/canvas/qsimplecanvas_software.cpp
@@ -52,18 +52,18 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding
QRect rv =
data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding;
QRect myBounding = bounding;
- if(q->clip())
+ if (q->clip())
myBounding &= rv;
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QSimpleCanvasItem *child = children.at(ii);
qreal visible = child->visible();
child->d_func()->data()->activeOpacity = data()->activeOpacity;
- if(visible != 1)
+ if (visible != 1)
child->d_func()->data()->activeOpacity *= visible;
- if(child->d_func()->data()->activeOpacity != 0) {
+ if (child->d_func()->data()->activeOpacity != 0) {
// Calculate child's transform
qreal x = child->x();
qreal y = child->y();
@@ -72,21 +72,21 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding
QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive;
am = data()->transformActive;
- if(x != 0 || y != 0)
+ if (x != 0 || y != 0)
am.translate(x, y);
- if(scale != 1) {
+ if (scale != 1) {
QPointF to = child->d_func()->transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(to.x(), to.y());
am.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(-to.x(), -to.y());
}
- if(child->d_func()->data()->transformUser)
+ if (child->d_func()->data()->transformUser)
am = *child->d_func()->data()->transformUser * am;
- if(flip) {
+ if (flip) {
QRectF br = child->boundingRect();
am.translate(br.width() / 2., br.height() / 2);
am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1,
@@ -107,7 +107,7 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
Q_Q(QSimpleCanvasItem);
QRect oldUcr;
- if(clip) {
+ if (clip) {
p.save();
QRectF boundingRectActive = q->boundingRect();
@@ -138,13 +138,13 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
}
p.setWorldTransform(data()->transformActive);
- if(p.clipRegion().isEmpty()) {
+ if (p.clipRegion().isEmpty()) {
p.setClipRect(cr);
} else {
p.setClipRect(cr, Qt::IntersectClip);
}
- if(p.clipRegion().isEmpty()) {
+ if (p.clipRegion().isEmpty()) {
p.restore();
return;
}
@@ -153,9 +153,9 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
zOrderChildren();
int upto = 0;
- for(upto = 0; upto < children.count(); ++upto) {
+ for (upto = 0; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
- if(c->z() < 0) {
+ if (c->z() < 0) {
paintChild(p, c);
} else {
break;
@@ -165,18 +165,18 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
p.setWorldTransform(data()->transformActive);
q->paintContents(p);
- for(; upto < children.count(); ++upto) {
+ for (; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
paintChild(p, c);
}
- if(clip)
+ if (clip)
p.restore();
}
void QSimpleCanvasItemPrivate::paintChild(QPainter &p, QSimpleCanvasItem *c)
{
- if(c->d_func()->data()->activeOpacity != 0) {
+ if (c->d_func()->data()->activeOpacity != 0) {
qreal op = p.opacity();
p.setOpacity(c->d_func()->data()->activeOpacity);
diff --git a/src/declarative/canvas/qsimplecanvasfilter.cpp b/src/declarative/canvas/qsimplecanvasfilter.cpp
index 00c88c5..5bc6b35 100644
--- a/src/declarative/canvas/qsimplecanvasfilter.cpp
+++ b/src/declarative/canvas/qsimplecanvasfilter.cpp
@@ -64,7 +64,7 @@ QSimpleCanvasFilter::QSimpleCanvasFilter(QObject *parent)
QSimpleCanvasFilter::~QSimpleCanvasFilter()
{
- if(d->item) d->item->setFilter(0);
+ if (d->item) d->item->setFilter(0);
delete d; d = 0;
}
@@ -80,7 +80,7 @@ bool QSimpleCanvasFilter::enabled() const
void QSimpleCanvasFilter::setEnabled(bool e)
{
- if(e == d->enabled)
+ if (e == d->enabled)
return;
d->enabled = e;
emit enabledChanged();
@@ -96,7 +96,7 @@ QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(float scale, const QRectF
QSimpleCanvasItem *item = d->item;
QRect br = item->itemBoundingRect();
- if(br.isEmpty())
+ if (br.isEmpty())
return 0;
QGLFramebufferObject *fbo =
item->canvas()->d->acquire(int(br.width() * scale), int(br.height() * scale));
@@ -141,7 +141,7 @@ QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(const QRectF &src, const
QSimpleCanvasItem *item = d->item;
QRect br = item->itemBoundingRect();
- if(br.isEmpty())
+ if (br.isEmpty())
return 0;
QGLFramebufferObject *fbo =
item->canvas()->d->acquire(br.width(), br.height());
@@ -181,7 +181,7 @@ QGLFramebufferObject *QSimpleCanvasFilter::acquireFBO(const QSize &s)
#if defined(QFX_RENDER_OPENGL2)
QSize size;
QSimpleCanvasItem *item = d->item;
- if(size.isNull()) {
+ if (size.isNull()) {
QRect br = item->itemBoundingRect();
size = br.size();
} else {
@@ -245,14 +245,14 @@ QSimpleCanvasItem *QSimpleCanvasFilter::item() const
void QSimpleCanvasFilter::setItem(QSimpleCanvasItem *i)
{
- if(d->item == i)
+ if (d->item == i)
return;
- if(d->item) {
+ if (d->item) {
d->item->setFilter(0);
d->item = 0;
}
- if(i->filter() != this) {
+ if (i->filter() != this) {
i->setFilter(this);
} else {
d->item = i;
@@ -283,23 +283,23 @@ void QSimpleCanvasFilter::filter(QPainter &)
void QSimpleCanvasFilter::update()
{
- if(d->item)
+ if (d->item)
d->item->update();
}
#if defined(QFX_RENDER_OPENGL2)
bool QSimpleCanvasFilterPrivate::isSimpleItem(QSimpleCanvasItem *item, QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout)
{
- if(item->options() & QSimpleCanvasItem::SimpleItem && !item->hasChildren()) {
+ if (item->options() & QSimpleCanvasItem::SimpleItem && !item->hasChildren()) {
*out = item;
return true;
- } else if(!(item->options() & QSimpleCanvasItem::HasContents) &&
+ } else if (!(item->options() & QSimpleCanvasItem::HasContents) &&
item->children().count() == 1) {
QSimpleCanvasItem *child = item->children().first();
- if(child->filter() && child->filter()->enabled())
+ if (child->filter() && child->filter()->enabled())
return false;
bool rv = isSimpleItem(child, out, mout);
- if(rv)
+ if (rv)
*mout *= child->d_func()->localTransform();
return rv;
} else {
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp
index 446e331..62a44e4 100644
--- a/src/declarative/canvas/qsimplecanvasitem.cpp
+++ b/src/declarative/canvas/qsimplecanvasitem.cpp
@@ -57,7 +57,7 @@ QSimpleCanvasItemData::QSimpleCanvasItemData()
QSimpleCanvasItemData::~QSimpleCanvasItemData()
{
- if(transformUser)
+ if (transformUser)
delete transformUser;
}
@@ -265,7 +265,7 @@ QSimpleCanvasItem::TransformOrigin QSimpleCanvasItem::transformOrigin() const
void QSimpleCanvasItem::setTransformOrigin(TransformOrigin origin)
{
Q_D(QSimpleCanvasItem);
- if(origin != d->origin) {
+ if (origin != d->origin) {
d->origin = origin;
update();
}
@@ -297,7 +297,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::parent() const
void QSimpleCanvasItemPrivate::zOrderChildren()
{
- if(!needsZOrder || children.count() <= 1)
+ if (!needsZOrder || children.count() <= 1)
return;
needsZOrder = false;
@@ -310,10 +310,10 @@ void QSimpleCanvasItemPrivate::zOrderChildren()
swap = false;
QSimpleCanvasItem *item = children.first();
qreal z = item->z();
- for(int ii = 1; ii < children.count(); ++ii) {
+ for (int ii = 1; ii < children.count(); ++ii) {
QSimpleCanvasItem *i2 = children.at(ii);
qreal z2 = i2->z();
- if(z2 < z) {
+ if (z2 < z) {
swap = true;
children[ii] = item;
children[ii - 1] = i2;
@@ -329,21 +329,21 @@ void QSimpleCanvasItemPrivate::canvasChanged(QSimpleCanvas *newCanvas, QSimpleCa
{
Q_Q(QSimpleCanvasItem);
canvas = newCanvas;
- if(options & QSimpleCanvasItem::MouseFilter) {
- if(oldCanvas) oldCanvas->d->removeMouseFilter(q);
- if(newCanvas) newCanvas->d->installMouseFilter(q);
+ if (options & QSimpleCanvasItem::MouseFilter) {
+ if (oldCanvas) oldCanvas->d->removeMouseFilter(q);
+ if (newCanvas) newCanvas->d->installMouseFilter(q);
}
- if(newCanvas) {
- if(!oldCanvas && hasFocus)
+ if (newCanvas) {
+ if (!oldCanvas && hasFocus)
newCanvas->d->setFocusItem(q, Qt::OtherFocusReason, false);
- if(wantsActiveFocusPanelPendingCanvas) {
+ if (wantsActiveFocusPanelPendingCanvas) {
hasBeenActiveFocusPanel = true;
newCanvas->d->setActiveFocusPanel(q);
wantsActiveFocusPanelPendingCanvas = false;
}
}
- for(int ii = 0; ii < children.count(); ++ii)
+ for (int ii = 0; ii < children.count(); ++ii)
children.at(ii)->d_func()->canvasChanged(newCanvas, oldCanvas);
q->canvasChanged();
}
@@ -351,12 +351,12 @@ void QSimpleCanvasItemPrivate::canvasChanged(QSimpleCanvas *newCanvas, QSimpleCa
void QSimpleCanvasItem::setFocus(bool focus)
{
Q_D(QSimpleCanvasItem);
- if(d->hasFocus == focus)
+ if (d->hasFocus == focus)
return;
QSimpleCanvas *c = canvas();
- if(c) {
- if(focus)
+ if (c) {
+ if (focus)
c->d->setFocusItem(this, Qt::OtherFocusReason);
else
c->d->clearFocusItem(this);
@@ -369,9 +369,9 @@ void QSimpleCanvasItem::setFocus(bool focus)
qreal QSimpleCanvasItem::x() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->x();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->x;
else
return 0;
@@ -380,9 +380,9 @@ qreal QSimpleCanvasItem::x() const
qreal QSimpleCanvasItem::y() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->y();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->y;
else
return 0;
@@ -391,9 +391,9 @@ qreal QSimpleCanvasItem::y() const
qreal QSimpleCanvasItem::z() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->zValue();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->z;
else
return 0;
@@ -402,12 +402,12 @@ qreal QSimpleCanvasItem::z() const
void QSimpleCanvasItem::setX(qreal x)
{
Q_D(QSimpleCanvasItem);
- if(x == this->x())
+ if (x == this->x())
return;
qreal oldX = this->x();
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setPos(x, y());
} else {
d->data()->x = x;
@@ -421,12 +421,12 @@ void QSimpleCanvasItem::setX(qreal x)
void QSimpleCanvasItem::setY(qreal y)
{
Q_D(QSimpleCanvasItem);
- if(y == this->y())
+ if (y == this->y())
return;
qreal oldY = this->y();
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setPos(x(), y);
} else {
d->data()->y = y;
@@ -440,12 +440,12 @@ void QSimpleCanvasItem::setY(qreal y)
void QSimpleCanvasItem::setZ(qreal z)
{
Q_D(QSimpleCanvasItem);
- if(z == this->z())
+ if (z == this->z())
return;
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
- if(z < 0)
+ if (z < 0)
d->graphicsItem->setFlag(QGraphicsItem::ItemStacksBehindParent,
true);
else
@@ -455,11 +455,11 @@ void QSimpleCanvasItem::setZ(qreal z)
d->graphicsItem->setZValue(z);
} else {
- if(d->data()->z == z)
+ if (d->data()->z == z)
return;
d->data()->z = z;
- if(parent())
+ if (parent())
static_cast<QSimpleCanvasItemPrivate*>(parent()->d_ptr)->needsZOrder = true;
update();
}
@@ -475,7 +475,7 @@ void QSimpleCanvasItem::setWidth(qreal w)
{
Q_D(QSimpleCanvasItem);
d->widthValid = true;
- if(d->width == w)
+ if (d->width == w)
return;
qreal oldWidth = d->width;
@@ -490,7 +490,7 @@ void QSimpleCanvasItem::setWidth(qreal w)
void QSimpleCanvasItem::setImplicitWidth(qreal w)
{
Q_D(QSimpleCanvasItem);
- if(d->width == w || widthValid())
+ if (d->width == w || widthValid())
return;
qreal oldWidth = d->width;
@@ -518,7 +518,7 @@ void QSimpleCanvasItem::setHeight(qreal h)
{
Q_D(QSimpleCanvasItem);
d->heightValid = true;
- if(d->height == h)
+ if (d->height == h)
return;
qreal oldHeight = d->height;
@@ -533,7 +533,7 @@ void QSimpleCanvasItem::setHeight(qreal h)
void QSimpleCanvasItem::setImplicitHeight(qreal h)
{
Q_D(QSimpleCanvasItem);
- if(d->height == h || heightValid())
+ if (d->height == h || heightValid())
return;
qreal oldHeight = d->height;
@@ -557,7 +557,7 @@ void QSimpleCanvasItem::setPos(const QPointF &point)
qreal oldX = x();
qreal oldY = y();
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setPos(point);
} else {
d->data()->x = point.x();
@@ -579,13 +579,13 @@ void QSimpleCanvasItem::setScale(qreal s)
{
Q_D(QSimpleCanvasItem);
d->scale = s;
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
QTransform t;
QPointF to = transformOriginPoint();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
t.translate(to.x(), to.y());
t.scale(s, s);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
t.translate(-to.x(), -to.y());
d->graphicsItem->setTransform(t * d->graphicsItem->transform);
} else {
@@ -595,9 +595,9 @@ void QSimpleCanvasItem::setScale(qreal s)
bool QSimpleCanvasItem::isVisible() const
{
- if(visible() <= 0)
+ if (visible() <= 0)
return false;
- else if(!parent())
+ else if (!parent())
return true;
else
return parent()->isVisible();
@@ -606,9 +606,9 @@ bool QSimpleCanvasItem::isVisible() const
qreal QSimpleCanvasItem::visible() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->opacity();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->visible;
else
return 1;
@@ -617,17 +617,17 @@ qreal QSimpleCanvasItem::visible() const
void QSimpleCanvasItem::setVisible(qreal v)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setOpacity(v);
} else {
- if(v == visible())
+ if (v == visible())
return;
- if(v == 0)
+ if (v == 0)
update();
d->data()->visible = v;
- if(v != 0)
+ if (v != 0)
update();
}
}
@@ -636,7 +636,7 @@ void QSimpleCanvasItem::addChild(QSimpleCanvasItem *c)
{
Q_D(QSimpleCanvasItem);
d->children.append(c);
- if(!d->graphicsItem)
+ if (!d->graphicsItem)
d->needsZOrder = true;
childrenChanged();
}
@@ -660,11 +660,11 @@ QSimpleCanvasItem takes ownership of filter.
void QSimpleCanvasItem::setFilter(QSimpleCanvasFilter *f)
{
Q_D(QSimpleCanvasItem);
- if(!d || f == d->filter)
+ if (!d || f == d->filter)
return;
d->filter = f;
- if(d->filter)
+ if (d->filter)
d->filter->setItem(this);
update();
}
@@ -683,7 +683,7 @@ bool QSimpleCanvasItem::hasChildren() const
QSimpleCanvasLayer *QSimpleCanvasItem::layer()
{
- if(parent())
+ if (parent())
return parent()->layer();
else
return 0;
@@ -692,18 +692,18 @@ QSimpleCanvasLayer *QSimpleCanvasItem::layer()
void QSimpleCanvasItem::update()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->update();
} else {
- if(!parent())
+ if (!parent())
return;
- if(d->data()->dirty || 0. == d->data()->visible) return;
+ if (d->data()->dirty || 0. == d->data()->visible) return;
QSimpleCanvasLayer *l = layer();
- if(l == this && parent())
+ if (l == this && parent())
l = parent()->layer();
- if(l) {
+ if (l) {
l->addDirty(this);
d->data()->dirty = true;
d->data()->transformValid = false;
@@ -720,10 +720,10 @@ bool QSimpleCanvasItem::clip() const
void QSimpleCanvasItem::setClip(bool c)
{
Q_D(const QSimpleCanvasItem);
- if(bool(d->clip) == c)
+ if (bool(d->clip) == c)
return;
- if(c)
+ if (c)
setClipType(ClipToRect);
else
setClipType(NoClip);
@@ -741,7 +741,7 @@ void QSimpleCanvasItem::setClipType(ClipType c)
{
Q_D(QSimpleCanvasItem);
d->clip = c;
- if(d->graphicsItem)
+ if (d->graphicsItem)
d->graphicsItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape, bool(c));
else
update();
@@ -750,9 +750,9 @@ void QSimpleCanvasItem::setClipType(ClipType c)
Qt::MouseButtons QSimpleCanvasItem::acceptedMouseButtons() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->acceptedMouseButtons();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return (Qt::MouseButtons)d->data()->buttons;
else
return Qt::NoButton;
@@ -761,7 +761,7 @@ Qt::MouseButtons QSimpleCanvasItem::acceptedMouseButtons() const
void QSimpleCanvasItem::setAcceptedMouseButtons(Qt::MouseButtons buttons)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
d->graphicsItem->setAcceptedMouseButtons(buttons);
else
d->data()->buttons = buttons;
@@ -776,7 +776,7 @@ QRect QSimpleCanvasItem::itemBoundingRect()
QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return p;
QPointF rv(-1. + 2. * p.x() / qreal(canvas->width()),
@@ -791,7 +791,7 @@ QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const
QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return r;
qreal width = r.width() * 2. / qreal(canvas->width());
@@ -808,7 +808,7 @@ QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const
QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return p;
QPointF rv(0.5 * (p.x() + 1.) * qreal(canvas->width()),
@@ -823,7 +823,7 @@ QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const
QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return r;
qreal width = 0.5 * r.width() * qreal(canvas->width());
@@ -840,7 +840,7 @@ QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const
QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapFromScene(p);
} else {
QPointF mp = d->adjustFrom(p);
@@ -865,7 +865,7 @@ QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const
QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapFromScene(r).boundingRect();
} else {
QRectF mr = d->adjustFrom(r);
@@ -902,7 +902,7 @@ QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const
QPointF QSimpleCanvasItem::mapToScene(const QPointF &p) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapToScene(p);
} else {
d->freshenTransforms();
@@ -914,7 +914,7 @@ QPointF QSimpleCanvasItem::mapToScene(const QPointF &p) const
QRectF QSimpleCanvasItem::mapToScene(const QRectF &r) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapToScene(r).boundingRect();
} else {
d->freshenTransforms();
@@ -927,7 +927,7 @@ int QSimpleCanvasItemPrivate::nextTransformVersion = 1;
void QSimpleCanvasItemPrivate::freshenTransforms() const
{
- if(freshenNeeded())
+ if (freshenNeeded())
doFreshenTransforms();
}
@@ -941,9 +941,9 @@ bool QSimpleCanvasItemPrivate::freshenNeeded() const
#else
const QSimpleCanvasItemPrivate *me = this;
while(me) {
- if(me->data_ptr && !me->data_ptr->transformValid)
+ if (me->data_ptr && !me->data_ptr->transformValid)
return true;
- if(me->parent)
+ if (me->parent)
me = me->parent->d_func();
else
me = 0;
@@ -955,31 +955,31 @@ bool QSimpleCanvasItemPrivate::freshenNeeded() const
void QSimpleCanvasItemPrivate::doFreshenTransforms() const
{
Q_Q(const QSimpleCanvasItem);
- if(parent)
+ if (parent)
parent->d_func()->doFreshenTransforms();
- if(freshenNeeded()) {
- if(parent)
+ if (freshenNeeded()) {
+ if (parent)
data()->transformActive = parent->d_func()->data()->transformActive;
else
data()->transformActive = QSimpleCanvas::Matrix();
data()->transformActive.translate(q->x(), q->y());
- if(scale != 1.) {
+ if (scale != 1.) {
QPointF to = transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
data()->transformActive.translate(to.x(), to.y());
data()->transformActive.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
data()->transformActive.translate(-to.x(), -to.y());
}
Q_Q(const QSimpleCanvasItem);
#if defined(QFX_RENDER_OPENGL)
- if(q->d_func()->data()->transformUser)
+ if (q->d_func()->data()->transformUser)
data()->transformActive *= *q->d_func()->data()->transformUser;
#endif
- if(data()->flip) {
+ if (data()->flip) {
QRectF br = q->boundingRect();
data()->transformActive.translate(br.width() / 2., br.height() / 2);
#if defined(QFX_RENDER_OPENGL)
@@ -996,9 +996,9 @@ void QSimpleCanvasItemPrivate::doFreshenTransforms() const
QSimpleCanvas::Matrix QSimpleCanvasItem::transform() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return QSimpleCanvasConfig::transformToMatrix(d->graphicsItem->transform);
- else if(d->data()->transformUser)
+ else if (d->data()->transformUser)
return *d->data()->transformUser;
else
return QSimpleCanvas::Matrix();
@@ -1007,11 +1007,11 @@ QSimpleCanvas::Matrix QSimpleCanvasItem::transform() const
void QSimpleCanvasItem::setTransform(const QSimpleCanvas::Matrix &m)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->transform = QSimpleCanvasConfig::matrixToTransform(m);
d->graphicsItem->setTransform(QTransform::fromScale(d->scale, d->scale) * d->graphicsItem->transform);
} else {
- if(!d->data()->transformUser)
+ if (!d->data()->transformUser)
d->data()->transformUser = new QSimpleCanvas::Matrix;
*d->data()->transformUser = m;
update();
@@ -1021,16 +1021,16 @@ void QSimpleCanvasItem::setTransform(const QSimpleCanvas::Matrix &m)
QSimpleCanvasItem *QSimpleCanvasItem::mouseGrabberItem() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
QGraphicsScene *s = d->graphicsItem->scene();
- if(s) {
+ if (s) {
QGraphicsItem *item = s->mouseGrabberItem();
QSimpleGraphicsItem *dgi = static_cast<QSimpleGraphicsItem *>(item);
return dgi?static_cast<QSimpleCanvasItem*>(dgi->owner):0;
}
} else {
QSimpleCanvas *c = canvas();
- if(c)
+ if (c)
return c->d->lastMouseItem;
}
return 0;
@@ -1039,11 +1039,11 @@ QSimpleCanvasItem *QSimpleCanvasItem::mouseGrabberItem() const
void QSimpleCanvasItem::ungrabMouse()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->ungrabMouse();
} else {
QSimpleCanvas *c = canvas();
- if(c && c->d->lastMouseItem == this) {
+ if (c && c->d->lastMouseItem == this) {
c->d->lastMouseItem->mouseUngrabEvent();
c->d->lastMouseItem = 0;
}
@@ -1053,13 +1053,13 @@ void QSimpleCanvasItem::ungrabMouse()
void QSimpleCanvasItem::grabMouse()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->grabMouse();
} else {
QSimpleCanvas *c = canvas();
- if(c) {
- if(c->d->lastMouseItem != this) {
- if(c->d->lastMouseItem)
+ if (c) {
+ if (c->d->lastMouseItem != this) {
+ if (c->d->lastMouseItem)
c->d->lastMouseItem->mouseUngrabEvent();
c->d->lastMouseItem = this;
}
@@ -1094,7 +1094,7 @@ void QSimpleCanvasItemPrivate::setActiveFocus(bool f)
{
hasActiveFocus = f;
- if(graphicsItem) {
+ if (graphicsItem) {
if (f) {
if (!(graphicsItem->flags() & QGraphicsItem::ItemIsFocusable))
graphicsItem->setFlag(QGraphicsItem::ItemIsFocusable);
@@ -1111,9 +1111,9 @@ void QSimpleCanvasItemPrivate::setActiveFocus(bool f)
QSimpleCanvasItem::Flip QSimpleCanvasItem::flip() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return NoFlip;
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->flip;
else
return NoFlip;
@@ -1122,10 +1122,10 @@ QSimpleCanvasItem::Flip QSimpleCanvasItem::flip() const
void QSimpleCanvasItem::setFlip(Flip f)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return;
- if(d->data()->flip == f)
+ if (d->data()->flip == f)
return;
d->data()->flip = f;
@@ -1142,15 +1142,15 @@ void QSimpleCanvasItem::setFlip(Flip f)
void QSimpleCanvasItem::stackUnder(QSimpleCanvasItem *item)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return; // XXX
QSimpleCanvasItem *p = parent();
- if(!p || !item || item == this) return;
+ if (!p || !item || item == this) return;
QSimpleCanvasItemPrivate *parent_d_ptr = static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr);
int idx = parent_d_ptr->children.indexOf(item);
- if(idx == -1) return;
+ if (idx == -1) return;
parent_d_ptr->children.removeAll(this);
idx = parent_d_ptr->children.indexOf(item);
@@ -1170,15 +1170,15 @@ void QSimpleCanvasItem::stackUnder(QSimpleCanvasItem *item)
void QSimpleCanvasItem::stackOver(QSimpleCanvasItem *item)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return; // XXX
QSimpleCanvasItem *p = parent();
- if(!p || !item || item == this) return;
+ if (!p || !item || item == this) return;
QSimpleCanvasItemPrivate *parent_d_ptr = static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr);
int idx = parent_d_ptr->children.indexOf(item);
- if(idx == -1) return;
+ if (idx == -1) return;
parent_d_ptr->children.removeAll(this);
idx = parent_d_ptr->children.indexOf(item);
@@ -1200,17 +1200,17 @@ void QSimpleCanvasItem::stackOver(QSimpleCanvasItem *item)
void QSimpleCanvasItem::stackAt(int index)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return; // XXX
QSimpleCanvasItem *p = parent();
- if(!p) return;
+ if (!p) return;
QSimpleCanvasItemPrivate *parent_d_ptr = static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr);
parent_d_ptr->children.removeAll(this);
- if(index < 0) index = 0;
- if(index > parent_d_ptr->children.size()) index = parent_d_ptr->children.size();
+ if (index < 0) index = 0;
+ if (index > parent_d_ptr->children.size()) index = parent_d_ptr->children.size();
parent_d_ptr->children.insert(index, this);
parent_d_ptr->needsZOrder = true;
@@ -1233,13 +1233,13 @@ int QSimpleCanvasItem::indexForChild(QSimpleCanvasItem *item)
bool QSimpleCanvasItem::eventFilter(QObject *o, QEvent *e)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
switch(e->type()) {
case QEvent::GraphicsSceneMouseDoubleClick:
case QEvent::GraphicsSceneMouseMove:
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseRelease:
- if(mouseFilter(static_cast<QGraphicsSceneMouseEvent *>(e)))
+ if (mouseFilter(static_cast<QGraphicsSceneMouseEvent *>(e)))
return true;
break;
default:
@@ -1255,44 +1255,44 @@ void QSimpleCanvasItem::setOptions(Options options, bool set)
Q_D(QSimpleCanvasItem);
Options old = (Options)d->options;
- if(options & IsFocusPanel) {
- if(!set) {
+ if (options & IsFocusPanel) {
+ if (!set) {
qWarning("QSimpleCanvasItem::setOptions: Cannot unset IsFocusPanel");
return;
- } else if(hasChildren()) {
+ } else if (hasChildren()) {
qWarning("QSimpleCanvasItem::setOptions: Cannot set IsFocusPanel once item has children");
return;
}
}
- if(options & IsFocusRealm) {
- if(!set) {
+ if (options & IsFocusRealm) {
+ if (!set) {
qWarning("QSimpleCanvasItem::setOptions: Cannot unset IsFocusRealm");
return;
}
}
- if(set)
+ if (set)
d->options |= options;
else
d->options &= ~options;
- if((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) {
+ if ((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) {
qWarning("QSimpleCanvasItem::setOptions: Cannot set both IsFocusPanel and IsFocusRealm. IsFocusRealm will be unset.");
d->options &= ~IsFocusRealm;
}
- if((old & MouseFilter) != (d->options & MouseFilter)) {
- if(d->graphicsItem) {
- if(d->options & MouseFilter)
+ if ((old & MouseFilter) != (d->options & MouseFilter)) {
+ if (d->graphicsItem) {
+ if (d->options & MouseFilter)
d->gvAddMouseFilter();
else
d->gvRemoveMouseFilter();
} else {
QSimpleCanvas *c = canvas();
- if(c) {
- if(d->options & MouseFilter)
+ if (c) {
+ if (d->options & MouseFilter)
c->d->installMouseFilter(this);
else
c->d->removeMouseFilter(this);
@@ -1314,7 +1314,7 @@ QSimpleCanvasItem::QSimpleCanvasItem(QSimpleCanvasItem *p)
QSimpleCanvasItem::~QSimpleCanvasItem()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
if ((d->options & (IsFocusPanel|IsFocusRealm)) && d->canvas)
d->canvas->d->focusPanelData.remove(this);
if (d->hasFocus && d->canvas) {
@@ -1324,24 +1324,24 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
if (prnt && d->canvas->d->focusPanelData.value(prnt) == this)
d->canvas->d->focusPanelData.remove(prnt);
}
- if(d->filter)
+ if (d->filter)
delete d->filter;
qDeleteAll(children());
- if(parent())
+ if (parent())
parent()->remChild(this);
delete d->graphicsItem;
} else {
setOptions(MouseFilter, false);
- if(d->canvas){
- if(d->canvas->focusItem() == this)
+ if (d->canvas){
+ if (d->canvas->focusItem() == this)
d->canvas->d->focusItem = 0;
- if(d->canvas->d->lastFocusItem == this)
+ if (d->canvas->d->lastFocusItem == this)
d->canvas->d->lastFocusItem = 0;
- if(d->hasBeenActiveFocusPanel)
+ if (d->hasBeenActiveFocusPanel)
d->canvas->d->clearFocusPanel(this);
- if(d->hasFocus)
+ if (d->hasFocus)
d->canvas->d->clearFocusItem(this);
}
@@ -1354,7 +1354,7 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
if (parent() && d->data_ptr && d->data()->dirty) {
QSimpleCanvasLayer *l = parent()->layer();
- if(l) {
+ if (l) {
l->remDirty(this);
}
}
@@ -1362,7 +1362,7 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
d->parent->remChild(this);
- if(d->data_ptr)
+ if (d->data_ptr)
delete d->data_ptr;
}
}
@@ -1370,8 +1370,8 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
QSimpleCanvasItem::operator QGraphicsItem *()
{
Q_D(QSimpleCanvasItem);
- if(!d->graphicsItem) {
- if(parent()) {
+ if (!d->graphicsItem) {
+ if (parent()) {
qWarning("QSimpleCanvasItem: Only the root item can be converted into a QGraphicsItem");
return 0;
}
@@ -1413,42 +1413,42 @@ void QSimpleCanvasItemPrivate::setParentInternal(QSimpleCanvasItem *p)
{
Q_Q(QSimpleCanvasItem);
QSimpleCanvasItem *oldParent = parent;
- if(graphicsItem) {
- if(oldParent)
+ if (graphicsItem) {
+ if (oldParent)
oldParent->remChild(q);
parent = p;
graphicsItem->setParentItem(p->d_func()->graphicsItem);
- if(parent)
+ if (parent)
p->addChild(q);
} else {
bool canvasChange = false;
- if(p)
+ if (p)
canvasChange = (p->d_func()->canvas != canvas);
QSimpleCanvas *old = canvas;
QSimpleCanvasLayer *o = q->layer();
- if(q->parent()) {
+ if (q->parent()) {
q->update();
q->parent()->remChild(q);
}
parent = p;
QSimpleCanvasLayer *n = 0;
- if(q->parent()) {
+ if (q->parent()) {
q->parent()->addChild(q);
n = q->layer();
}
- if(o != n) {
+ if (o != n) {
data()->dirty = false;
data()->transformValid = false;
- if(o) o->remDirty(q);
- if(n) n->addDirty(q);
+ if (o) o->remDirty(q);
+ if (n) n->addDirty(q);
}
- if(canvasChange)
+ if (canvasChange)
canvasChanged(p->d_func()->canvas, old);
q->update();
@@ -1460,25 +1460,25 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent)
Q_Q(QSimpleCanvasItem);
Q_ASSERT(!graphicsItem);
graphicsItem = new QSimpleGraphicsItem(q);
- if(parent)
+ if (parent)
graphicsItem->setParentItem(parent);
QSimpleCanvasItemData *old = data_ptr;
data_ptr = 0;
- if(old) {
+ if (old) {
q->QSimpleCanvasItem::setX(old->x);
q->QSimpleCanvasItem::setY(old->y);
q->QSimpleCanvasItem::setZ(old->z);
q->QSimpleCanvasItem::setVisible(old->visible);
- if(old->transformUser)
+ if (old->transformUser)
q->QSimpleCanvasItem::setTransform(*old->transformUser);
q->QSimpleCanvasItem::setFlip(old->flip);
q->QSimpleCanvasItem::setAcceptedMouseButtons((Qt::MouseButtons)old->buttons);
delete old;
}
- if(scale != 1) {
+ if (scale != 1) {
qreal s = scale;
scale = 1;
q->QSimpleCanvasItem::setScale(s);
@@ -1486,9 +1486,9 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent)
q->setClipType(clip);
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
static_cast<QSimpleCanvasItemPrivate*>(children.at(ii)->d_ptr)->convertToGraphicsItem(graphicsItem);
- if(children.at(ii)->z() == 0)
+ if (children.at(ii)->z() == 0)
children.at(ii)->setZ(ii);
}
}
@@ -1501,14 +1501,14 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent)
void QSimpleCanvasItem::setParent(QSimpleCanvasItem *p)
{
Q_D(QSimpleCanvasItem);
- if(p == parent() || !p) return;
+ if (p == parent() || !p) return;
QObject::setParent(p);
- if(d->graphicsItem && !static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem)
+ if (d->graphicsItem && !static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem)
qWarning("QSimpleCanvasItem: Cannot reparent a QGraphicsView item to a QSimpleCanvas item");
- if(static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem && !d->graphicsItem) {
+ if (static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem && !d->graphicsItem) {
d->setParentInternal(0);
d->convertToGraphicsItem();
}
@@ -1524,45 +1524,45 @@ int QSimpleCanvasItemPrivate::dump(int indent)
QByteArray ba(indent * 2, ' ');
QByteArray state;
- if(options & QSimpleCanvasItem::MouseFilter)
+ if (options & QSimpleCanvasItem::MouseFilter)
state.append("i");
else
state.append("-");
- if(options & QSimpleCanvasItem::HoverEvents)
+ if (options & QSimpleCanvasItem::HoverEvents)
state.append("h");
else
state.append("-");
- if(options & QSimpleCanvasItem::MouseEvents)
+ if (options & QSimpleCanvasItem::MouseEvents)
state.append("m");
else
state.append("-");
- if(options & QSimpleCanvasItem::HasContents)
+ if (options & QSimpleCanvasItem::HasContents)
state.append("c");
else
state.append("-");
- if(options & QSimpleCanvasItem::SimpleItem)
+ if (options & QSimpleCanvasItem::SimpleItem)
state.append("s");
else
state.append("-");
- if(options & QSimpleCanvasItem::IsFocusPanel) {
- if(q->activeFocusPanel())
+ if (options & QSimpleCanvasItem::IsFocusPanel) {
+ if (q->activeFocusPanel())
state.append("P");
else
state.append("p");
} else {
state.append("-");
}
- if(options & QSimpleCanvasItem::IsFocusRealm)
+ if (options & QSimpleCanvasItem::IsFocusRealm)
state.append("r");
else
state.append("-");
- if(q->hasFocus()) {
- if(q->hasActiveFocus())
+ if (q->hasFocus()) {
+ if (q->hasActiveFocus())
state.append("F");
else
state.append("f");
} else {
- if(q->hasActiveFocus())
+ if (q->hasActiveFocus())
state.append("X");
else
state.append("-");
@@ -1570,13 +1570,13 @@ int QSimpleCanvasItemPrivate::dump(int indent)
QByteArray name;
QFxItem *i = qobject_cast<QFxItem *>(q);
- if(i)
+ if (i)
name = i->id().toLatin1();
qWarning().nospace() << ba.constData() << state.constData() << " " << children.count() << " " << q << " " << name.constData();
int rv = 0;
- for(int ii = 0; ii < children.count(); ++ii)
+ for (int ii = 0; ii < children.count(); ++ii)
rv += children.at(ii)->d_func()->dump(indent + 1);
return rv + 1;
@@ -1591,10 +1591,10 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
bool isRealm = (options & QSimpleCanvasItem::IsFocusPanel ||
options & QSimpleCanvasItem::IsFocusRealm);
- if(options & QSimpleCanvasItem::IsFocusPanel) {
+ if (options & QSimpleCanvasItem::IsFocusPanel) {
- if(q->activeFocusPanel()) {
- if(d & InActivePanel) {
+ if (q->activeFocusPanel()) {
+ if (d & InActivePanel) {
qWarning() << "State ERROR: Nested active focus panels";
rv = false;
}
@@ -1606,23 +1606,23 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
}
- if(q->hasActiveFocus()) {
- if(!(d & InActivePanel)) {
+ if (q->hasActiveFocus()) {
+ if (!(d & InActivePanel)) {
qWarning() << "State ERROR: Active focus in non-active panel";
rv = false;
}
- if(d & InRealm && !(d & InActiveFocusedRealm)) {
+ if (d & InRealm && !(d & InActiveFocusedRealm)) {
qWarning() << "State ERROR: Active focus in non-active-focused realm";
rv = false;
}
- if(!q->hasFocus()) {
+ if (!q->hasFocus()) {
qWarning() << "State ERROR: Active focus on element that does not have focus";
rv = false;
}
- if(*r & SeenActiveFocus) {
+ if (*r & SeenActiveFocus) {
qWarning() << "State ERROR: Two active focused elements in same realm";
rv = false;
}
@@ -1630,8 +1630,8 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
*r |= SeenActiveFocus;
}
- if(q->hasFocus()) {
- if(*r & SeenFocus) {
+ if (q->hasFocus()) {
+ if (*r & SeenFocus) {
qWarning() << "State ERROR: Two focused elements in same realm";
rv = false;
}
@@ -1639,20 +1639,20 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
*r |= SeenFocus;
}
- if(options & QSimpleCanvasItem::IsFocusRealm) {
+ if (options & QSimpleCanvasItem::IsFocusRealm) {
d |= InRealm;
- if(q->hasActiveFocus())
+ if (q->hasActiveFocus())
d |= InActiveFocusedRealm;
else
d &= ~InActiveFocusedRealm;
}
FocusStateCheckRDatas newR = NoCheckRData;
- if(isRealm)
+ if (isRealm)
r = &newR;
- for(int ii = 0; ii < children.count(); ++ii)
+ for (int ii = 0; ii < children.count(); ++ii)
rv &= children.at(ii)->d_func()->checkFocusState(d, r);
return rv;
@@ -1661,7 +1661,7 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
bool QSimpleCanvasItem::activeFocusPanel() const
{
QSimpleCanvas *c = canvas();
- if(!c) {
+ if (!c) {
Q_D(const QSimpleCanvasItem);
return d->wantsActiveFocusPanelPendingCanvas;
} else {
@@ -1671,18 +1671,18 @@ bool QSimpleCanvasItem::activeFocusPanel() const
void QSimpleCanvasItem::setActiveFocusPanel(bool b)
{
- if(!(options() & IsFocusPanel)) {
+ if (!(options() & IsFocusPanel)) {
qWarning("QSimpleCanvasItem::setActiveFocusPanel: Item is not a focus panel");
return;
}
QSimpleCanvas *c = canvas();
Q_D(QSimpleCanvasItem);
- if(c) {
- if(b) {
+ if (c) {
+ if (b) {
d->hasBeenActiveFocusPanel = true;
c->d->setActiveFocusPanel(this);
- } else if(d->hasBeenActiveFocusPanel) {
+ } else if (d->hasBeenActiveFocusPanel) {
d->hasBeenActiveFocusPanel = false;
c->d->clearFocusPanel(this);
}
@@ -1705,7 +1705,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findFirstFocusChild() const
for (int i = 0; i < children.count(); ++i) {
QSimpleCanvasItem *child = children.at(i);
- if(child->options() & IsFocusPanel)
+ if (child->options() & IsFocusPanel)
continue;
if (child->isFocusable())
@@ -1727,7 +1727,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findLastFocusChild() const
for (int i = children.count()-1; i >= 0; --i) {
QSimpleCanvasItem *child = children.at(i);
- if(child->options() & IsFocusPanel)
+ if (child->options() & IsFocusPanel)
continue;
if (child->isFocusable())
@@ -1746,8 +1746,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item)
if (focusChild)
return focusChild;
- if(item->options() & IsFocusPanel) {
- if(item->isFocusable())
+ if (item->options() & IsFocusPanel) {
+ if (item->isFocusable())
return item;
else
return 0;
@@ -1762,7 +1762,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item)
if (idx > 0) {
while (--idx >= 0) {
testFocus = children.at(idx);
- if(testFocus->options() & IsFocusPanel)
+ if (testFocus->options() & IsFocusPanel)
continue;
if (testFocus->isFocusable())
return testFocus;
@@ -1771,8 +1771,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item)
return testFocus;
}
}
- if(parent->options() & IsFocusPanel) {
- if(parent->isFocusable())
+ if (parent->options() & IsFocusPanel) {
+ if (parent->isFocusable())
return parent;
else
return 0;
@@ -1790,8 +1790,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item)
if (focusChild)
return focusChild;
- if(item->options() & IsFocusPanel) {
- if(item->isFocusable())
+ if (item->options() & IsFocusPanel) {
+ if (item->isFocusable())
return item;
else
return 0;
@@ -1806,7 +1806,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item)
if (idx >= 0) {
while (++idx < children.count()) {
testFocus = children.at(idx);
- if(testFocus->options() & IsFocusPanel)
+ if (testFocus->options() & IsFocusPanel)
continue;
if (testFocus->isFocusable())
return testFocus;
@@ -1815,8 +1815,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item)
return testFocus;
}
}
- if(parent->options() & IsFocusPanel) {
- if(parent->isFocusable())
+ if (parent->options() & IsFocusPanel) {
+ if (parent->isFocusable())
return parent;
else
return 0;
diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h
index 7a90c24..27a75bd 100644
--- a/src/declarative/canvas/qsimplecanvasitem_p.h
+++ b/src/declarative/canvas/qsimplecanvasitem_p.h
@@ -156,7 +156,7 @@ public:
QSimpleGraphicsItem *graphicsItem;
inline QSimpleCanvasItemData *data() const {
- if(!data_ptr) data_ptr = new QSimpleCanvasItemData;
+ if (!data_ptr) data_ptr = new QSimpleCanvasItemData;
return data_ptr;
}
mutable QSimpleCanvasItemData *data_ptr;
diff --git a/src/declarative/canvas/qsimplecanvasserver.cpp b/src/declarative/canvas/qsimplecanvasserver.cpp
index 7eebe65..4d4adda 100644
--- a/src/declarative/canvas/qsimplecanvasserver.cpp
+++ b/src/declarative/canvas/qsimplecanvasserver.cpp
@@ -55,7 +55,7 @@ QSimpleCanvasServer::QSimpleCanvasServer(int port, QObject *parent)
_time.start();
- if(!_tcpServer->listen(QHostAddress::Any, port)) {
+ if (!_tcpServer->listen(QHostAddress::Any, port)) {
qWarning() << "QSimpleCanvasServer: Cannot listen on port" << port;
return;
}
@@ -85,7 +85,7 @@ void QSimpleCanvasServer::addTiming(quint32 paint,
QByteArray ba = d.toLatin1();
// XXX
- for(int ii = 0; ii < _tcpClients.count(); ++ii)
+ for (int ii = 0; ii < _tcpClients.count(); ++ii)
// _tcpClients.at(ii)->write((const char *)data, 12);
_tcpClients.at(ii)->write(ba.constData(), ba.length());
}
@@ -94,8 +94,8 @@ void QSimpleCanvasServer::disconnected()
{
QTcpSocket *socket = static_cast<QTcpSocket *>(sender());
- for(int ii = 0; ii < _tcpClients.count(); ++ii) {
- if(_tcpClients.at(ii) == socket) {
+ for (int ii = 0; ii < _tcpClients.count(); ++ii) {
+ if (_tcpClients.at(ii) == socket) {
socket->disconnect();
socket->deleteLater();
_tcpClients.removeAt(ii);
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 44787b5..562a1c8 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -255,7 +255,7 @@ void QmlXmlListModel::fetch()
void QmlXmlListModel::requestFinished()
{
Q_D(QmlXmlListModel);
- if(d->reply->error() != QNetworkReply::NoError) {
+ if (d->reply->error() != QNetworkReply::NoError) {
d->reply->deleteLater();
d->reply = 0;
} else {
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index 7372866..f537da9 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -165,7 +165,7 @@ QFxItem *QFxAnchors::fill() const
void QFxAnchors::setFill(QFxItem *f)
{
Q_D(QFxAnchors);
- if(d->fill) {
+ if (d->fill) {
QObject::disconnect(d->fill, SIGNAL(leftChanged()), this, SLOT(fillChanged()));
QObject::disconnect(d->fill, SIGNAL(topChanged()), this, SLOT(fillChanged()));
QObject::disconnect(d->fill, SIGNAL(widthChanged()), this, SLOT(fillChanged()));
@@ -214,11 +214,11 @@ QFxItem *QFxAnchors::centeredIn() const
void QFxAnchors::setCenteredIn(QFxItem* c)
{
Q_D(QFxAnchors);
- if(!c){
+ if (!c){
qmlInfo(d->item) << "Cannot center in null item.";
return;
}
- if(c != d->item->itemParent() && c->itemParent() != d->item->itemParent()){
+ if (c != d->item->itemParent() && c->itemParent() != d->item->itemParent()){
qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling.";
return;
}
@@ -822,7 +822,7 @@ bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge.";
return false;
- }else if(anchor.item == item){
+ }else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
@@ -847,7 +847,7 @@ bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge.";
return false;
- }else if(anchor.item == item){
+ }else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp
index b5f0cc4..8f930d5 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/fx/qfxanimatedimageitem.cpp
@@ -102,7 +102,7 @@ QFxAnimatedImageItem::~QFxAnimatedImageItem()
bool QFxAnimatedImageItem::isPlaying() const
{
Q_D(const QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return false;
return d->_movie->state()==QMovie::Running;
}
@@ -110,9 +110,9 @@ bool QFxAnimatedImageItem::isPlaying() const
void QFxAnimatedImageItem::setPlaying(bool play)
{
Q_D(QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return;
- if(play)
+ if (play)
d->_movie->start();
else
d->_movie->stop();
@@ -129,7 +129,7 @@ void QFxAnimatedImageItem::setPlaying(bool play)
int QFxAnimatedImageItem::currentFrame() const
{
Q_D(const QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return -1;
return d->_movie->currentFrameNumber();
}
@@ -137,7 +137,7 @@ int QFxAnimatedImageItem::currentFrame() const
void QFxAnimatedImageItem::setCurrentFrame(int frame)
{
Q_D(QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return;
d->_movie->jumpToFrame(frame);
}
@@ -145,7 +145,7 @@ void QFxAnimatedImageItem::setCurrentFrame(int frame)
int QFxAnimatedImageItem::frameCount() const
{
Q_D(const QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return 0;
return d->_movie->frameCount();
}
@@ -153,13 +153,13 @@ int QFxAnimatedImageItem::frameCount() const
void QFxAnimatedImageItem::setSource(const QString &url)
{
Q_D(QFxAnimatedImageItem);
- if(url == d->source)
+ if (url == d->source)
return;
delete d->_movie;
d->_movie = 0;
- if(d->reply) {
+ if (d->reply) {
d->reply->deleteLater();
d->reply = 0;
}
@@ -167,7 +167,7 @@ void QFxAnimatedImageItem::setSource(const QString &url)
d->source = url;
d->url = qmlContext(this)->resolvedUrl(url);
- if(url.isEmpty()) {
+ if (url.isEmpty()) {
delete d->_movie;
d->status = Idle;
} else {
@@ -186,7 +186,7 @@ void QFxAnimatedImageItem::movieRequestFinished()
{
Q_D(QFxAnimatedImageItem);
d->_movie = new QMovie(d->reply);
- if(!d->_movie->isValid()){
+ if (!d->_movie->isValid()){
qWarning() << "Error Reading File " << d->url;
delete d->_movie;
d->_movie = 0;
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp
index ec2b9cc..3326ea8 100644
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ b/src/declarative/fx/qfxblendedimage.cpp
@@ -173,7 +173,7 @@ bool QFxBlendedImage::smoothTransform() const
void QFxBlendedImage::setSmoothTransform(bool s)
{
- if(_smooth == s)
+ if (_smooth == s)
return;
_smooth = s;
update();
@@ -186,7 +186,7 @@ void QFxBlendedImage::paintContents(QPainter &p)
if (primSrc.isNull() && secSrc.isNull())
return;
- if(_smooth) {
+ if (_smooth) {
p.save();
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth);
}
@@ -196,7 +196,7 @@ void QFxBlendedImage::paintContents(QPainter &p)
else
p.drawImage(0, 0, secPix);
- if(_smooth) {
+ if (_smooth) {
p.restore();
}
}
@@ -206,10 +206,10 @@ void QFxBlendedImage::paintContents(QPainter &p)
void QFxBlendedImage::paintGLContents(GLPainter &p)
{
static DualTextureBlendShader *shader = 0;
- if(!shader)
+ if (!shader)
shader = new DualTextureBlendShader();
- if(dirty) {
+ if (dirty) {
prim.clear();
sec.clear();
prim.setImage(primPix);
@@ -218,7 +218,7 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
dirty = false;
}
- if(prim.isNull() || sec.isNull()) {
+ if (prim.isNull() || sec.isNull()) {
return;
}
@@ -228,9 +228,9 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
float widthV = width();
float heightV = height();
- if(!widthV)
+ if (!widthV)
widthV = qMax(primPix.width(), secPix.width());
- if(!heightV)
+ if (!heightV)
heightV = qMax(primPix.height(), secPix.height());
vertices[0] = 0; vertices[1] = heightV;
@@ -243,12 +243,12 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
texVertices[4] = 0; texVertices[5] = 1;
texVertices[6] = 1; texVertices[7] = 1;
- if(_blend == 0 || _blend == 1) {
+ if (_blend == 0 || _blend == 1) {
QGLShaderProgram *tshader = p.useTextureShader();
GLTexture *tex = 0;
- if(_blend == 0)
+ if (_blend == 0)
tex = &prim;
else
tex = &sec;
@@ -271,8 +271,8 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
shader->enable();
shader->setOpacity(1);
qreal b = _blend;
- if(b > 1) b = 1;
- else if(b < 0) b = 0;
+ if (b > 1) b = 1;
+ else if (b < 0) b = 0;
shader->setBlend(b);
shader->setTransform(p.activeTransform);
diff --git a/src/declarative/fx/qfxblurfilter.cpp b/src/declarative/fx/qfxblurfilter.cpp
index 748fd8b..ad3eebc 100644
--- a/src/declarative/fx/qfxblurfilter.cpp
+++ b/src/declarative/fx/qfxblurfilter.cpp
@@ -124,7 +124,7 @@ qreal QFxBlurFilter::radius() const
void QFxBlurFilter::setRadius(qreal radius)
{
- if(d->radius == radius) return;
+ if (d->radius == radius) return;
d->radius = radius;
emit radiusChanged(radius);
update();
@@ -133,7 +133,7 @@ void QFxBlurFilter::setRadius(qreal radius)
QRectF QFxBlurFilter::itemBoundingRect(const QRectF &r) const
{
QRectF rv = r;
- if(d->radius > 0)
+ if (d->radius > 0)
rv.adjust(-d->radius, -d->radius, d->radius, d->radius);
return rv;
}
@@ -143,7 +143,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
{
#if defined(QFX_RENDER_OPENGL2)
#if 1
- if(d->radius <= 0) {
+ if (d->radius <= 0) {
renderToScreen();
return;
}
@@ -156,7 +156,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
radius *= blurScale;
QGLFramebufferObject *fbo = renderToFBO(blurScale);
- if(!fbo)
+ if (!fbo)
return;
float height = r.height();
@@ -201,7 +201,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
BlurTextureShader *shader = item->basicShaders()->blurTexture();
shader->enable();
shader->setTransform(trans);
- if(steps > 1) {
+ if (steps > 1) {
shader->setStep(xstep * 2);
shader->setSteps(steps / 2);
} else {
@@ -252,7 +252,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
BlurTextureShader *shader = item->basicShaders()->blurTexture();
shader->enable();
shader->setTransform(trans);
- if(steps > 1) {
+ if (steps > 1) {
shader->setStep(ystep * 2);
shader->setSteps(steps / 2);
} else {
@@ -303,7 +303,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
releaseFBO(fbo);
#else
#if 0
- if(d->radius <= 0) {
+ if (d->radius <= 0) {
renderToScreen();
return;
}
@@ -314,7 +314,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
float scale = 0.5;
float scalePercent = scale / d->radius;
QGLFramebufferObject *fbo = renderToFBO(scalePercent);
- if(!fbo)
+ if (!fbo)
return;
QGLFramebufferObject *xfbo = acquireFBO(QSize(scale * r.width(), fbo->height()));
diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp
index 02a6c86..951c25d 100644
--- a/src/declarative/fx/qfxcomponentinstance.cpp
+++ b/src/declarative/fx/qfxcomponentinstance.cpp
@@ -97,7 +97,7 @@ QmlComponent *QFxComponentInstance::component() const
void QFxComponentInstance::setComponent(QmlComponent *c)
{
Q_D(QFxComponentInstance);
- if(d->component) {
+ if (d->component) {
qmlInfo(this) << "component is a write-once property.";
return;
}
@@ -108,11 +108,11 @@ void QFxComponentInstance::setComponent(QmlComponent *c)
void QFxComponentInstance::create()
{
Q_D(QFxComponentInstance);
- if(d->component) {
+ if (d->component) {
QObject *obj= d->component->create(qmlContext(this));
- if(obj) {
+ if (obj) {
QFxItem *objitem = qobject_cast<QFxItem *>(obj);
- if(objitem) {
+ if (objitem) {
d->instance = objitem;
objitem->setItemParent(this);
objitem->setFocus(true);
@@ -130,10 +130,10 @@ void QFxComponentInstance::create()
void QFxComponentInstance::updateSize()
{
QFxItem *i = instance();
- if(i) {
- if(!widthValid())
+ if (i) {
+ if (!widthValid())
setImplicitWidth(i->width());
- if(!heightValid())
+ if (!heightValid())
setImplicitHeight(i->height());
}
}
diff --git a/src/declarative/fx/qfxcontentwrapper.cpp b/src/declarative/fx/qfxcontentwrapper.cpp
index 5ce5430..a155d2b 100644
--- a/src/declarative/fx/qfxcontentwrapper.cpp
+++ b/src/declarative/fx/qfxcontentwrapper.cpp
@@ -76,7 +76,7 @@ void QFxContentWrapper::componentComplete()
target = target->itemParent();
QList<QFxItem*> myContent(*content());
- for(int ii = 0; ii < myContent.count(); ++ii)
+ for (int ii = 0; ii < myContent.count(); ++ii)
myContent.at(ii)->setParent(target);
}
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index b6eaa8e..671d65d 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -121,16 +121,16 @@ void QFxFlickablePrivate::init()
void QFxFlickablePrivate::fixupX()
{
Q_Q(QFxFlickable);
- if(!q->xflick() || _moveX.timeLine())
+ if (!q->xflick() || _moveX.timeLine())
return;
vTime = _tl.time();
- if(_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) {
+ if (_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) {
_tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
flicked = false;
//emit flickingChanged();
- } else if(_moveX.value() < q->maxXExtent()) {
+ } else if (_moveX.value() < q->maxXExtent()) {
_tl.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
flicked = false;
//emit flickingChanged();
@@ -140,15 +140,15 @@ void QFxFlickablePrivate::fixupX()
void QFxFlickablePrivate::fixupY()
{
Q_Q(QFxFlickable);
- if(!q->yflick() || _moveY.timeLine())
+ if (!q->yflick() || _moveY.timeLine())
return;
vTime = _tl.time();
- if(_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
+ if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
_tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
//emit flickingChanged();
- } else if(_moveY.value() < q->maxYExtent()) {
+ } else if (_moveY.value() < q->maxYExtent()) {
_tl.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
//emit flickingChanged();
} else {
@@ -560,17 +560,17 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool rejectX = false;
bool moved = false;
- if(q->yflick()) {
+ if (q->yflick()) {
int dy = int(event->pos().y() - pressPos.y());
if (qAbs(dy) > FlickThreshold || pressTime.elapsed() > 200) {
qreal newY = dy + pressY;
const qreal minY = q->minYExtent();
const qreal maxY = q->maxYExtent();
- if(newY > minY)
+ if (newY > minY)
newY = minY + (newY - minY) / 2;
- if(newY < maxY && maxY - minY < 0)
+ if (newY < maxY && maxY - minY < 0)
newY = maxY + (newY - maxY) / 2;
- if(q->overShoot() || (newY <= minY && newY >= maxY)) {
+ if (q->overShoot() || (newY <= minY && newY >= maxY)) {
if (dragMode == QFxFlickable::Hard)
_moveY.setValue(newY);
else
@@ -583,11 +583,11 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if(q->xflick()) {
+ if (q->xflick()) {
int dx = int(event->pos().x() - pressPos.x());
if (qAbs(dx) > FlickThreshold || pressTime.elapsed() > 200) {
qreal newX = dx + pressX;
- if(q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) {
+ if (q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) {
if (dragMode == QFxFlickable::Hard)
_moveX.setValue(newX);
else
@@ -600,23 +600,23 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if(!lastPos.isNull()) {
+ if (!lastPos.isNull()) {
qreal elapsed = qreal(lastPosTime.restart()) / 1000.;
- if(elapsed <= 0)
+ if (elapsed <= 0)
elapsed = 1;
- if(q->yflick()) {
+ if (q->yflick()) {
qreal diff = event->pos().y() - lastPos.y();
velocityY = diff / elapsed;
}
- if(q->xflick()) {
+ if (q->xflick()) {
qreal diff = event->pos().x() - lastPos.x();
velocityX = diff / elapsed;
}
}
- if(rejectY) velocityY = 0;
- if(rejectX) velocityX = 0;
+ if (rejectY) velocityY = 0;
+ if (rejectX) velocityX = 0;
if (moved) {
q->viewportMoved();
@@ -640,20 +640,20 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *)
}
vTime = _tl.time();
- if(qAbs(velocityY) > 10) {
+ if (qAbs(velocityY) > 10) {
qreal maxDistance = -1;
// -ve velocity means list is moving up
- if(velocityY > 0) {
- if(_moveY.value() < q->minYExtent())
+ if (velocityY > 0) {
+ if (_moveY.value() < q->minYExtent())
maxDistance = qAbs(q->minYExtent() -_moveY.value() + (overShoot?30:0));
} else {
- if(_moveY.value() > q->maxYExtent())
+ if (_moveY.value() > q->maxYExtent())
maxDistance = qAbs(q->maxYExtent() - _moveY.value()) + (overShoot?30:0);
}
- if(maxDistance > 0) {
+ if (maxDistance > 0) {
qreal v = velocityY;
- if(maxVelocity != -1 && maxVelocity < qAbs(v)) {
- if(v < 0)
+ if (maxVelocity != -1 && maxVelocity < qAbs(v)) {
+ if (v < 0)
v = -maxVelocity;
else
v = maxVelocity;
@@ -669,20 +669,20 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *)
} else {
fixupY();
}
- if(qAbs(velocityX) > 10) {
+ if (qAbs(velocityX) > 10) {
qreal maxDistance = -1;
// -ve velocity means list is moving up
- if(velocityX > 0) {
- if(_moveX.value() < q->minXExtent())
+ if (velocityX > 0) {
+ if (_moveX.value() < q->minXExtent())
maxDistance = qAbs(q->minXExtent()) -_moveX.value() + (overShoot?30:0);
} else {
- if(_moveX.value() > q->maxXExtent())
+ if (_moveX.value() > q->maxXExtent())
maxDistance = qAbs(q->maxXExtent() - _moveX.value()) + (overShoot?30:0);
}
- if(maxDistance > 0) {
+ if (maxDistance > 0) {
qreal v = velocityX;
- if(maxVelocity != -1 && maxVelocity < qAbs(v)) {
- if(v < 0)
+ if (maxVelocity != -1 && maxVelocity < qAbs(v)) {
+ if (v < 0)
v = -maxVelocity;
else
v = maxVelocity;
@@ -701,7 +701,7 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *)
stealMouse = false;
lastPosTime = QTime();
- if(!_tl.isActive())
+ if (!_tl.isActive())
q->movementEnding();
}
@@ -766,7 +766,7 @@ void QFxFlickable::viewportMoved()
qreal prevY = d->lastFlickablePosition.x();
qreal prevX = d->lastFlickablePosition.y();
d->velocityTimeline.clear();
- if(d->pressed) {
+ if (d->pressed) {
qreal xVelocity = (prevX - d->_moveX.value()) * 1000 / elapsed;
qreal yVelocity = (prevY - d->_moveY.value()) * 1000 / elapsed;
d->velocityTimeline.move(d->xVelocity, xVelocity, d->velocityDecay);
@@ -804,7 +804,7 @@ void QFxFlickablePrivate::data_append(QObject *o)
{
Q_Q(QFxFlickable);
QFxItem *i = qobject_cast<QFxItem *>(o);
- if(i)
+ if (i)
_flick->children()->append(i);
else
o->setParent(q);
@@ -901,7 +901,7 @@ void QFxFlickable::setViewportWidth(int w)
if (d->vWidth == w)
return;
d->vWidth = w;
- if(w < 0)
+ if (w < 0)
d->_flick->setWidth(width());
else
d->_flick->setWidth(w);
@@ -913,7 +913,7 @@ void QFxFlickable::setWidth(int w)
{
Q_D(QFxFlickable);
QFxItem::setWidth(w);
- if(d->vWidth < 0) {
+ if (d->vWidth < 0) {
d->_flick->setWidth(w);
emit viewportWidthChanged();
d->updateBeginningEnd();
@@ -924,7 +924,7 @@ void QFxFlickable::setHeight(int h)
{
Q_D(QFxFlickable);
QFxItem::setHeight(h);
- if(d->vHeight < 0) {
+ if (d->vHeight < 0) {
d->_flick->setHeight(h);
emit viewportHeightChanged();
d->updateBeginningEnd();
@@ -947,7 +947,7 @@ void QFxFlickable::setViewportHeight(int h)
if (d->vHeight == h)
return;
d->vHeight = h;
- if(h < 0)
+ if (h < 0)
d->_flick->setHeight(height());
else
d->_flick->setHeight(h);
@@ -958,7 +958,7 @@ void QFxFlickable::setViewportHeight(int h)
int QFxFlickable::vWidth() const
{
Q_D(const QFxFlickable);
- if(d->vWidth < 0)
+ if (d->vWidth < 0)
return width();
else
return d->vWidth;
@@ -967,7 +967,7 @@ int QFxFlickable::vWidth() const
int QFxFlickable::vHeight() const
{
Q_D(const QFxFlickable);
- if(d->vHeight < 0)
+ if (d->vHeight < 0)
return height();
else
return d->vHeight;
@@ -1028,7 +1028,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
bool QFxFlickable::mouseFilter(QGraphicsSceneMouseEvent *e)
{
- if(!isVisible())
+ if (!isVisible())
return false;
switch (e->type()) {
case QEvent::GraphicsSceneMousePress:
@@ -1060,7 +1060,7 @@ int QFxFlickable::maximumFlickVelocity() const
void QFxFlickable::setMaximumFlickVelocity(int v)
{
Q_D(QFxFlickable);
- if(v == d->maxVelocity)
+ if (v == d->maxVelocity)
return;
d->maxVelocity = v;
}
@@ -1081,7 +1081,7 @@ void QFxFlickable::setVelocityDecay(int decay)
{
Q_D(QFxFlickable);
Q_ASSERT(decay >= 0);
- if(decay == d->velocityDecay)
+ if (decay == d->velocityDecay)
return;
d->velocityDecay = decay;
emit velocityDecayChanged(decay);
@@ -1096,7 +1096,7 @@ bool QFxFlickable::isMoving() const
void QFxFlickable::movementStarting()
{
Q_D(QFxFlickable);
- if(!d->moving) {
+ if (!d->moving) {
d->moving = true;
emit movingChanged();
emit movementStarted();
@@ -1106,7 +1106,7 @@ void QFxFlickable::movementStarting()
void QFxFlickable::movementEnding()
{
Q_D(QFxFlickable);
- if(d->moving) {
+ if (d->moving) {
d->moving = false;
emit movingChanged();
emit movementEnded();
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index ee14348..9db0b57 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -126,13 +126,13 @@ QFxItem *QFxFlipable::front()
void QFxFlipable::setFront(QFxItem *front)
{
Q_D(QFxFlipable);
- if(d->front) {
+ if (d->front) {
qmlInfo(this) << "front is a write-once property";
return;
}
d->front = front;
children()->append(d->front);
- if(Back == d->current)
+ if (Back == d->current)
d->front->setOpacity(0.);
}
@@ -145,13 +145,13 @@ QFxItem *QFxFlipable::back()
void QFxFlipable::setBack(QFxItem *back)
{
Q_D(QFxFlipable);
- if(d->back) {
+ if (d->back) {
qmlInfo(this) << "back is a write-once property";
return;
}
d->back = back;
children()->append(d->back);
- if(Front == d->current)
+ if (Front == d->current)
d->back->setOpacity(0.);
}
@@ -182,36 +182,36 @@ void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans)
(p1.y() - p2.y()) * (p3.x() - p2.x());
Side newSide;
- if(cross > 0) {
+ if (cross > 0) {
newSide = Back;
} else {
newSide = Front;
}
- if(newSide != d->current) {
+ if (newSide != d->current) {
d->current = newSide;
if (d->current==Back) {
QSimpleCanvas::Matrix mat;
#ifdef QFX_RENDER_OPENGL
mat.translate(d->back->width()/2,d->back->height()/2, 0);
- if(d->back->width() && p1.x() >= p2.x())
+ if (d->back->width() && p1.x() >= p2.x())
mat.rotate(180, 0, 1, 0);
- if(d->back->height() && p2.y() >= p3.y())
+ if (d->back->height() && p2.y() >= p3.y())
mat.rotate(180, 1, 0, 0);
mat.translate(-d->back->width()/2,-d->back->height()/2, 0);
#else
mat.translate(d->back->width()/2,d->back->height()/2);
- if(d->back->width() && p1.x() >= p2.x())
+ if (d->back->width() && p1.x() >= p2.x())
mat.rotate(180, Qt::YAxis);
- if(d->back->height() && p2.y() >= p3.y())
+ if (d->back->height() && p2.y() >= p3.y())
mat.rotate(180, Qt::XAxis);
mat.translate(-d->back->width()/2,-d->back->height()/2);
#endif
d->back->setTransform(mat);
}
- if(d->front)
+ if (d->front)
d->front->setOpacity((d->current==Front)?1.:0.);
- if(d->back)
+ if (d->back)
d->back->setOpacity((d->current==Back)?1.:0.);
emit sideChanged();
}
diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp
index 1bca424..67c456e 100644
--- a/src/declarative/fx/qfxfocuspanel.cpp
+++ b/src/declarative/fx/qfxfocuspanel.cpp
@@ -79,7 +79,7 @@ QFxFocusPanel::~QFxFocusPanel()
bool QFxFocusPanel::isActive() const
{
QSimpleCanvas *canvas = QSimpleCanvasItem::canvas();
- if(canvas)
+ if (canvas)
return canvas->activeFocusPanel() == this;
else
return false;
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index b2fb1a1..a45c28f 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -80,7 +80,7 @@ public:
static QFxGridViewAttached *properties(QObject *obj) {
QFxGridViewAttached *rv = attachedProperties.value(obj);
- if(!rv) {
+ if (!rv) {
rv = new QFxGridViewAttached(obj);
attachedProperties.insert(obj, rv);
}
@@ -998,7 +998,7 @@ int QFxGridView::cacheBuffer() const
void QFxGridView::setCacheBuffer(int buffer)
{
Q_D(QFxGridView);
- if(d->buffer != buffer) {
+ if (d->buffer != buffer) {
d->buffer = buffer;
if (isComponentComplete())
refill();
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index d99b9e5..ab0512c 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -131,7 +131,7 @@ void QFxHighlightFilter::imageLoaded()
{
QImage img = QFxPixmap(d->url);
#if defined(QFX_RENDER_OPENGL2)
- if(!img.isNull())
+ if (!img.isNull())
d->tex.setImage(img);
#endif
emit sourceChanged(d->source);
@@ -142,14 +142,14 @@ void QFxHighlightFilter::setSource(const QString &f)
{
if (d->source == f)
return;
- if(!d->source.isEmpty())
+ if (!d->source.isEmpty())
QFxPixmap::cancelGet(d->url, this, SLOT(imageLoaded()));
d->source = f;
d->url = qmlContext(this)->resolvedUrl(f);
#if defined(QFX_RENDER_OPENGL2)
d->tex.clear();
#endif
- if(!f.isEmpty())
+ if (!f.isEmpty())
QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded()));
else
emit sourceChanged(d->source);
@@ -171,13 +171,13 @@ bool QFxHighlightFilter::tiled() const
void QFxHighlightFilter::setTiled(bool t)
{
- if(t == d->tiled)
+ if (t == d->tiled)
return;
d->tiled = t;
#if defined(QFX_RENDER_OPENGL2)
- if(d->tiled) {
+ if (d->tiled) {
d->tex.setHorizontalWrap(GLTexture::ClampToEdge);
d->tex.setVerticalWrap(GLTexture::ClampToEdge);
} else {
@@ -206,7 +206,7 @@ int QFxHighlightFilter::xOffset() const
void QFxHighlightFilter::setXOffset(int x)
{
- if(x == d->xOffset)
+ if (x == d->xOffset)
return;
d->xOffset = x;
@@ -227,7 +227,7 @@ int QFxHighlightFilter::yOffset() const
void QFxHighlightFilter::setYOffset(int y)
{
- if(y == d->yOffset)
+ if (y == d->yOffset)
return;
d->yOffset = y;
@@ -240,7 +240,7 @@ void QFxHighlightFilter::setYOffset(int y)
void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
{
#if defined(QFX_RENDER_OPENGL2)
- if(d->tex.isNull()) {
+ if (d->tex.isNull()) {
renderToScreen();
} else {
QSimpleCanvasItem *item = this->item();
@@ -266,9 +266,9 @@ void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
float texXOffset = 0;
float texYOffset = 0;
- if(xOffset())
+ if (xOffset())
texXOffset = float(xOffset()) / float(d->tex.width());
- if(yOffset())
+ if (yOffset())
texYOffset = float(yOffset()) / float(d->tex.height());
GLfloat addTexVert[] = { texXOffset, texYOffset,
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index dfe9b43..a34cd12 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -124,7 +124,7 @@ QFxImage::QFxImage(QFxImagePrivate &dd, QFxItem *parent)
QFxImage::~QFxImage()
{
Q_D(const QFxImage);
- if(d->reply)
+ if (d->reply)
d->reply->deleteLater();
}
@@ -251,7 +251,7 @@ bool QFxImage::isOpaque() const
void QFxImage::setOpaque(bool o)
{
Q_D(QFxImage);
- if(o == d->_opaque)
+ if (o == d->_opaque)
return;
d->_opaque = o;
d->_pix.setOpaque(o);
@@ -300,7 +300,7 @@ bool QFxImage::smoothTransform() const
void QFxImage::setSmoothTransform(bool s)
{
Q_D(QFxImage);
- if(d->_smooth == s)
+ if (d->_smooth == s)
return;
d->_smooth = s;
update();
@@ -318,10 +318,10 @@ void QFxImage::dump(int depth)
void QFxImage::paintContents(QPainter &p)
{
Q_D(QFxImage);
- if(d->_pix.isNull())
+ if (d->_pix.isNull())
return;
- if(d->_smooth) {
+ if (d->_smooth) {
p.save();
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->_smooth);
}
@@ -348,7 +348,7 @@ void QFxImage::paintContents(QPainter &p)
p.restore();
} else if (!d->_scaleGrid || d->_scaleGrid->isNull()) {
- if(width() != pix.width() || height() != pix.height()) {
+ if (width() != pix.width() || height() != pix.height()) {
QTransform scale;
scale.scale(width() / qreal(pix.width()),
height() / qreal(pix.height()));
@@ -368,45 +368,45 @@ void QFxImage::paintContents(QPainter &p)
const int ySide = sgt + sgb;
// Upper left
- if(sgt && sgl)
+ if (sgt && sgl)
p.drawImage(QRect(0, 0, sgl, sgt), pix, QRect(0, 0, sgl, sgt));
// Upper middle
- if(pix.width() - xSide && sgt)
+ if (pix.width() - xSide && sgt)
p.drawImage(QRect(sgl, 0, width() - xSide, sgt), pix,
QRect(sgl, 0, pix.width() - xSide, sgt));
// Upper right
- if(sgt && pix.width() - sgr)
+ if (sgt && pix.width() - sgr)
p.drawImage(QPoint(width()-sgr, 0), pix,
QRect(pix.width()-sgr, 0, sgr, sgt));
// Middle left
- if(sgl && pix.height() - ySide)
+ if (sgl && pix.height() - ySide)
p.drawImage(QRect(0, sgt, sgl, height() - ySide), pix,
QRect(0, sgt, sgl, pix.height() - ySide));
// Middle
- if(pix.width() - xSide && pix.height() - ySide)
+ if (pix.width() - xSide && pix.height() - ySide)
p.drawImage(QRect(sgl, sgt, width() - xSide, height() - ySide),
pix,
QRect(sgl, sgt, pix.width() - xSide, pix.height() - ySide));
// Middle right
- if(sgr && pix.height() - ySide)
+ if (sgr && pix.height() - ySide)
p.drawImage(QRect(width()-sgr, sgt, sgr, height() - ySide), pix,
QRect(pix.width()-sgr, sgt, sgr, pix.height() - ySide));
// Lower left
- if(sgl && sgr)
+ if (sgl && sgr)
p.drawImage(QPoint(0, height() - sgb), pix,
QRect(0, pix.height() - sgb, sgl, sgb));
// Lower Middle
- if(pix.width() - xSide && sgb)
+ if (pix.width() - xSide && sgb)
p.drawImage(QRect(sgl, height() - sgb, width() - xSide, sgb), pix,
QRect(sgl, pix.height() - sgb, pix.width() - xSide, sgb));
// Lower Right
- if(sgr && sgb)
+ if (sgr && sgb)
p.drawImage(QPoint(width()-sgr, height() - sgb), pix,
QRect(pix.width()-sgr, pix.height() - sgb, sgr, sgb));
}
- if(d->_smooth) {
+ if (d->_smooth) {
p.restore();
}
}
@@ -416,10 +416,10 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
{
Q_D(QFxImage);
- if(d->_pix.isNull() || (d->_scaleGrid && !d->_scaleGrid->isNull()))
+ if (d->_pix.isNull() || (d->_scaleGrid && !d->_scaleGrid->isNull()))
return 0;
- if(count < 8)
+ if (count < 8)
return 8;
d->checkDirty();
@@ -434,7 +434,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
*texture = &d->_tex;
- if(d->_tiled) {
+ if (d->_tiled) {
float tileWidth = widthV / d->_pix.width();
float tileHeight = heightV / d->_pix.height();
texVertices[0] = 0; texVertices[1] = 0;
@@ -453,7 +453,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
void QFxImagePrivate::checkDirty()
{
- if(_texDirty && !_pix.isNull()) {
+ if (_texDirty && !_pix.isNull()) {
_tex.setImage(_pix);
_tex.setHorizontalWrap(GLTexture::Repeat);
_tex.setVerticalWrap(GLTexture::Repeat);
@@ -465,18 +465,18 @@ void QFxImagePrivate::checkDirty()
void QFxImage::paintGLContents(GLPainter &p)
{
Q_D(QFxImage);
- if(d->_pix.isNull())
+ if (d->_pix.isNull())
return;
QGLShaderProgram *shader = p.useTextureShader();
bool restoreBlend = false;
- if(isOpaque() && p.activeOpacity == 1) {
+ if (isOpaque() && p.activeOpacity == 1) {
glDisable(GL_BLEND);
restoreBlend = true;
}
- if(d->_tiled || (!d->_scaleGrid || d->_scaleGrid->isNull())) {
+ if (d->_tiled || (!d->_scaleGrid || d->_scaleGrid->isNull())) {
GLfloat vertices[8];
GLfloat texVertices[8];
@@ -498,7 +498,7 @@ void QFxImage::paintGLContents(GLPainter &p)
float imgWidth = d->_pix.width();
float imgHeight = d->_pix.height();
- if(!imgWidth || !imgHeight) {
+ if (!imgWidth || !imgHeight) {
if (restoreBlend)
glEnable(GL_BLEND);
return;
@@ -521,19 +521,19 @@ void QFxImage::paintGLContents(GLPainter &p)
const int sgt = d->_scaleGrid->top();
const int sgb = d->_scaleGrid->bottom();
- if(sgl) {
+ if (sgl) {
texleft = float(sgl) / imgWidth;
imgleft = sgl;
}
- if(sgr) {
+ if (sgr) {
texright = 1. - float(sgr) / imgWidth;
imgright = widthV - sgr;
}
- if(sgt) {
+ if (sgt) {
textop = 1. - float(sgb) / imgHeight;
imgtop = sgt;
}
- if(sgb) {
+ if (sgb) {
texbottom = float(sgt) / imgHeight;
imgbottom = heightV - sgb;
}
@@ -610,20 +610,20 @@ void QFxImage::paintGLContents(GLPainter &p)
void QFxImage::paintGLContents(GLPainter &p)
{
Q_D(QFxImage);
- if(d->_pix.isNull())
+ if (d->_pix.isNull())
return;
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(p.activeTransform.data());
bool restoreBlend = false;
- if(isOpaque() && p.activeOpacity == 1) {
+ if (isOpaque() && p.activeOpacity == 1) {
glDisable(GL_BLEND);
restoreBlend = true;
}
glEnable(GL_TEXTURE_2D);
- if(p.activeOpacity == 1.) {
+ if (p.activeOpacity == 1.) {
GLint i = GL_REPLACE;
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i);
} else {
@@ -632,7 +632,7 @@ void QFxImage::paintGLContents(GLPainter &p)
glColor4f(1, 1, 1, p.activeOpacity);
}
- if(d->_tiled || !d->_scaleGrid || d->_scaleGrid->isNull()) {
+ if (d->_tiled || !d->_scaleGrid || d->_scaleGrid->isNull()) {
GLfloat vertices[8];
GLfloat texVertices[8];
@@ -660,7 +660,7 @@ void QFxImage::paintGLContents(GLPainter &p)
float imgWidth = d->_pix.width();
float imgHeight = d->_pix.height();
- if(!imgWidth || !imgHeight) {
+ if (!imgWidth || !imgHeight) {
if (restoreBlend)
glEnable(GL_BLEND);
return;
@@ -683,19 +683,19 @@ void QFxImage::paintGLContents(GLPainter &p)
const int sgt = d->_scaleGrid->top();
const int sgb = d->_scaleGrid->bottom();
- if(sgl) {
+ if (sgl) {
texleft = float(sgl) / imgWidth;
imgleft = sgl;
}
- if(sgr) {
+ if (sgr) {
texright = 1. - float(sgr) / imgWidth;
imgright = widthV - sgr;
}
- if(sgt) {
+ if (sgt) {
textop = 1. - float(sgb) / imgHeight;
imgtop = sgt;
}
- if(sgb) {
+ if (sgb) {
texbottom = float(sgt) / imgHeight;
imgbottom = heightV - sgb;
}
@@ -827,10 +827,10 @@ QString QFxImage::source() const
void QFxImage::setSource(const QString &url)
{
Q_D(QFxImage);
- if(url == d->source)
+ if (url == d->source)
return;
- if(d->reply) {
+ if (d->reply) {
d->reply->deleteLater();
d->reply = 0;
}
@@ -844,7 +844,7 @@ void QFxImage::setSource(const QString &url)
d->url = qmlContext(this)->resolvedUrl(url);
d->sciurl = QUrl();
- if(url.isEmpty()) {
+ if (url.isEmpty()) {
setPixmap(QPixmap());
d->status = Idle;
} else {
@@ -898,7 +898,7 @@ void QFxImage::requestFinished()
void QFxImage::sciRequestFinished()
{
Q_D(QFxImage);
- if(d->reply->error() != QNetworkReply::NoError) {
+ if (d->reply->error() != QNetworkReply::NoError) {
d->status = Error;
d->reply->deleteLater();
d->reply = 0;
@@ -915,7 +915,7 @@ void QFxImage::sciRequestFinished()
void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
{
Q_D(QFxImage);
- if(!sci.isValid()) {
+ if (!sci.isValid()) {
d->status = Error;
emit statusChanged(d->status);
} else {
diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h
index 46aea49..fbb4c44 100644
--- a/src/declarative/fx/qfximage_p.h
+++ b/src/declarative/fx/qfximage_p.h
@@ -89,7 +89,7 @@ public:
QFxScaleGrid *scaleGrid()
{
- if(!_scaleGrid)
+ if (!_scaleGrid)
_scaleGrid = new QFxScaleGrid;
return _scaleGrid;
}
diff --git a/src/declarative/fx/qfximageitem.cpp b/src/declarative/fx/qfximageitem.cpp
index a6f6d8f..2a33a92 100644
--- a/src/declarative/fx/qfximageitem.cpp
+++ b/src/declarative/fx/qfximageitem.cpp
@@ -155,7 +155,7 @@ QSize QFxImageItem::contentsSize() const
void QFxImageItem::setSmooth(bool smooth)
{
Q_D(QFxImageItem);
- if(d->smooth == smooth) return;
+ if (d->smooth == smooth) return;
d->smooth = smooth;
clearCache();
update();
@@ -169,7 +169,7 @@ void QFxImageItem::setSmooth(bool smooth)
void QFxImageItem::setContentsSize(const QSize &size)
{
Q_D(QFxImageItem);
- if(d->contentsSize == size) return;
+ if (d->contentsSize == size) return;
d->contentsSize = size;
clearCache();
update();
@@ -232,7 +232,7 @@ void QFxImageItem::paintGLContents(GLPainter &p)
return;
#if defined(QFX_RENDER_QPAINTER)
- if(d->smooth) {
+ if (d->smooth) {
p.save();
p.setRenderHints(QPainter::Antialiasing, true);
p.setRenderHints(QPainter::SmoothPixmapTransform, true);
@@ -335,7 +335,7 @@ void QFxImageItem::paintGLContents(GLPainter &p)
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
#if defined(QFX_RENDER_QPAINTER)
- if(d->smooth)
+ if (d->smooth)
p.restore();
#endif
}
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 2f8ce92..e06a426 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -451,7 +451,7 @@ void QFxItem::setItemParent(QFxItem *parent)
*/
void QFxItem::moveToParent(QFxItem *parent)
{
- if(parent && itemParent()) {
+ if (parent && itemParent()) {
QPointF me = itemParent()->mapToScene(QPointF(0,0));
QPointF them = parent->mapToScene(QPointF(0,0));
@@ -476,25 +476,25 @@ void QFxItem::moveToParent(QFxItem *parent)
qreal yDiff = them.y() - me.y();
- if(themx.x() == 0.) {
+ if (themx.x() == 0.) {
ry = xDiff / themy.x();
rx = (yDiff - ry * themy.y()) / themx.y();
- } else if(themy.x() == 0.) {
+ } else if (themy.x() == 0.) {
rx = xDiff / themx.x();
ry = (yDiff - rx * themx.y()) / themy.y();
- } else if(themx.y() == 0.) {
+ } else if (themx.y() == 0.) {
ry = yDiff / themy.y();
rx = (xDiff - ry * themy.x()) / themx.x();
- } else if(themy.y() == 0.) {
+ } else if (themy.y() == 0.) {
rx = yDiff / themx.y();
ry = (xDiff - rx * themx.x()) / themy.x();
} else {
qreal div = (themy.x() * themx.y() - themy.y() * themx.x());
- if(div != 0.)
+ if (div != 0.)
rx = (themx.y() * xDiff - themx.x() * yDiff) / div;
- if(themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y();
+ if (themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y();
}
setX(x() - rx);
@@ -603,7 +603,7 @@ void QFxItemPrivate::data_append(QObject *o)
{
Q_Q(QFxItem);
QFxItem *i = qobject_cast<QFxItem *>(o);
- if(i)
+ if (i)
q->children()->append(i);
else
resources_append(o);
@@ -800,9 +800,9 @@ void QFxItem::setQml(const QString &qml)
if (d->_qml == qml)
return;
- if(!d->_qml.isEmpty()) {
+ if (!d->_qml.isEmpty()) {
QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml);
- if(iter != d->_qmlChildren.end())
+ if (iter != d->_qmlChildren.end())
(*iter)->setOpacity(0.);
}
@@ -810,20 +810,20 @@ void QFxItem::setQml(const QString &qml)
d->_qmlurl = qmlContext(this)->resolvedUri(qml);
d->qmlItem = 0;
- if(d->_qml.isEmpty()) {
+ if (d->_qml.isEmpty()) {
emit qmlChanged();
return;
}
QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml);
- if(iter != d->_qmlChildren.end()) {
+ if (iter != d->_qmlChildren.end()) {
(*iter)->setOpacity(1.);
d->qmlItem = (*iter);
emit qmlChanged();
} else {
d->_qmlcomp =
new QmlComponent(qmlEngine(this), d->_qmlurl, this);
- if(!d->_qmlcomp->isLoading())
+ if (!d->_qmlcomp->isLoading())
qmlLoaded();
else
QObject::connect(d->_qmlcomp, SIGNAL(statusChanged(QmlComponent::Status)),
@@ -840,7 +840,7 @@ void QFxItem::qmlLoaded()
// ###
for (int i=0; i<d->_qmlnewloading.length(); ++i) {
QmlComponent *c = d->_qmlnewcomp.at(i);
- if(c->isLoading())
+ if (c->isLoading())
continue;
QmlContext *ctxt = new QmlContext(qmlContext(this));
@@ -866,7 +866,7 @@ void QFxItem::qmlLoaded()
QObject *obj = d->_qmlcomp->create(ctxt);
QFxItem *qmlChild = qobject_cast<QFxItem *>(obj);
- if(qmlChild) {
+ if (qmlChild) {
qmlChild->setItemParent(this);
d->_qmlChildren.insert(d->_qml, qmlChild);
d->qmlItem = qmlChild;
@@ -984,23 +984,23 @@ void QFxItem::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
Q_D(QFxItem);
- if(newGeometry.width() != oldGeometry.width()) {
+ if (newGeometry.width() != oldGeometry.width()) {
int xoffset = oldGeometry.width() - newGeometry.width();
d->handleWidthChange(xoffset);
}
- if(newGeometry.height() != oldGeometry.height()) {
+ if (newGeometry.height() != oldGeometry.height()) {
int yoffset = oldGeometry.height() - newGeometry.height();
d->handleHeightChange(yoffset);
}
- if(newGeometry.x() != oldGeometry.x()) {
+ if (newGeometry.x() != oldGeometry.x()) {
emit leftChanged();
emit hcenterChanged();
emit rightChanged();
}
- if(newGeometry.y() != oldGeometry.y()) {
+ if (newGeometry.y() != oldGeometry.y()) {
emit topChanged();
emit vcenterChanged();
emit bottomChanged();
@@ -1010,7 +1010,7 @@ void QFxItem::geometryChanged(const QRectF &newGeometry,
void QFxItemPrivate::handleWidthChange(int xoffset)
{
Q_Q(QFxItem);
- if(!_anchors) {
+ if (!_anchors) {
emit q->hcenterChanged();
emit q->rightChanged();
} else {
@@ -1026,9 +1026,9 @@ void QFxItemPrivate::handleWidthChange(int xoffset)
emit q->rightChanged();
}
}
- if(q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
q->setRotation(q->rotation());
- if(q->scale() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->scale() && q->transformOrigin() != QFxItem::TopLeft)
q->setScale(q->scale());
emit q->widthChanged();
}
@@ -1036,7 +1036,7 @@ void QFxItemPrivate::handleWidthChange(int xoffset)
void QFxItemPrivate::handleHeightChange(int yoffset)
{
Q_Q(QFxItem);
- if(!_anchors) {
+ if (!_anchors) {
emit q->vcenterChanged();
emit q->bottomChanged();
emit q->baselineChanged();
@@ -1058,9 +1058,9 @@ void QFxItemPrivate::handleHeightChange(int yoffset)
emit q->baselineChanged();
}
}
- if(q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
q->setRotation(q->rotation());
- if(q->scale() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->scale() && q->transformOrigin() != QFxItem::TopLeft)
q->setScale(q->scale());
emit q->heightChanged();
}
@@ -1086,7 +1086,7 @@ bool QFxItem::flipVertically() const
void QFxItem::setFlipVertically(bool v)
{
- if(v)
+ if (v)
setFlip((QSimpleCanvasItem::Flip)(flip() | VerticalFlip));
else
setFlip((QSimpleCanvasItem::Flip)(flip() & ~VerticalFlip));
@@ -1105,7 +1105,7 @@ bool QFxItem::flipHorizontally() const
void QFxItem::setFlipHorizontally(bool v)
{
- if(v)
+ if (v)
setFlip((QSimpleCanvasItem::Flip)(flip() | HorizontalFlip));
else
setFlip((QSimpleCanvasItem::Flip)(flip() & ~HorizontalFlip));
@@ -1555,11 +1555,11 @@ qreal QFxItem::opacity() const
void QFxItem::setOpacity(qreal v)
{
- if(v == QSimpleCanvasItem::visible())
+ if (v == QSimpleCanvasItem::visible())
return;
- if(v < 0) v = 0;
- else if(v > 1) v = 1;
+ if (v < 0) v = 0;
+ else if (v > 1) v = 1;
QSimpleCanvasItem::setVisible(v);
emit opacityChanged();
@@ -1709,7 +1709,7 @@ QmlList<QmlTransition *>* QFxItem::transitions()
QmlState *QFxItem::findState(const QString &name) const
{
Q_D(const QFxItem);
- if(!d->_stateGroup)
+ if (!d->_stateGroup)
return 0;
else
return d->_stateGroup->findState(name);
@@ -1769,7 +1769,7 @@ QmlState *QFxItem::findState(const QString &name) const
QString QFxItem::state() const
{
Q_D(const QFxItem);
- if(!d->_stateGroup)
+ if (!d->_stateGroup)
return QString();
else
return d->_stateGroup->state();
@@ -1834,11 +1834,11 @@ bool QFxItem::isVisible() const
void QFxItem::setVisible(bool visible)
{
Q_D(QFxItem);
- if(visible == d->visible)
+ if (visible == d->visible)
return;
d->visible = visible;
- if(visible)
+ if (visible)
setOpacity(d->visibleOp);
else {
d->visibleOp = opacity();
@@ -1881,7 +1881,7 @@ void QFxItem::newChild(const QString &type)
d->_qmlnewloading.append(url);
d->_qmlnewcomp.append(new QmlComponent(qmlEngine(this), url, this));
- if(!d->_qmlnewcomp.last()->isLoading())
+ if (!d->_qmlnewcomp.last()->isLoading())
qmlLoaded();
else
connect(d->_qmlnewcomp.last(), SIGNAL(statusChanged(QmlComponent::Status)),
@@ -1899,7 +1899,7 @@ void QFxItem::classBegin()
Q_D(QFxItem);
d->_classComplete = false;
d->_componentComplete = false;
- if(d->_stateGroup)
+ if (d->_stateGroup)
d->_stateGroup->classBegin();
}
@@ -1915,7 +1915,7 @@ void QFxItem::classComplete()
#endif
Q_D(QFxItem);
d->_classComplete = true;
- if(d->_stateGroup)
+ if (d->_stateGroup)
d->_stateGroup->classComplete();
}
@@ -1929,13 +1929,13 @@ void QFxItem::componentComplete()
{
Q_D(QFxItem);
d->_componentComplete = true;
- if(d->_stateGroup)
+ if (d->_stateGroup)
d->_stateGroup->componentComplete();
- if(d->_anchors) {
+ if (d->_anchors) {
d->anchors()->connectHAnchors();
d->anchors()->connectVAnchors();
}
- if(!d->_transform.isEmpty())
+ if (!d->_transform.isEmpty())
updateTransform();
}
@@ -1960,9 +1960,9 @@ void QFxItem::updateTransform()
{
Q_D(QFxItem);
QSimpleCanvas::Matrix trans;
- for(int ii = d->_transform.count() - 1; ii >= 0; --ii) {
+ for (int ii = d->_transform.count() - 1; ii >= 0; --ii) {
QFxTransform *a = d->_transform.at(ii);
- if(!a->isIdentity())
+ if (!a->isIdentity())
trans = a->transform() * trans;
}
@@ -1980,9 +1980,9 @@ void QFxItem::transformChanged(const QSimpleCanvas::Matrix &)
QmlStateGroup *QFxItemPrivate::states()
{
Q_Q(QFxItem);
- if(!_stateGroup) {
+ if (!_stateGroup) {
_stateGroup = new QmlStateGroup(q);
- if(!_classComplete)
+ if (!_classComplete)
_stateGroup->classBegin();
QObject::connect(_stateGroup, SIGNAL(stateChanged(QString)),
q, SIGNAL(stateChanged(QString)));
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index 71fc912..f2da3ba 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -85,7 +85,7 @@ public:
{
Q_Q(QFxItem);
- if(parent)
+ if (parent)
q->setItemParent(parent);
_baselineOffset.invalidate();
q->setAcceptedMouseButtons(Qt::NoButton);
@@ -122,7 +122,7 @@ public:
QList<QFxTransform *> _transform;
QFxAnchors *anchors() {
- if(!_anchors) {
+ if (!_anchors) {
Q_Q(QFxItem);
_anchors = new QFxAnchors;
_anchors->setItem(q);
@@ -160,7 +160,7 @@ public:
mutable AnchorLines *_anchorLines;
AnchorLines *anchorLines() const {
Q_Q(const QFxItem);
- if(!_anchorLines) _anchorLines =
+ if (!_anchorLines) _anchorLines =
new AnchorLines(const_cast<QFxItem *>(q));
return _anchorLines;
}
diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp
index 3bd7d00..69d4679 100644
--- a/src/declarative/fx/qfxkeyactions.cpp
+++ b/src/declarative/fx/qfxkeyactions.cpp
@@ -78,15 +78,15 @@ QFxKeyActionsPrivate::QFxKeyActionsPrivate()
int QFxKeyActionsPrivate::keyToBit(Qt::Key k) const
{
- if(k >= Qt::Key_A && k <= Qt::Key_Z ) {
+ if (k >= Qt::Key_A && k <= Qt::Key_Z ) {
return k - Qt::Key_A;
- } else if(k >= Qt::Key_Left && k <= Qt::Key_Down) {
+ } else if (k >= Qt::Key_Left && k <= Qt::Key_Down) {
return 26 + k - Qt::Key_Left;
- } else if(k >= Qt::Key_0 && k <= Qt::Key_9) {
+ } else if (k >= Qt::Key_0 && k <= Qt::Key_9) {
return 30 + k - Qt::Key_0;
- } else if(k >= Qt::Key_Context1 && k <= Qt::Key_Flip) {
+ } else if (k >= Qt::Key_Context1 && k <= Qt::Key_Flip) {
return 40 + k - Qt::Key_Context1;
- } else if(k >= Qt::Key_Select && k <= Qt::Key_No) {
+ } else if (k >= Qt::Key_Select && k <= Qt::Key_No) {
return 47 + k - Qt::Key_Select;
} else {
const int start = 50;
@@ -117,7 +117,7 @@ bool QFxKeyActionsPrivate::key(Qt::Key k) const
{
int b = keyToBit(k);
bool rv = testBit(b);
- if(!rv && k != Qt::Key_Shift)
+ if (!rv && k != Qt::Key_Shift)
rv = testBit(keyToBit(Qt::Key_unknown));
return rv;
}
@@ -125,7 +125,7 @@ bool QFxKeyActionsPrivate::key(Qt::Key k) const
QString QFxKeyActionsPrivate::action(Qt::Key k) const
{
int b = keyToBit(k);
- if(b != -1 && testBit(b))
+ if (b != -1 && testBit(b))
return actions.value(k);
else
return actions.value(Qt::Key_unknown);
@@ -134,7 +134,7 @@ QString QFxKeyActionsPrivate::action(Qt::Key k) const
void QFxKeyActionsPrivate::setKey(Qt::Key k, bool v)
{
int b = keyToBit(k);
- if(b == -1)
+ if (b == -1)
return;
setBit(b, v);
@@ -142,10 +142,10 @@ void QFxKeyActionsPrivate::setKey(Qt::Key k, bool v)
bool QFxKeyActionsPrivate::testBit(int b) const
{
- if(b < 0)
+ if (b < 0)
return false;
- if(b < 32)
+ if (b < 32)
return keys1 & (1 << b);
else
return keys2 & (1 << (b - 32));
@@ -153,13 +153,13 @@ bool QFxKeyActionsPrivate::testBit(int b) const
void QFxKeyActionsPrivate::setBit(int b, bool v)
{
- if(v) {
- if(b < 32)
+ if (v) {
+ if (b < 32)
keys1 |= (1 << b);
else
keys2 |= (1 << (b - 32));
} else {
- if(b < 32)
+ if (b < 32)
keys1 &= ~(1 << b);
else
keys2 &= ~(1 << (b - 32));
@@ -198,7 +198,7 @@ QFxKeyActions::~QFxKeyActions()
QString QFxKeyActionsPrivate::keyExpr(Qt::Key k) const
{
- if(key(k))
+ if (key(k))
return actions.value(k);
else
return QString();
@@ -206,8 +206,8 @@ QString QFxKeyActionsPrivate::keyExpr(Qt::Key k) const
void QFxKeyActionsPrivate::setKeyExpr(Qt::Key k, const QString &expr)
{
- if(expr.isEmpty()) {
- if(key(k)) {
+ if (expr.isEmpty()) {
+ if (key(k)) {
actions.remove(k);
setKey(k, false);
}
@@ -231,7 +231,7 @@ bool QFxKeyActions::enabled() const
void QFxKeyActions::setEnabled(bool e)
{
- if(d->enabled == e)
+ if (d->enabled == e)
return;
d->enabled = e;
@@ -898,7 +898,7 @@ void QFxKeyActions::setKey_Any(const QString &s)
void QFxKeyActions::keyPressEvent(QKeyEvent *event)
{
Qt::Key key = (Qt::Key)event->key();
- if(d->enabled && d->key(key)) {
+ if (d->enabled && d->key(key)) {
QmlExpression b(qmlContext(this), d->action(key), this, false);
b.value();
event->accept();
@@ -910,7 +910,7 @@ void QFxKeyActions::keyPressEvent(QKeyEvent *event)
void QFxKeyActions::keyReleaseEvent(QKeyEvent *event)
{
Qt::Key key = (Qt::Key)event->key();
- if(d->enabled && d->key(key)) {
+ if (d->enabled && d->key(key)) {
event->accept();
} else {
QFxItem::keyReleaseEvent(event);
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 7d5726f..6d92441 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -93,22 +93,22 @@ QList<QFxItem *> *QFxKeyProxy::targets() const
void QFxKeyProxy::keyPressEvent(QKeyEvent *e)
{
- for(int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
QSimpleCanvasItem *i = d->targets.at(ii);
- if(i)
+ if (i)
i->keyPressEvent(e);
- if(e->isAccepted())
+ if (e->isAccepted())
return;
}
}
void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e)
{
- for(int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
QSimpleCanvasItem *i = d->targets.at(ii);
- if(i)
+ if (i)
i->keyReleaseEvent(e);
- if(e->isAccepted())
+ if (e->isAccepted())
return;
}
}
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp
index b89e795..76afeb0 100644
--- a/src/declarative/fx/qfxlayouts.cpp
+++ b/src/declarative/fx/qfxlayouts.cpp
@@ -96,7 +96,7 @@ int QFxBaseLayout::spacing() const
void QFxBaseLayout::setSpacing(int s)
{
Q_D(QFxBaseLayout);
- if(s==d->_spacing)
+ if (s==d->_spacing)
return;
d->_spacing = s;
preLayout();
@@ -116,7 +116,7 @@ int QFxBaseLayout::margin() const
void QFxBaseLayout::setMargin(int s)
{
Q_D(QFxBaseLayout);
- if(s==d->_margin)
+ if (s==d->_margin)
return;
d->_margin = s;
preLayout();
@@ -223,7 +223,7 @@ QFxItem *QFxBaseLayout::layoutItem() const
void QFxBaseLayout::setLayoutItem(QFxItem *li)
{
Q_D(QFxBaseLayout);
- if(li == d->_layoutItem)
+ if (li == d->_layoutItem)
return;
d->_layoutItem = li;
emit layoutItemChanged();
@@ -246,7 +246,7 @@ void QFxBaseLayout::childrenChanged()
bool QFxBaseLayout::event(QEvent *e)
{
Q_D(QFxBaseLayout);
- if(e->type() == QEvent::User) {
+ if (e->type() == QEvent::User) {
d->_ep = false;
d->_stableItems += d->_newItems;
d->_leavingItems.clear();
@@ -288,22 +288,22 @@ QSet<QFxItem *>* QFxBaseLayout::leavingItems()
void QFxBaseLayout::preLayout()
{
Q_D(QFxBaseLayout);
- if(!isComponentComplete() || d->_movingItem)
+ if (!isComponentComplete() || d->_movingItem)
return;
- if(!d->_ep) {
+ if (!d->_ep) {
d->_ep = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
- if(d->stateGroup) {
+ if (d->stateGroup) {
delete d->stateGroup; d->stateGroup = 0;
}
QSet<QFxItem *> allItems;
- for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
+ for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii));
- if(!child)
+ if (!child)
continue;
- if(!d->_items.contains(child)){
+ if (!d->_items.contains(child)){
QObject::connect(child, SIGNAL(visibleChanged()),
this, SLOT(preLayout()));
QObject::connect(child, SIGNAL(heightChanged()),
@@ -312,20 +312,20 @@ void QFxBaseLayout::preLayout()
this, SLOT(preLayout()));
d->_items += child;
}
- if(!child->isVisible()){
- if(d->_stableItems.contains(child)){
+ if (!child->isVisible()){
+ if (d->_stableItems.contains(child)){
d->_leavingItems += child;
d->_stableItems -= child;
}
- }else if(!d->_stableItems.contains(child)){
+ }else if (!d->_stableItems.contains(child)){
d->_newItems+=child;
}
allItems += child;
}
QSet<QFxItem *> deletedItems = d->_items - allItems;
foreach(QFxItem *child, d->_items){
- if(!allItems.contains(child)){
- if(!deletedItems.contains(child)) {
+ if (!allItems.contains(child)){
+ if (!deletedItems.contains(child)) {
QObject::disconnect(child, SIGNAL(visibleChanged()),
this, SLOT(preLayout()));
QObject::disconnect(child, SIGNAL(heightChanged()),
@@ -343,8 +343,8 @@ void QFxBaseLayout::preLayout()
qreal width=0;
qreal height=0;
foreach(QFxItem *item, d->_items){
- if(item->isVisible()){
- if(!d->_animated.contains(item)){
+ if (item->isVisible()){
+ if (!d->_animated.contains(item)){
setMovingItem(item);
item->setPos(QPointF(item->x()+d->_margin, item->y()+d->_margin));
setMovingItem(0);
@@ -356,11 +356,11 @@ void QFxBaseLayout::preLayout()
width += d->_margin;
height+= d->_margin;
- if(d->aut & Horizontal)
+ if (d->aut & Horizontal)
setWidth(int(width));
else
setImplicitWidth(itemParent()->width());
- if(d->aut & Vertical)
+ if (d->aut & Vertical)
setHeight(int(height));
else
setImplicitHeight(itemParent()->height());
@@ -372,20 +372,20 @@ void QFxBaseLayout::applyTransition(const QList<QPair<QString, QVariant> >& chan
QFxItem* target, QmlTransition* trans)
{
Q_D(QFxBaseLayout);
- if(!trans||!target)//TODO: if !trans, just apply changes
+ if (!trans||!target)//TODO: if !trans, just apply changes
return;
setLayoutItem(target);
- if(d->stateGroup)
+ if (d->stateGroup)
delete d->stateGroup;
d->stateGroup = new QmlStateGroup(this);
QmlState *state = new QmlState;
*(d->stateGroup->statesProperty()) << state;
- for(int ii=0; ii<changes.size(); ++ii){
+ for (int ii=0; ii<changes.size(); ++ii){
QmlSetProperty *sp = new QmlSetProperty(state);
sp->setObject(target);
QVariant val = changes[ii].second;
- if(d->_margin &&
+ if (d->_margin &&
(changes[ii].first == QLatin1String("x") || changes[ii].first == QLatin1String("y"))){
val = QVariant(val.toInt() + d->_margin);
}
@@ -589,14 +589,14 @@ void QFxVerticalLayout::doLayout()
int voffset = 0;
foreach(QFxItem* item, *leavingItems()){
- if(remove()){
+ if (remove()){
QList<QPair<QString,QVariant> > changes;
applyRemove(changes, item);
}
}
- for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
+ for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii));
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
bool needMove = (child->y() != voffset || child->x());
@@ -604,11 +604,11 @@ void QFxVerticalLayout::doLayout()
QList<QPair<QString, QVariant> > changes;
changes << qMakePair(QString(QLatin1String("y")),QVariant(voffset));
changes << qMakePair(QString(QLatin1String("x")),QVariant(0));
- if(needMove && items()->contains(child) && move()) {
+ if (needMove && items()->contains(child) && move()) {
applyMove(changes,child);
- } else if(!items()->contains(child) && add()) {
+ } else if (!items()->contains(child) && add()) {
applyAdd(changes,child);
- } else if(needMove) {
+ } else if (needMove) {
setMovingItem(child);
child->setY(voffset);
setMovingItem(0);
@@ -742,14 +742,14 @@ void QFxHorizontalLayout::doLayout()
int hoffset = 0;
foreach(QFxItem* item, *leavingItems()){
- if(remove()){
+ if (remove()){
QList<QPair<QString,QVariant> > changes;
applyRemove(changes, item);
}
}
- for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
+ for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii));
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
bool needMove = (child->x() != hoffset || child->y());
@@ -757,11 +757,11 @@ void QFxHorizontalLayout::doLayout()
QList<QPair<QString, QVariant> > changes;
changes << qMakePair(QString(QLatin1String("x")),QVariant(hoffset));
changes << qMakePair(QString(QLatin1String("y")),QVariant(0));
- if(needMove && items()->contains(child) && move()) {
+ if (needMove && items()->contains(child) && move()) {
applyMove(changes,child);
- } else if(!items()->contains(child) && add()) {
+ } else if (!items()->contains(child) && add()) {
applyAdd(changes,child);
- } else if(needMove) {
+ } else if (needMove) {
setMovingItem(child);
child->setX(hoffset);
setMovingItem(0);
@@ -950,32 +950,32 @@ void QFxGridLayout::doLayout()
{
int c=_columns,r=_rows;//Actual number of rows/columns
int numVisible = items()->size() + newItems()->size();
- if(_columns==-1 && _rows==-1){
+ if (_columns==-1 && _rows==-1){
c = 4;
r = (numVisible+2)/3;
- }else if(_rows==-1){
+ }else if (_rows==-1){
r = (numVisible+(_columns-1))/_columns;
- }else if(_columns==-1){
+ }else if (_columns==-1){
c = (numVisible+(_rows-1))/_rows;
}
QList<int> maxColWidth;
QList<int> maxRowHeight;
int childIndex =0;
- for(int i=0; i<r; i++){
- for(int j=0; j<c; j++){
- if(j==0)
+ for (int i=0; i<r; i++){
+ for (int j=0; j<c; j++){
+ if (j==0)
maxRowHeight << 0;
- if(i==0)
+ if (i==0)
maxColWidth << 0;
- if(childIndex == this->QSimpleCanvasItem::children().count())
+ if (childIndex == this->QSimpleCanvasItem::children().count())
continue;
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(childIndex++));
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
- if(child->width() > maxColWidth[j])
+ if (child->width() > maxColWidth[j])
maxColWidth[j] = child->width();
- if(child->height() > maxRowHeight[i])
+ if (child->height() > maxRowHeight[i])
maxRowHeight[i] = child->height();
}
}
@@ -985,23 +985,23 @@ void QFxGridLayout::doLayout()
int curRow =0;
int curCol =0;
foreach(QFxItem* item, *leavingItems()){
- if(remove()){
+ if (remove()){
QList<QPair<QString,QVariant> > changes;
applyRemove(changes, item);
}
}
foreach(QSimpleCanvasItem* schild, this->QSimpleCanvasItem::children()){
QFxItem *child = qobject_cast<QFxItem *>(schild);
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset);
QList<QPair<QString, QVariant> > changes;
changes << qMakePair(QString(QLatin1String("x")),QVariant(xoffset));
changes << qMakePair(QString(QLatin1String("y")),QVariant(yoffset));
- if(newItems()->contains(child) && add()) {
+ if (newItems()->contains(child) && add()) {
applyAdd(changes,child);
- } else if(needMove) {
- if(move()){
+ } else if (needMove) {
+ if (move()){
applyMove(changes,child);
}else{
setMovingItem(child);
@@ -1012,11 +1012,11 @@ void QFxGridLayout::doLayout()
xoffset+=maxColWidth[curCol]+spacing();
curCol++;
curCol%=c;
- if(!curCol){
+ if (!curCol){
yoffset+=maxRowHeight[curRow]+spacing();
xoffset=0;
curRow++;
- if(curRow>=r)
+ if (curRow>=r)
return;
}
}
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 76f7e11..d8a293f 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -585,7 +585,7 @@ void QFxListViewPrivate::createHighlight()
if (nobj) {
highlightContext->setParent(nobj);
item = qobject_cast<QFxItem *>(nobj);
- if(!item) {
+ if (!item) {
delete nobj;
} else {
item->setParent(q->viewport());
@@ -1194,7 +1194,7 @@ int QFxListView::cacheBuffer() const
void QFxListView::setCacheBuffer(int b)
{
Q_D(QFxListView);
- if(d->buffer != b) {
+ if (d->buffer != b) {
d->buffer = b;
if (isComponentComplete())
refill();
@@ -1233,7 +1233,7 @@ QString QFxListView::sectionExpression() const
void QFxListView::setSectionExpression(const QString &expression)
{
Q_D(QFxListView);
- if(d->sectionExpression != expression) {
+ if (d->sectionExpression != expression) {
d->sectionExpression = expression;
emit sectionExpressionChanged();
}
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index f7b6c57..d197c9a 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -163,7 +163,7 @@ void QFxDrag::setYmax(int m)
example extended so as to give a different color when you right click.
\code
<Rect width="100" height="100">
- <MouseRegion anchors.fill="{parent}" onClick="if(mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/>
+ <MouseRegion anchors.fill="{parent}" onClick="if (mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/>
</Rect>
\endcode
@@ -324,7 +324,7 @@ void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
d->moved = false;
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::mousePressEvent(event);
else {
if (!d->inside) {
@@ -349,7 +349,7 @@ void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb) {
+ if (!d->absorb) {
QFxItem::mouseMoveEvent(event);
return;
}
@@ -369,10 +369,10 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
emit reenteredWhilePressed();
}
- if(drag()->target()) {
- if(!d->moved) {
- if(d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal?
- if(d->dragY) d->startY = int(drag()->target()->y());
+ if (drag()->target()) {
+ if (!d->moved) {
+ if (d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal?
+ if (d->dragY) d->startY = int(drag()->target()->y());
}
QPointF startLocalPos;
@@ -397,7 +397,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if(d->dragX) {
+ if (d->dragX) {
qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX;
if (x < drag()->xmin())
x = drag()->xmin();
@@ -405,7 +405,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
x = drag()->xmax();
drag()->target()->setX(x);
}
- if(d->dragY) {
+ if (d->dragY) {
qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY;
if (y < drag()->ymin())
y = drag()->ymin();
@@ -424,7 +424,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::mouseReleaseEvent(event);
else {
d->saveEvent(event);
@@ -438,7 +438,7 @@ void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::mouseDoubleClickEvent(event);
else {
//d->inside = true;
@@ -454,7 +454,7 @@ void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::hoverEnterEvent(event);
else {
setHovered(true);
@@ -465,7 +465,7 @@ void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void QFxMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::hoverLeaveEvent(event);
else {
setHovered(false);
@@ -525,7 +525,7 @@ bool QFxMouseRegion::pressed()
void QFxMouseRegion::setHovered(bool h)
{
Q_D(QFxMouseRegion);
- if(d->hovered != h) {
+ if (d->hovered != h) {
d->hovered = h;
emit hoveredChanged();
}
@@ -536,10 +536,10 @@ void QFxMouseRegion::setPressed(bool p)
Q_D(QFxMouseRegion);
bool isclick = d->pressed == true && p == false && d->dragged == false && d->inside == true;
- if(d->pressed != p) {
+ if (d->pressed != p) {
d->pressed = p;
QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
- if(d->pressed) {
+ if (d->pressed) {
emit positionChanged(&me);
emit pressed(&me);
} else {
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 03bd1e0..309ebe8 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -413,17 +413,17 @@ void QFxParticlesPrivate::tick(int time)
if (!addParticleTime)
addParticleTime = time;
- if(particles.count() < count && emitting) {
+ if (particles.count() < count && emitting) {
qreal perc = (lifeSpanDev <= 0)?(1.):(qreal(time - addParticleTime) / qreal(lifeSpanDev));
int percCount = addParticleCount + (int)perc * (count - addParticleCount);
int streamWidth = -1;
- if(stream){
- if(streamDelay > time){
+ if (stream){
+ if (streamDelay > time){
streamWidth = 0;
}else{
int missed = time - streamDelay;
qreal streamWidthReal = qreal(count)/qreal(lifeSpan);
- if(streamWidthReal < 1){
+ if (streamWidthReal < 1){
streamDelay = time + (int)(1.0/streamWidthReal);
streamWidth = 1;
streamWidth += missed/streamDelay;
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index 2009237..f08671d 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -185,7 +185,7 @@ QList<QFxPathElement *>* QFxPath::pathElements()
void QFxPath::interpolate(int idx, const QString &name, qreal value)
{
Q_D(QFxPath);
- if(!idx)
+ if (!idx)
return;
qreal lastValue = 0;
@@ -193,7 +193,7 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value)
int search = idx - 1;
while(search >= 0) {
const AttributePoint &point = d->_attributePoints.at(search);
- if(point.values.contains(name)) {
+ if (point.values.contains(name)) {
lastValue = point.values.value(name);
lastPercent = point.origpercent;
break;
@@ -205,7 +205,7 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value)
const AttributePoint &curPoint = d->_attributePoints.at(idx);
- for(int ii = search; ii < idx; ++ii) {
+ for (int ii = search; ii < idx; ++ii) {
AttributePoint &point = d->_attributePoints[ii];
qreal val = lastValue + (value - lastValue) * (point.origpercent - lastPercent) / (curPoint.origpercent - lastPercent);
@@ -218,10 +218,10 @@ void QFxPath::endpoint(const QString &name)
Q_D(QFxPath);
const AttributePoint &first = d->_attributePoints.first();
qreal val = first.values.value(name);
- for(int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) {
+ for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if(point.values.contains(name)) {
- for(int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) {
+ if (point.values.contains(name)) {
+ for (int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) {
AttributePoint &setPoint = d->_attributePoints[jj];
setPoint.values.insert(name, val);
}
@@ -239,23 +239,23 @@ void QFxPath::processPath()
d->_path = QPainterPath();
AttributePoint first;
- for(int ii = 0; ii < d->_attributes.count(); ++ii)
+ for (int ii = 0; ii < d->_attributes.count(); ++ii)
first.values[d->_attributes.at(ii)] = 0;
d->_attributePoints << first;
d->_path.moveTo(d->startX, d->startY);
foreach (QFxPathElement *pathElement, d->_pathElements) {
- if(QFxCurve *curve = qobject_cast<QFxCurve *>(pathElement)) {
+ if (QFxCurve *curve = qobject_cast<QFxCurve *>(pathElement)) {
curve->addToPath(d->_path);
AttributePoint p;
p.origpercent = d->_path.length();
d->_attributePoints << p;
- } else if(QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) {
+ } else if (QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[attribute->name()] = attribute->value();
interpolate(d->_attributePoints.count() - 1, attribute->name(), attribute->value());
- } else if(QFxPathPercent *percent = qobject_cast<QFxPathPercent *>(pathElement)) {
+ } else if (QFxPathPercent *percent = qobject_cast<QFxPathPercent *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[QLatin1String("_qfx_percent")] = percent->value();
interpolate(d->_attributePoints.count() - 1, QLatin1String("_qfx_percent"), percent->value());
@@ -264,8 +264,8 @@ void QFxPath::processPath()
// Fixup end points
const AttributePoint &last = d->_attributePoints.last();
- for(int ii = 0; ii < d->_attributes.count(); ++ii) {
- if(!last.values.contains(d->_attributes.at(ii)))
+ for (int ii = 0; ii < d->_attributes.count(); ++ii) {
+ if (!last.values.contains(d->_attributes.at(ii)))
endpoint(d->_attributes.at(ii));
}
@@ -273,9 +273,9 @@ void QFxPath::processPath()
qreal length = d->_path.length();
qreal prevpercent = 0;
qreal prevorigpercent = 0;
- for(int ii = 0; ii < d->_attributePoints.count(); ++ii) {
+ for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if(point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent
+ if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent
if ( ii > 0) {
qreal scale = (d->_attributePoints[ii].origpercent/length - prevorigpercent) /
(point.values.value(QLatin1String("_qfx_percent"))-prevpercent);
@@ -300,7 +300,7 @@ void QFxPath::componentComplete()
QSet<QString> attrs;
// First gather up all the attributes
foreach (QFxPathElement *pathElement, d->_pathElements) {
- if(QFxPathAttribute *attribute =
+ if (QFxPathAttribute *attribute =
qobject_cast<QFxPathAttribute *>(pathElement))
attrs.insert(attribute->name());
}
@@ -383,10 +383,10 @@ void QFxPath::createPointCache() const
//find which set we are in
qreal prevPercent = 0;
qreal prevOrigPercent = 0;
- for(int ii = 0; ii < d->_attributePoints.count(); ++ii) {
+ for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
qreal percent = qreal(i)/points;
const AttributePoint &point = d->_attributePoints.at(ii);
- if(percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item
+ if (percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item
qreal elementPercent = (percent - prevPercent);
qreal spc = prevOrigPercent + elementPercent * point.scale;
@@ -430,15 +430,15 @@ QPointF QFxPath::pointAt(qreal p) const
qreal QFxPath::attributeAt(const QString &name, qreal percent) const
{
Q_D(const QFxPath);
- if(percent < 0 || percent > 1)
+ if (percent < 0 || percent > 1)
return 0;
- for(int ii = 0; ii < d->_attributePoints.count(); ++ii) {
+ for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if(point.percent == percent) {
+ if (point.percent == percent) {
return point.values.value(name);
- } else if(point.percent > percent) {
+ } else if (point.percent > percent) {
qreal lastValue =
ii?(d->_attributePoints.at(ii - 1).values.value(name)):0;
qreal lastPercent =
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index 59c7cd1..65d5ac8 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -246,7 +246,7 @@ void QFxPathView::setCurrentIndex(int idx)
d->currentIndex = idx;
d->snapToCurrent();
int itemIndex = (idx - d->firstIndex + d->model->count()) % d->model->count();
- if(itemIndex < d->items.count())
+ if (itemIndex < d->items.count())
d->items.at(itemIndex)->setFocus(true);
emit currentIndexChanged();
}
@@ -392,7 +392,7 @@ int QFxPathView::pathItemCount() const
void QFxPathView::setPathItemCount(int i)
{
Q_D(QFxPathView);
- if(i == d->pathItems)
+ if (i == d->pathItems)
return;
d->pathItems = i;
d->regenerate();
@@ -553,7 +553,7 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e)
{
- if(!isVisible())
+ if (!isVisible())
return false;
switch (e->type()) {
@@ -579,7 +579,7 @@ void QFxPathViewPrivate::regenerate()
if (!model || model->count() <= 0 || !model->delegate() || !path)
return;
- for(int i=0; i<items.count(); i++){
+ for (int i=0; i<items.count(); i++){
QFxItem *p = items[i];
q->attachedProperties.remove(p);
model->release(p);
@@ -592,7 +592,7 @@ void QFxPathViewPrivate::regenerate()
int numItems = (pathItems>=0 ? pathItems : model->count());
qreal minDiff = 1e9;
int minI = -1;
- for(int i=0; i<numItems; i++){
+ for (int i=0; i<numItems; i++){
QFxItem *item = model->item(i);
if (!item)
return;
@@ -603,7 +603,7 @@ void QFxPathViewPrivate::regenerate()
percent /= 100.0;
updateItem(items.last(), percent);
qreal diff = qAbs(percent - snapPos);
- if(diff < minDiff){
+ if (diff < minDiff){
minDiff = diff;
minI = i;
}
@@ -615,7 +615,7 @@ void QFxPathViewPrivate::regenerate()
void QFxPathViewPrivate::updateItem(QFxItem *item, qreal percent)
{
- if(QObject *obj = QFxPathView::attachedProperties.value(item)) {
+ if (QObject *obj = QFxPathView::attachedProperties.value(item)) {
foreach(QString attr, path->attributes())
static_cast<QFxPathViewAttached *>(obj)->setValue(attr.toLatin1(), path->attributeAt(attr, percent));
}
@@ -632,36 +632,36 @@ void QFxPathView::refill()
return;
QList<qreal> positions;
- for(int i=0; i<d->items.count(); i++){
+ for (int i=0; i<d->items.count(); i++){
qreal percent = i * (100. / d->items.count());
percent = percent + d->_offset;
percent = fmod(percent,100.);
positions << qAbs(percent/100.0);
}
- if(d->pathItems==-1){
- for(int i=0; i<positions.count(); i++){
+ if (d->pathItems==-1){
+ for (int i=0; i<positions.count(); i++){
d->updateItem(d->items.at(i), positions[i]);
}
return;
}
QList<qreal> rotatedPositions;
- for(int i=0; i<d->items.count(); i++)
+ for (int i=0; i<d->items.count(); i++)
rotatedPositions << positions[(i + d->pathOffset + d->items.count()) % d->items.count()];
int firstFind = -1;
int i;
- for(i=0; i<d->items.count()-1; i++)
+ for (i=0; i<d->items.count()-1; i++)
{
- if(rotatedPositions[i] > rotatedPositions[i+1]){
+ if (rotatedPositions[i] > rotatedPositions[i+1]){
firstFind = i;
break;
}
}
- if(firstFind!=-1 ){
+ if (firstFind!=-1 ){
//A wraparound has occured
- if(firstFind<(d->items.count()/2)){
+ if (firstFind<(d->items.count()/2)){
while(firstFind-- >= 0){
QFxItem* p = d->items.takeFirst();
attachedProperties.remove(p);
@@ -681,21 +681,21 @@ void QFxPathView::refill()
attachedProperties.remove(p);
d->model->release(p);
d->firstIndex--;
- if(d->firstIndex<0)
+ if (d->firstIndex<0)
d->firstIndex = d->model->count() - 1;
d->items.prepend(d->model->item(d->firstIndex));
d->items.first()->setZ(d->firstIndex);
d->items.first()->setParent(this);
d->pathOffset--;
- if(d->pathOffset<0)
+ if (d->pathOffset<0)
d->pathOffset = d->items.count() - 1;
}
}
- for(int i=0; i<d->items.count(); i++)
+ for (int i=0; i<d->items.count(); i++)
rotatedPositions[i] = positions[(i + d->pathOffset + d->items.count())
% d->items.count()];
}
- for(int i=0; i<d->items.count(); i++){
+ for (int i=0; i<d->items.count(); i++){
d->updateItem(d->items.at(i), rotatedPositions[i]);
}
}
@@ -712,26 +712,26 @@ int QFxPathViewPrivate::calcCurrentIndex()
int current = -1;
if (model && items.count()) {
_offset = fmod(_offset, 100.0);
- if(_offset < 0)
+ if (_offset < 0)
_offset += 100.0;
- if(pathItems == -1){
+ if (pathItems == -1){
qreal delta = fmod(_offset - snapPos, 100.0);
if (delta < 0)
delta = 100.0 + delta;
int ii = model->count() - qRound(delta * model->count() / 100);
- if(ii < 0)
+ if (ii < 0)
ii = 0;
current = ii;
}else{
qreal bestDiff=1e9;
int bestI=-1;
- for(int i=0; i<items.count(); i++){
+ for (int i=0; i<items.count(); i++){
qreal percent = i * (100. / items.count());
percent = percent + _offset;
percent = fmod(percent,100.);
qreal diff = qAbs(snapPos - (percent/100.0));
- if(diff < bestDiff){
+ if (diff < bestDiff){
bestDiff = diff;
bestI = i;
}
@@ -755,7 +755,7 @@ void QFxPathViewPrivate::updateCurrent()
if (model && idx != currentIndex) {
currentIndex = idx;
int itemIndex = (idx - firstIndex + model->count()) % model->count();
- if(itemIndex < items.count())
+ if (itemIndex < items.count())
items.at(itemIndex)->setFocus(true);
emit q->currentIndexChanged();
}
@@ -783,7 +783,7 @@ void QFxPathViewPrivate::snapToCurrent()
//Rounds is the number of times round to make the current item visible
int rounds = itemIndex / items.count();
int otherWayRounds = (model->count() - (itemIndex))/items.count() + 1;
- if(otherWayRounds < rounds)
+ if (otherWayRounds < rounds)
rounds = -otherWayRounds;
itemIndex += pathOffset;
@@ -799,12 +799,12 @@ void QFxPathViewPrivate::snapToCurrent()
tl.clear();
moveOffset.setValue(_offset);
- if(rounds!=0){
+ if (rounds!=0){
//Compensate if the targetOffset would bring the target it from off the screen
qreal distance = targetOffset - _offset;
- if(distance <= -50)
+ if (distance <= -50)
rounds--;
- if(distance > 50)
+ if (distance > 50)
rounds++;
tl.move(moveOffset, targetOffset + 100.0*(-rounds), QEasingCurve(QEasingCurve::InOutQuad),
int(100*items.count()*qMax((qreal)(2.0/items.count()),(qreal)qAbs(rounds))));
diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp
index 5a08679..0d456c6 100644
--- a/src/declarative/fx/qfxpixmap.cpp
+++ b/src/declarative/fx/qfxpixmap.cpp
@@ -67,7 +67,7 @@ public:
int refCount;
void addRef() { ++refCount; }
- void release() { Q_ASSERT(refCount > 0); --refCount; if(refCount == 0) { qfxPixmapCache.remove(key); delete this; } }
+ void release() { Q_ASSERT(refCount > 0); --refCount; if (refCount == 0) { qfxPixmapCache.remove(key); delete this; } }
};
static QFxPixmapCacheItem qfxPixmapCacheDummyItem;
@@ -104,7 +104,7 @@ QFxPixmap::QFxPixmap(const QUrl &url)
#endif
QString key = url.toString();
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key);
- if(iter == qfxPixmapCache.end()) {
+ if (iter == qfxPixmapCache.end()) {
qWarning() << "QFxPixmap: URL not loaded" << url;
} else {
QNetworkReply *reply = (*iter)->reply;
@@ -180,10 +180,10 @@ QPixmap QFxPixmap::pixmap() const
void QFxPixmap::setPixmap(const QPixmap &pix)
{
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(QString::number(pix.cacheKey()));
- if(iter == qfxPixmapCache.end()) {
+ if (iter == qfxPixmapCache.end()) {
QFxPixmapCacheItem *item = new QFxPixmapCacheItem;
item->key = QString::number(pix.cacheKey());
- if(d->pixmap)
+ if (d->pixmap)
d->pixmap->release();
d->pixmap = item;
d->pixmap->image = pix.toImage();
@@ -195,7 +195,7 @@ void QFxPixmap::setPixmap(const QPixmap &pix)
#if 0
int size = 0;
- for(QFxPixmapCache::Iterator iter = qfxPixmapCache.begin(); iter != qfxPixmapCache.end(); ++iter) {
+ for (QFxPixmapCache::Iterator iter = qfxPixmapCache.begin(); iter != qfxPixmapCache.end(); ++iter) {
size += (*iter)->image.width() * (*iter)->image.height();
}
qWarning() << qfxPixmapCache.count() << size;
@@ -207,8 +207,8 @@ QFxPixmap::operator const QSimpleCanvasConfig::Image &() const
#if defined(QFX_RENDER_OPENGL)
return d->pixmap->image;
#else
- if(d->opaque) {
- if(!d->pixmap->image.isNull() && d->pixmap->opaqueImage.isNull()) {
+ if (d->opaque) {
+ if (!d->pixmap->image.isNull() && d->pixmap->opaqueImage.isNull()) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::PixmapLoad> perf;
#endif
@@ -218,7 +218,7 @@ QFxPixmap::operator const QSimpleCanvasConfig::Image &() const
}
return d->pixmap->opaqueImage;
} else {
- if(!d->pixmap->image.isNull() && d->pixmap->image.format() != QImage::Format_ARGB32_Premultiplied) {
+ if (!d->pixmap->image.isNull() && d->pixmap->image.format() != QImage::Format_ARGB32_Premultiplied) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::PixmapLoad> perf;
#endif
@@ -238,7 +238,7 @@ void QFxPixmap::get(QmlEngine *engine, const QUrl& url, QObject* obj, const char
{
QString key = url.toString();
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key);
- if(iter == qfxPixmapCache.end()) {
+ if (iter == qfxPixmapCache.end()) {
QFxPixmapCacheItem *item = new QFxPixmapCacheItem;
item->addRef(); // XXX - will never get deleted. Need to revisit caching
item->key = key;
@@ -274,7 +274,7 @@ void QFxPixmap::cancelGet(const QUrl& url, QObject* obj, const char* slot)
{
QString key = url.toString();
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key);
- if(iter == qfxPixmapCache.end())
+ if (iter == qfxPixmapCache.end())
return;
if ((*iter)->reply)
QObject::disconnect((*iter)->reply, SIGNAL(finished()), obj, slot);
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index a761ec5..2bfc149 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -238,7 +238,7 @@ QColor QFxRect::color() const
void QFxRect::setColor(const QColor &c)
{
Q_D(QFxRect);
- if(d->_color == c)
+ if (d->_color == c)
return;
d->_color = c;
@@ -281,7 +281,7 @@ QColor QFxRect::tintColor() const
void QFxRect::setTintColor(const QColor &c)
{
Q_D(QFxRect);
- if(d->_tintColor == c)
+ if (d->_tintColor == c)
return;
d->_tintColor = c;
@@ -290,11 +290,11 @@ void QFxRect::setTintColor(const QColor &c)
QColor QFxRectPrivate::getColor()
{
- if(_tintColor.isValid()) {
+ if (_tintColor.isValid()) {
int a = _tintColor.alpha();
- if(a == 0xFF)
+ if (a == 0xFF)
return _tintColor;
- else if(a == 0x00)
+ else if (a == 0x00)
return _color;
else {
uint src = _tintColor.rgba();
@@ -304,7 +304,7 @@ QColor QFxRectPrivate::getColor()
((0xFF - a) * (dest & 0xFF00FF))) >> 8) & 0xFF00FF;
res |= (((a * ((src >> 8) & 0xFF00FF)) +
((0xFF - a) * ((dest >> 8) & 0xFF00FF)))) & 0xFF00FF00;
- if((src & 0xFF000000) == 0xFF000000)
+ if ((src & 0xFF000000) == 0xFF000000)
res |= 0xFF000000;
return QColor::fromRgba(res);
@@ -344,7 +344,7 @@ QColor QFxRect::gradientColor() const
void QFxRect::setGradientColor(const QColor &c)
{
Q_D(QFxRect);
- if(d->_gradcolor == c)
+ if (d->_gradcolor == c)
return;
d->_gradcolor = c;
@@ -438,14 +438,14 @@ void QFxRect::paintContents(QPainter &p)
void QFxRect::drawRect(QPainter &p)
{
Q_D(QFxRect);
- if(d->_gradcolor.isValid() /*|| p.usingQt() */) {
+ if (d->_gradcolor.isValid() /*|| p.usingQt() */) {
// XXX This path is still slower than the image path
// Image path won't work for gradients though
p.save();
QPen pn(QColor(pen()->color()), pen()->width());
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pn);
- if(d->_gradcolor.isValid()){
+ if (d->_gradcolor.isValid()){
QLinearGradient grad(0, 0, 0, height());
grad.setColorAt(0, d->_color);
grad.setColorAt(1, d->_gradcolor);
@@ -453,7 +453,7 @@ void QFxRect::drawRect(QPainter &p)
}else{
p.setBrush(d->_color);
}
- if(d->_radius)
+ if (d->_radius)
p.drawRoundedRect(0, 0, width(), height(), d->_radius, d->_radius);
else
p.drawRect(0, 0, width(), height());
@@ -477,36 +477,36 @@ void QFxRect::drawRect(QPainter &p)
p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset));
// Upper middle
- if(d->_rectImage.width() - xSide)
+ if (d->_rectImage.width() - xSide)
p.drawImage(QRect(offset, 0, width() - xSide, offset), d->_rectImage,
QRect(offset, 0, d->_rectImage.width() - xSide, offset));
// Upper right
- if(d->_rectImage.width() - offset) {
+ if (d->_rectImage.width() - offset) {
p.drawImage(QPoint(width()-offset, 0), d->_rectImage,
QRect(d->_rectImage.width()-offset, 0, offset, offset));
}
// Middle left
- if(d->_rectImage.height() - ySide)
+ if (d->_rectImage.height() - ySide)
p.drawImage(QRect(0, offset, offset, height() - ySide), d->_rectImage,
QRect(0, offset, offset, d->_rectImage.height() - ySide));
// Middle
- if(d->_rectImage.width() - xSide && d->_rectImage.height() - ySide)
+ if (d->_rectImage.width() - xSide && d->_rectImage.height() - ySide)
p.drawImage(QRect(offset, offset, width() - xSide, height() - ySide), d->_rectImage,
QRect(offset, offset, d->_rectImage.width() - xSide, d->_rectImage.height() - ySide));
// Midlle right
- if(d->_rectImage.height() - ySide)
+ if (d->_rectImage.height() - ySide)
p.drawImage(QRect(width()-offset, offset, offset, height() - ySide), d->_rectImage,
QRect(d->_rectImage.width()-offset, offset, offset, d->_rectImage.height() - ySide));
// Lower left
p.drawImage(QPoint(0, height() - offset), d->_rectImage, QRect(0, d->_rectImage.height() - offset, offset, offset));
// Lower Middle
- if(d->_rectImage.width() - xSide)
+ if (d->_rectImage.width() - xSide)
p.drawImage(QRect(offset, height() - offset, width() - xSide, offset), d->_rectImage,
QRect(offset, d->_rectImage.height() - offset, d->_rectImage.width() - xSide, offset));
// Lower Right
- if(d->_rectImage.width() - offset)
+ if (d->_rectImage.width() - offset)
p.drawImage(QPoint(width()-offset, height() - offset), d->_rectImage,
QRect(d->_rectImage.width()-offset, d->_rectImage.height() - offset, offset, offset));
}
@@ -519,8 +519,8 @@ void QFxRect::drawRect(QPainter &p)
void QFxRect::paintGLContents(GLPainter &p)
{
Q_D(QFxRect);
- if(d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
- if(d->_gradcolor.isValid()) {
+ if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
+ if (d->_gradcolor.isValid()) {
float widthV = width();
float heightV = height();
@@ -582,7 +582,7 @@ void QFxRect::paintGLContents(GLPainter &p)
float imgWidth = d->_rectTexture.width();
float imgHeight = d->_rectTexture.height();
- if(!imgWidth || !imgHeight)
+ if (!imgWidth || !imgHeight)
return;
float widthV = width();
@@ -607,7 +607,7 @@ void QFxRect::paintGLContents(GLPainter &p)
imgbottom = heightV - offset;
//Bug 231768: Inappropriate interpolation was occuring on 3x3 textures
- if(offset==1)
+ if (offset==1)
texleft=texright=textop=texbottom=0.5;
float vert1[] = { 0, 0,
@@ -686,7 +686,7 @@ void QFxRect::paintGLContents(GLPainter &p)
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(p.activeTransform.data());
- if(d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
+ if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
GLfloat vertices[] = { 0, heightV,
widthV, heightV,
0, 0,
@@ -696,7 +696,7 @@ void QFxRect::paintGLContents(GLPainter &p)
glVertexPointer(2,GL_FLOAT,0,vertices);
QColor c;
- if(d->_gradcolor.isValid())
+ if (d->_gradcolor.isValid())
c = d->_color;
else
c = d->getColor();
@@ -707,7 +707,7 @@ void QFxRect::paintGLContents(GLPainter &p)
float r2 = r; float g2 = g; float b2 = b; float a2 = a;
- if(d->_gradcolor.isValid()) {
+ if (d->_gradcolor.isValid()) {
r2 = d->_gradcolor.redF();
g2 = d->_gradcolor.greenF();
b2 = d->_gradcolor.blueF();
@@ -736,7 +736,7 @@ void QFxRect::paintGLContents(GLPainter &p)
offset = d->pen()->width();
}
- if(p.activeOpacity == 1.) {
+ if (p.activeOpacity == 1.) {
GLint i = GL_REPLACE;
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i);
} else {
@@ -747,7 +747,7 @@ void QFxRect::paintGLContents(GLPainter &p)
float imgWidth = d->_rectTexture.width();
float imgHeight = d->_rectTexture.height();
- if(!imgWidth || !imgHeight)
+ if (!imgWidth || !imgHeight)
return;
float widthV = width();
diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h
index 3cb46fa..2fd555f 100644
--- a/src/declarative/fx/qfxrect_p.h
+++ b/src/declarative/fx/qfxrect_p.h
@@ -88,7 +88,7 @@ public:
QColor _gradcolor;
QColor _tintColor;
QFxPen *pen() {
- if(!_pen) {
+ if (!_pen) {
Q_Q(QFxRect);
_pen = new QFxPen;
QObject::connect(_pen, SIGNAL(updated()), q, SLOT(doUpdate()));
diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp
index 39342d7..e02bc16 100644
--- a/src/declarative/fx/qfxreflectionfilter.cpp
+++ b/src/declarative/fx/qfxreflectionfilter.cpp
@@ -135,7 +135,7 @@ qreal QFxReflectionFilter::alpha() const
void QFxReflectionFilter::setAlpha(qreal a)
{
- if(d->alpha == a) return;
+ if (d->alpha == a) return;
d->alpha = a;
emit alphaChanged(a);
update();
@@ -202,7 +202,7 @@ int QFxReflectionFilter::height() const
void QFxReflectionFilter::setHeight(int h)
{
- if(d->height == h) return;
+ if (d->height == h) return;
d->height = h;
emit heightChanged(h);
update();
@@ -219,7 +219,7 @@ int QFxReflectionFilter::offset()
void QFxReflectionFilter::setOffset(int o)
{
- if(d->offset == o) return;
+ if (d->offset == o) return;
d->offset = o;
emit offsetChanged(o);
update();
@@ -236,7 +236,7 @@ qreal QFxReflectionFilter::scale() const
void QFxReflectionFilter::setScale(qreal s)
{
- if(d->scale == s) return;
+ if (d->scale == s) return;
d->scale = s;
emit scaleChanged(s);
update();
@@ -259,12 +259,12 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
float height = r.height();
float refHeight = height;
- if(d->height > 0)
+ if (d->height > 0)
refHeight = min(height, d->height);
QSimpleCanvas::Matrix simpMat;
QSimpleCanvasItem *simpItem = 0;
- if(isSimpleItem(&simpItem, &simpMat) &&
+ if (isSimpleItem(&simpItem, &simpMat) &&
simpItem->glSimpleItemData(0, 0, 0, 0)) {
GLfloat vertices[8];
@@ -276,7 +276,7 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
GLfloat opacity[4];
float invRefHeight = 1. / refHeight;
- for(int ii = 0; ii < 4; ++ii) {
+ for (int ii = 0; ii < 4; ++ii) {
float vertex = vertices[ii * 2 + 1];
float o = (1. - (height - vertex) * invRefHeight);
opacity[ii] = o * d->alpha * p.activeOpacity;
@@ -285,7 +285,7 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
QSimpleCanvas::Matrix trans = p.activeTransform;
trans.rotate(180, 1, 0, 0);
trans.translate(0, -r.height() - d->offset);
- if(d->scale != 1)
+ if (d->scale != 1)
trans.scale(1, d->scale, 1);
trans.translate(0, -r.height());
trans *= simpMat;
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 78e9f51..7ee949d 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -259,15 +259,15 @@ void QFxRepeater::regenerate()
qDeleteAll(d->deletables);
d->deletables.clear();
- if(!d->component || !itemParent() || !isComponentComplete())
+ if (!d->component || !itemParent() || !isComponentComplete())
return;
QFxItem *lastItem = this;
- if(d->dataSource.type() == QVariant::StringList) {
+ if (d->dataSource.type() == QVariant::StringList) {
QStringList sl = qvariant_cast<QStringList>(d->dataSource);
- for(int ii = 0; ii < sl.size(); ++ii) {
+ for (int ii = 0; ii < sl.size(); ++ii) {
QmlContext *ctxt = new QmlContext(qmlContext(this), this);
d->deletables << ctxt;
@@ -277,12 +277,12 @@ void QFxRepeater::regenerate()
if (QFxItem *item = d->addItem(ctxt, lastItem))
lastItem = item;
}
- } else if(QmlMetaType::isList(d->dataSource)) {
+ } else if (QmlMetaType::isList(d->dataSource)) {
int cnt = QmlMetaType::listCount(d->dataSource);
- if(cnt <= 0)
+ if (cnt <= 0)
return;
- for(int ii = 0; ii < cnt; ++ii) {
+ for (int ii = 0; ii < cnt; ++ii) {
QVariant v = QmlMetaType::listAt(d->dataSource, ii);
QObject *o = QmlMetaType::toQObject(v);
@@ -297,10 +297,10 @@ void QFxRepeater::regenerate()
}
} else if (QListModelInterface *model = qobject_cast<QListModelInterface*>(d->dataSource.value<QObject*>())) {
int cnt = model->count();
- if(cnt <= 0)
+ if (cnt <= 0)
return;
- for(int ii = 0; ii < cnt; ++ii) {
+ for (int ii = 0; ii < cnt; ++ii) {
QmlContext *ctxt = new QmlContext(qmlContext(this), this);
d->deletables << ctxt;
@@ -339,11 +339,11 @@ void QFxRepeater::regenerate()
d->addItem(ctxt, lastItem);
- } else if(d->dataSource.canConvert(QVariant::Int)){
+ } else if (d->dataSource.canConvert(QVariant::Int)){
int count = qvariant_cast<int>(d->dataSource);
- for(int ii = 0; ii < count; ++ii) {
+ for (int ii = 0; ii < count; ++ii) {
QmlContext *ctxt = new QmlContext(qmlContext(this), this);
d->deletables << ctxt;
diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp
index d84f5e8..325f7d9 100644
--- a/src/declarative/fx/qfxscalegrid.cpp
+++ b/src/declarative/fx/qfxscalegrid.cpp
@@ -153,29 +153,29 @@ QFxGridScaledImage::QFxGridScaledImage(QIODevice *data)
while(!data->atEnd()) {
QString line = QString::fromUtf8(data->readLine().trimmed());
- if(line.isEmpty() || line.startsWith(QLatin1String("#")))
+ if (line.isEmpty() || line.startsWith(QLatin1String("#")))
continue;
QStringList list = line.split(QLatin1Char(':'));
- if(list.count() != 2)
+ if (list.count() != 2)
return;
list[0] = list[0].trimmed();
list[1] = list[1].trimmed();
- if(list[0] == QLatin1String("gridLeft"))
+ if (list[0] == QLatin1String("gridLeft"))
l = list[1].toInt();
- else if(list[0] == QLatin1String("gridRight"))
+ else if (list[0] == QLatin1String("gridRight"))
r = list[1].toInt();
- else if(list[0] == QLatin1String("gridTop"))
+ else if (list[0] == QLatin1String("gridTop"))
t = list[1].toInt();
- else if(list[0] == QLatin1String("gridBottom"))
+ else if (list[0] == QLatin1String("gridBottom"))
b = list[1].toInt();
- else if(list[0] == QLatin1String("imageFile"))
+ else if (list[0] == QLatin1String("imageFile"))
imgFile = list[1];
}
- if(l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty())
+ if (l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty())
return;
_l = l; _r = r; _t = t; _b = b;
diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp
index 3760a4d..38d1c31 100644
--- a/src/declarative/fx/qfxshadowfilter.cpp
+++ b/src/declarative/fx/qfxshadowfilter.cpp
@@ -122,7 +122,7 @@ int QFxShadowFilter::xOffset() const
*/
void QFxShadowFilter::setXOffset(int offset)
{
- if(d->x == offset) return;
+ if (d->x == offset) return;
d->x = offset;
emit offsetChanged(d->x, d->y);
}
@@ -138,7 +138,7 @@ int QFxShadowFilter::yOffset() const
void QFxShadowFilter::setYOffset(int offset)
{
- if(d->y == offset) return;
+ if (d->y == offset) return;
d->y = offset;
emit offsetChanged(d->x, d->y);
}
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index e7085d8..5cb31e1 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -165,7 +165,7 @@ void QFxText::setText(const QString &n)
QFxPerfTimer<QFxPerf::QFxText_setText> st;
#endif
Q_D(QFxText);
- if(d->text == n)
+ if (d->text == n)
return;
d->richText = Qt::mightBeRichText(n); // ### what's the cost?
@@ -205,7 +205,7 @@ QString QFxText::text() const
void QFxText::setColor(const QColor &color)
{
Q_D(QFxText);
- if(d->color == color)
+ if (d->color == color)
return;
d->imgDirty = true;
@@ -270,7 +270,7 @@ QFxText::TextStyle QFxText::style() const
void QFxText::setStyle(QFxText::TextStyle style)
{
Q_D(QFxText);
- if(d->style == style)
+ if (d->style == style)
return;
d->imgDirty = true;
@@ -281,7 +281,7 @@ void QFxText::setStyle(QFxText::TextStyle style)
void QFxText::setStyleColor(const QColor &color)
{
Q_D(QFxText);
- if(d->styleColor == color)
+ if (d->styleColor == color)
return;
d->imgDirty = true;
@@ -424,7 +424,7 @@ void QFxText::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
Q_D(QFxText);
- if(newGeometry.width() != oldGeometry.width()) {
+ if (newGeometry.width() != oldGeometry.width()) {
if (d->wrap || d->elideMode != Qt::ElideNone) {
d->imgDirty = true;
d->updateSize();
@@ -446,10 +446,10 @@ void QFxTextPrivate::updateSize()
{
Q_Q(QFxText);
if (q->isComponentComplete()) {
- if(text.isEmpty()) {
+ if (text.isEmpty()) {
return;
}
- QFont f; if(_font) f = _font->font();
+ QFont f; if (_font) f = _font->font();
QFontMetrics fm(f);
int dy = q->height();
@@ -573,7 +573,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout)
Q_Q(QFxText);
layout->setCacheEnabled(true);
- QFont f; if(_font) f = _font->font();
+ QFont f; if (_font) f = _font->font();
QFontMetrics fm = QFontMetrics(f);
int leading = fm.leading();
@@ -613,7 +613,7 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle)
{
//do layout
Q_Q(const QFxText);
- QFont f; if(_font) f = _font->font();
+ QFont f; if (_font) f = _font->font();
QString tmp = text;
if (singleline && elideMode != Qt::ElideNone && q->widthValid()) {
QFontMetrics fm(f);
@@ -626,11 +626,11 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle)
int x = 0;
for (int i = 0; i < textLayout.lineCount(); ++i) {
QTextLine line = textLayout.lineAt(i);
- if(hAlign == QFxText::AlignLeft) {
+ if (hAlign == QFxText::AlignLeft) {
x = 0;
- } else if(hAlign == QFxText::AlignRight) {
+ } else if (hAlign == QFxText::AlignRight) {
x = size.width() - (int)line.naturalTextWidth();
- } else if(hAlign == QFxText::AlignHCenter) {
+ } else if (hAlign == QFxText::AlignHCenter) {
x = (size.width() - (int)line.naturalTextWidth()) / 2;
}
line.setPosition(QPoint(x, (int)line.y()));
@@ -679,7 +679,7 @@ QImage QFxTextPrivate::richTextImage(bool drawStyle)
void QFxTextPrivate::checkImgCache()
{
- if(!imgDirty)
+ if (!imgDirty)
return;
bool empty = text.isEmpty();
@@ -722,7 +722,7 @@ void QFxText::paintContents(QPainter &p)
{
Q_D(QFxText);
d->checkImgCache();
- if(d->imgCache.isNull())
+ if (d->imgCache.isNull())
return;
int w = width();
@@ -763,7 +763,7 @@ void QFxText::paintGLContents(GLPainter &p)
{
Q_D(QFxText);
d->checkImgCache();
- if(d->imgCache.isNull())
+ if (d->imgCache.isNull())
return;
int w = width();
@@ -826,7 +826,7 @@ void QFxText::paintGLContents(GLPainter &p)
{
Q_D(QFxText);
d->checkImgCache();
- if(d->imgCache.isNull())
+ if (d->imgCache.isNull())
return;
int w = width();
@@ -875,7 +875,7 @@ void QFxText::paintGLContents(GLPainter &p)
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(p.activeTransform.data());
glEnable(GL_TEXTURE_2D);
- if(p.activeOpacity == 1.) {
+ if (p.activeOpacity == 1.) {
GLint i = GL_REPLACE;
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i);
} else {
diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h
index 7be4309..4296891 100644
--- a/src/declarative/fx/qfxtext_p.h
+++ b/src/declarative/fx/qfxtext_p.h
@@ -98,7 +98,7 @@ public:
QString text;
QmlFont *font()
{
- if(!_font) {
+ if (!_font) {
Q_Q(QFxText);
_font = new QmlFont;
QObject::connect(_font, SIGNAL(updated()), q, SLOT(fontChanged()));
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 7efb826..68aea01 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -270,7 +270,7 @@ QColor QFxTextEdit::color() const
void QFxTextEdit::setColor(const QColor &color)
{
Q_D(QFxTextEdit);
- if(d->color == color)
+ if (d->color == color)
return;
clearCache();
@@ -370,7 +370,7 @@ void QFxTextEdit::setWrap(bool w)
void QFxTextEdit::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- if(newGeometry.width() != oldGeometry.width())
+ if (newGeometry.width() != oldGeometry.width())
updateSize();
QFxImageItem::geometryChanged(newGeometry, oldGeometry);
}
diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp
index 3f54949..9f18413 100644
--- a/src/declarative/fx/qfxtransform.cpp
+++ b/src/declarative/fx/qfxtransform.cpp
@@ -79,7 +79,7 @@ QSimpleCanvas::Matrix QFxTransform::transform() const
void QFxTransform::update()
{
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
@@ -241,11 +241,11 @@ bool QFxRotation::isIdentity() const
const qreal inv_dist_to_plane = 1. / 1024.;
QTransform QFxRotation::transform() const
{
- if(_dirty) {
+ if (_dirty) {
_transform = QTransform();
- if(!isIdentity()) {
- if(angle() != 0.) {
+ if (!isIdentity()) {
+ if (angle() != 0.) {
QTransform rotTrans;
rotTrans.translate(-_axis.startX(), -_axis.startY());
QTransform rotTrans2;
@@ -260,11 +260,11 @@ QTransform QFxRotation::transform() const
qreal z = _axis.endZ();
qreal idtp = inv_dist_to_plane;
- if(distanceToPlane() != 1024.)
+ if (distanceToPlane() != 1024.)
idtp = 1. / distanceToPlane();
qreal len = x * x + y * y + z * z;
- if(len != 1.) {
+ if (len != 1.) {
len = ::sqrt(len);
x /= len;
y /= len;
@@ -289,12 +289,12 @@ QTransform QFxRotation::transform() const
#elif defined(QFX_RENDER_OPENGL)
QMatrix4x4 QFxRotation::transform() const
{
- if(_dirty) {
+ if (_dirty) {
_dirty = false;
_transform = QMatrix4x4();
- if(!isIdentity()) {
- if(angle() != 0.) {
+ if (!isIdentity()) {
+ if (angle() != 0.) {
qreal x = _axis.endX() - _axis.startX();
qreal y = _axis.endY() - _axis.startY();
qreal z = _axis.endZ();
@@ -328,7 +328,7 @@ void QFxRotation::update()
{
_dirty = true;
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
@@ -405,11 +405,11 @@ bool QFxTranslation::isIdentity() const
#if defined(QFX_RENDER_QPAINTER)
QTransform QFxTranslation::transform() const
{
- if(_dirty) {
+ if (_dirty) {
_transform = QTransform();
- if(!isIdentity()) {
- if(distance() != 0.) {
+ if (!isIdentity()) {
+ if (distance() != 0.) {
QTransform trans;
trans.translate((_axis.endX() - _axis.startX()) * distance(),
(_axis.endY() - _axis.startY()) * distance());
@@ -425,12 +425,12 @@ QTransform QFxTranslation::transform() const
#elif defined(QFX_RENDER_OPENGL)
QMatrix4x4 QFxRotation::transform() const
{
- if(_dirty) {
+ if (_dirty) {
_dirty = false;
_transform = QMatrix4x4();
- if(!isIdentity()) {
- if(distance() != 0.)
+ if (!isIdentity()) {
+ if (distance() != 0.)
_transform.translate((_axis.endX() - _axis.startX()) * distance(),
(_axis.endY() - _axis.startY()) * distance(),
(_axis.endZ()) * distance());
@@ -447,13 +447,13 @@ void QFxTranslation::update()
_dirty = true;
#if !defined(QFX_RENDER_OPENGL)
- if(_axis.endZ() != 0. && distance() != 0.) {
+ if (_axis.endZ() != 0. && distance() != 0.) {
qmlInfo(this) << "QTransform cannot translate along Z-axis.";
}
#endif
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
@@ -695,7 +695,7 @@ void QFxSquish::setbottomRight_y(qreal v)
void QFxSquish::update()
{
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
@@ -714,7 +714,7 @@ QMatrix4x4 QFxSquish::transform() const
QTransform t;
QMatrix4x4 rv;
- if(QTransform::quadToQuad(poly, poly2, t))
+ if (QTransform::quadToQuad(poly, poly2, t))
rv = QMatrix4x4(t);
return rv;
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index e851bad..7d0d7a5 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -85,13 +85,13 @@ public:
QmlListAccessor *m_modelList;
int modelCount() const {
- if(m_visualItemModel)
+ if (m_visualItemModel)
return m_visualItemModel->count();
- if(m_listModelInterface)
+ if (m_listModelInterface)
return m_listModelInterface->count();
- if(m_abstractItemModel)
+ if (m_abstractItemModel)
return m_abstractItemModel->rowCount();
- if(m_modelList)
+ if (m_modelList)
return m_modelList->count();
return 0;
}
@@ -162,10 +162,10 @@ int QFxVisualItemModelDataMetaObject::createProperty(const char *name, const cha
return QmlOpenMetaObject::createProperty(name, type);
} else {
const QLatin1String sname(name);
- for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
+ for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
iter != data->m_model->m_roleNames.end(); ++iter) {
- if(*iter == sname)
+ if (*iter == sname)
return QmlOpenMetaObject::createProperty(name, type);
}
}
@@ -184,10 +184,10 @@ QFxVisualItemModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro
&& data->m_model->m_modelList) {
return data->m_model->m_modelList->at(data->m_index);
} else if (data->m_model->m_listModelInterface) {
- for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
+ for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
iter != data->m_model->m_roleNames.end(); ++iter) {
- if(*iter == name) {
+ if (*iter == name) {
roles.append(iter.key());
QHash<int,QVariant> values = data->m_model->m_listModelInterface->data(data->m_index, QList<int>() << iter.key());
if (values.isEmpty())
@@ -197,10 +197,10 @@ QFxVisualItemModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro
}
}
} else if (data->m_model->m_abstractItemModel) {
- for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
+ for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
iter != data->m_model->m_roleNames.end(); ++iter) {
- if(*iter == name) {
+ if (*iter == name) {
roles.append(iter.key());
QModelIndex index = data->m_model->m_abstractItemModel->index(data->m_index, 0);
return data->m_model->m_abstractItemModel->data(index, iter.key());
@@ -297,7 +297,7 @@ QFxVisualItemModel::QFxVisualItemModel(QmlContext *ctxt)
QFxVisualItemModel::~QFxVisualItemModel()
{
Q_D(QFxVisualItemModel);
- if(d->m_modelList)
+ if (d->m_modelList)
delete d->m_modelList;
}
@@ -311,7 +311,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
{
Q_D(QFxVisualItemModel);
d->m_modelVariant = model;
- if(d->m_listModelInterface) {
+ if (d->m_listModelInterface) {
// Assume caller has released all items.
QObject::disconnect(d->m_listModelInterface, SIGNAL(itemsChanged(int,int,QList<int>)),
this, SLOT(_q_itemsChanged(int,int,QList<int>)));
@@ -329,7 +329,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
this, SLOT(_q_rowsRemoved(const QModelIndex &,int,int)));
QObject::disconnect(d->m_abstractItemModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)),
this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&)));
- } else if(d->m_visualItemModel) {
+ } else if (d->m_visualItemModel) {
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsRemoved(int,int)),
@@ -343,9 +343,9 @@ void QFxVisualItemModel::setModel(const QVariant &model)
if (object && (d->m_listModelInterface = qobject_cast<QListModelInterface *>(object))) {
d->m_roles.clear();
d->m_roleNames.clear();
- if(d->m_listModelInterface) {
+ if (d->m_listModelInterface) {
d->m_roles = d->m_listModelInterface->roles();
- for(int ii = 0; ii < d->m_roles.count(); ++ii)
+ for (int ii = 0; ii < d->m_roles.count(); ++ii)
d->m_roleNames.insert(d->m_roles.at(ii),
d->m_listModelInterface->toString(d->m_roles.at(ii)));
}
@@ -359,7 +359,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)),
this, SLOT(_q_itemsMoved(int,int,int)));
- if(d->m_delegate && d->m_listModelInterface->count())
+ if (d->m_delegate && d->m_listModelInterface->count())
emit itemsInserted(0, d->m_listModelInterface->count());
return;
} else if (object && (d->m_abstractItemModel = qobject_cast<QAbstractItemModel *>(object))) {
@@ -390,7 +390,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
if (!d->m_modelList)
d->m_modelList = new QmlListAccessor;
d->m_modelList->setList(model);
- if(d->m_delegate && d->modelCount())
+ if (d->m_delegate && d->modelCount())
emit itemsInserted(0, d->modelCount());
}
@@ -405,7 +405,7 @@ void QFxVisualItemModel::setDelegate(QmlComponent *delegate)
Q_D(QFxVisualItemModel);
d->m_delegate = delegate;
- if(d->modelCount())
+ if (d->modelCount())
emit itemsInserted(0, d->modelCount());
}
@@ -430,7 +430,7 @@ int QFxVisualItemModel::count() const
QFxItem *QFxVisualItemModel::item(int index, bool complete)
{
Q_D(QFxVisualItemModel);
- if(d->m_visualItemModel)
+ if (d->m_visualItemModel)
return d->m_visualItemModel->item(index, d->m_part.toLatin1(), complete);
return item(index, QByteArray(), complete);
}
@@ -471,7 +471,7 @@ void QFxVisualItemModel::release(QFxItem *item)
QObject *QFxVisualItemModel::parts()
{
Q_D(QFxVisualItemModel);
- if(!d->m_parts)
+ if (!d->m_parts)
d->m_parts = new QFxVisualItemModelParts(this);
return d->m_parts;
}
@@ -479,18 +479,18 @@ QObject *QFxVisualItemModel::parts()
QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool complete)
{
Q_D(QFxVisualItemModel);
- if(d->m_visualItemModel)
+ if (d->m_visualItemModel)
return d->m_visualItemModel->item(index, viewId, complete);
- if(d->modelCount() <= 0 || !d->m_delegate)
+ if (d->modelCount() <= 0 || !d->m_delegate)
return 0;
QObject *nobj = 0;
- if(d->m_cache.contains(index)) {
+ if (d->m_cache.contains(index)) {
nobj = d->m_cache[index];
} else {
QmlContext *ccontext = d->m_context;
- if(!ccontext) ccontext = qmlContext(this);
+ if (!ccontext) ccontext = qmlContext(this);
QmlContext *ctxt = new QmlContext(ccontext);
QFxVisualItemModelData *data = new QFxVisualItemModelData(index, d);
ctxt->setContextProperty(QLatin1String("model"), data);
@@ -507,7 +507,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp
QFxItem *item = qobject_cast<QFxItem *>(nobj);
if (!item) {
QmlPackage *package = qobject_cast<QmlPackage *>(nobj);
- if(package) {
+ if (package) {
QObject *o = package->part(QLatin1String(viewId));
item = qobject_cast<QFxItem *>(o);
d->m_packaged[o] = package;
@@ -520,7 +520,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp
void QFxVisualItemModel::completeItem()
{
Q_D(QFxVisualItemModel);
- if(d->m_visualItemModel) {
+ if (d->m_visualItemModel) {
d->m_visualItemModel->completeItem();
return;
}
@@ -534,11 +534,11 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj
if (d->m_visualItemModel)
return d->m_visualItemModel->evaluate(index, expression, objectContext);
- if((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate)
+ if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate)
return QVariant();
QVariant value;
- if(d->m_cache.contains(index)) {
+ if (d->m_cache.contains(index)) {
QObject *nobj = d->m_cache[index];
QFxItem *item = qobject_cast<QFxItem *>(nobj);
if (item) {
@@ -548,7 +548,7 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj
}
} else {
QmlContext *ccontext = d->m_context;
- if(!ccontext) ccontext = qmlContext(this);
+ if (!ccontext) ccontext = qmlContext(this);
QmlContext *ctxt = new QmlContext(ccontext);
QFxVisualItemModelData *data = new QFxVisualItemModelData(index, d);
ctxt->addDefaultObject(data);
@@ -567,17 +567,17 @@ void QFxVisualItemModel::_q_itemsChanged(int index, int count,
{
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
- for(int ii = index; ii < index + count; ++ii) {
+ for (int ii = index; ii < index + count; ++ii) {
- if(d->m_cache.contains(ii)) {
+ if (d->m_cache.contains(ii)) {
QObject *item = d->m_cache[ii];
QFxVisualItemModelData *data = d->data(item);
- for(int prop = 0; prop < data->count(); ++prop) {
+ for (int prop = 0; prop < data->count(); ++prop) {
int role = data->role(prop);
- if(roles.contains(role)) {
+ if (roles.contains(role)) {
if (d->m_listModelInterface) {
data->setValue(prop, *d->m_listModelInterface->data(ii, QList<int>() << role).begin());
} else if (d->m_abstractItemModel) {
@@ -596,10 +596,10 @@ void QFxVisualItemModel::_q_itemsInserted(int index, int count)
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
QHash<int, QObject *> items;
- for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
+ for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
- if(iter.key() >= index) {
+ if (iter.key() >= index) {
QObject *item = *iter;
int index = iter.key() + count;
iter = d->m_cache.erase(iter);
@@ -622,15 +622,15 @@ void QFxVisualItemModel::_q_itemsRemoved(int index, int count)
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
QHash<int, QObject *> items;
- for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
+ for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
- if(iter.key() >= index && iter.key() < index + count) {
+ if (iter.key() >= index && iter.key() < index + count) {
QObject *item = *iter;
iter = d->m_cache.erase(iter);
items.insertMulti(-1, item); //XXX perhaps better to maintain separately
QFxVisualItemModelData *data = d->data(item);
data->setIndex(-1);
- } else if(iter.key() >= index + count) {
+ } else if (iter.key() >= index + count) {
QObject *item = *iter;
int index = iter.key() - count;
iter = d->m_cache.erase(iter);
@@ -651,10 +651,10 @@ void QFxVisualItemModel::_q_itemsMoved(int from, int to, int count)
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
QHash<int, QObject *> items;
- for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
+ for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
- if(iter.key() >= from && iter.key() < from + count) {
+ if (iter.key() >= from && iter.key() < from + count) {
QObject *item = *iter;
int index = iter.key() - from + to;
iter = d->m_cache.erase(iter);
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index 293c72b..a6210e5 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -293,7 +293,7 @@ QString QFxWebView::url() const
void QFxWebView::setUrl(const QString &n)
{
Q_D(QFxWebView);
- if(n == page()->mainFrame()->url().toString())
+ if (n == page()->mainFrame()->url().toString())
return;
page()->setViewportSize(QSize(
@@ -331,7 +331,7 @@ int QFxWebView::idealWidth() const
void QFxWebView::setIdealWidth(int iw)
{
Q_D(QFxWebView);
- if(d->idealwidth == iw) return;
+ if (d->idealwidth == iw) return;
d->idealwidth = iw;
expandToWebPage();
emit idealWidthChanged();
@@ -354,7 +354,7 @@ int QFxWebView::idealHeight() const
void QFxWebView::setIdealHeight(int ih)
{
Q_D(QFxWebView);
- if(d->idealheight == ih) return;
+ if (d->idealheight == ih) return;
d->idealheight = ih;
expandToWebPage();
emit idealHeightChanged();
@@ -381,7 +381,7 @@ bool QFxWebView::interactive() const
void QFxWebView::setInteractive(bool i)
{
Q_D(QFxWebView);
- if(d->interactive == i) return;
+ if (d->interactive == i) return;
d->interactive = i;
emit interactiveChanged();
}
@@ -403,7 +403,7 @@ bool QFxWebView::smooth() const
void QFxWebView::setSmooth(bool i)
{
Q_D(QFxWebView);
- if(d->smooth == i) return;
+ if (d->smooth == i) return;
d->smooth = i;
update();
}
@@ -438,7 +438,7 @@ void QFxWebView::expandToWebPage()
void QFxWebView::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- if(newGeometry.size() != oldGeometry.size())
+ if (newGeometry.size() != oldGeometry.size())
expandToWebPage();
QFxItem::geometryChanged(newGeometry, oldGeometry);
}
diff --git a/src/declarative/fx/qfxwidgetcontainer.cpp b/src/declarative/fx/qfxwidgetcontainer.cpp
index f86c8dc..fccdad1 100644
--- a/src/declarative/fx/qfxwidgetcontainer.cpp
+++ b/src/declarative/fx/qfxwidgetcontainer.cpp
@@ -78,16 +78,16 @@ QGraphicsWidget *QFxWidgetContainer::graphicsWidget() const
*/
void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget)
{
- if(widget == _graphicsWidget)
+ if (widget == _graphicsWidget)
return;
_graphicsWidget = widget;
QSimpleCanvas *c = canvas();
- if(!c)
+ if (!c)
return;
- if(c->canvasMode() != QSimpleCanvas::GraphicsView) {
+ if (c->canvasMode() != QSimpleCanvas::GraphicsView) {
qWarning("QFxWidgetContainer: Cannot add a widget to a non-graphicsview canvas. You might need to set QFX_USE_GRAPHICSVIEW=1");
return;
}
@@ -98,7 +98,7 @@ void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget)
void QFxWidgetContainer::canvasChanged()
{
- if(_graphicsWidget) {
+ if (_graphicsWidget) {
QGraphicsWidget *w = _graphicsWidget;
_graphicsWidget = 0;
setGraphicsWidget(w);
diff --git a/src/declarative/opengl/glbasicshaders.cpp b/src/declarative/opengl/glbasicshaders.cpp
index e95e53f..f546c0b 100644
--- a/src/declarative/opengl/glbasicshaders.cpp
+++ b/src/declarative/opengl/glbasicshaders.cpp
@@ -127,7 +127,7 @@ BlurTextureShader::BlurTextureShader()
{\
mediump vec4 accum = vec4(0, 0, 0, 0); \
mediump vec2 offset; \
- if(horizontal) \
+ if (horizontal) \
offset = vec2(blurStep, 0); \
else \
offset = vec2(0, blurStep); \
@@ -150,22 +150,22 @@ BlurTextureShader::BlurTextureShader()
{\
mediump vec4 accum = vec4(0, 0, 0, 0); \
mediump vec2 offset; \
- if(horizontal) \
+ if (horizontal) \
offset = vec2(blurStep, 0); \
else \
offset = vec2(0, blurStep); \
mediump float sum = 0.0; \
- for(int ii = 0; ii < blurSteps; ++ii) { \
+ for (int ii = 0; ii < blurSteps; ++ii) { \
mediump float frac = float(blurSteps - ii) / float(blurSteps); \
mediump vec2 coord = myTexCoord + -float(ii) * offset; \
- if(coord.x >= 0.0 && coord.y >= 0.0 && coord.y <= 1.0 && coord.x <=1.0) \
+ if (coord.x >= 0.0 && coord.y >= 0.0 && coord.y <= 1.0 && coord.x <=1.0) \
accum += texture2D(sampler2d, coord) * frac; \
sum += frac; \
} \
- for(int ii = 1; ii < blurSteps; ++ii) { \
+ for (int ii = 1; ii < blurSteps; ++ii) { \
mediump float frac = float(blurSteps - ii) / float(blurSteps); \
mediump vec2 coord = myTexCoord + float(ii) * offset; \
- if(coord.x <= 1.0 && coord.y <= 1.0 && coord.x >= 0.0 && coord.y >= 0.0) \
+ if (coord.x <= 1.0 && coord.y <= 1.0 && coord.x >= 0.0 && coord.y >= 0.0) \
accum += texture2D(sampler2d, coord) * frac; \
sum += frac; \
} \
@@ -207,7 +207,7 @@ void BlurTextureShader::setSteps(int s)
void BlurTextureShader::setMode(Mode m)
{
- if(m == Horizontal)
+ if (m == Horizontal)
setUniformValue(mode, 1);
else
setUniformValue(mode, 0);
@@ -545,49 +545,49 @@ GLBasicShaders::~GLBasicShaders()
BlurTextureShader *GLBasicShaders::blurTexture()
{
- if(!d->blurTexture) d->blurTexture = new BlurTextureShader();
+ if (!d->blurTexture) d->blurTexture = new BlurTextureShader();
return d->blurTexture;
}
SingleTextureShader *GLBasicShaders::singleTexture()
{
- if(!d->singleTexture) d->singleTexture = new SingleTextureShader();
+ if (!d->singleTexture) d->singleTexture = new SingleTextureShader();
return d->singleTexture;
}
SingleTextureOpacityShader *GLBasicShaders::singleTextureOpacity()
{
- if(!d->singleTextureOpacity) d->singleTextureOpacity = new SingleTextureOpacityShader();
+ if (!d->singleTextureOpacity) d->singleTextureOpacity = new SingleTextureOpacityShader();
return d->singleTextureOpacity;
}
DualTextureAddShader *GLBasicShaders::dualTextureAdd()
{
- if(!d->dualTextureAdd) d->dualTextureAdd = new DualTextureAddShader();
+ if (!d->dualTextureAdd) d->dualTextureAdd = new DualTextureAddShader();
return d->dualTextureAdd;
}
SingleTextureVertexOpacityShader *GLBasicShaders::singleTextureVertexOpacity()
{
- if(!d->singleTextureVertexOpacity) d->singleTextureVertexOpacity = new SingleTextureVertexOpacityShader();
+ if (!d->singleTextureVertexOpacity) d->singleTextureVertexOpacity = new SingleTextureVertexOpacityShader();
return d->singleTextureVertexOpacity;
}
SingleTextureShadowShader *GLBasicShaders::singleTextureShadow()
{
- if(!d->singleTextureShadow) d->singleTextureShadow = new SingleTextureShadowShader();
+ if (!d->singleTextureShadow) d->singleTextureShadow = new SingleTextureShadowShader();
return d->singleTextureShadow;
}
ConstantColorShader *GLBasicShaders::constantColor()
{
- if(!d->constantColor) d->constantColor = new ConstantColorShader();
+ if (!d->constantColor) d->constantColor = new ConstantColorShader();
return d->constantColor;
}
ColorShader *GLBasicShaders::color()
{
- if(!d->color) d->color = new ColorShader();
+ if (!d->color) d->color = new ColorShader();
return d->color;
}
diff --git a/src/declarative/opengl/glsave.h b/src/declarative/opengl/glsave.h
index 3a67fb0..cca3d3c 100644
--- a/src/declarative/opengl/glsave.h
+++ b/src/declarative/opengl/glsave.h
@@ -82,7 +82,7 @@ public:
~GLSaveScissor()
{
- if(enabled)
+ if (enabled)
glEnable(GL_SCISSOR_TEST);
else
glDisable(GL_SCISSOR_TEST);
diff --git a/src/declarative/opengl/gltexture.cpp b/src/declarative/opengl/gltexture.cpp
index 73deece..6d737ad 100644
--- a/src/declarative/opengl/gltexture.cpp
+++ b/src/declarative/opengl/gltexture.cpp
@@ -96,7 +96,7 @@ public:
void GLTexturePrivate::genTexture()
{
- if(texture)
+ if (texture)
return;
glGenTextures(1, &texture);
@@ -116,7 +116,7 @@ GLTexture::GLTexture(const QString &file)
: d(new GLTexturePrivate(this))
{
QImage img(file);
- if(!img.isNull())
+ if (!img.isNull())
setImage(img);
}
@@ -128,7 +128,7 @@ GLTexture::GLTexture(const QImage &img)
GLTexture::~GLTexture()
{
- if(d->texture)
+ if (d->texture)
glDeleteTextures(1, &d->texture);
delete d;
d = 0;
@@ -141,7 +141,7 @@ bool GLTexture::isNull() const
void GLTexture::clear()
{
- if(d->texture) {
+ if (d->texture) {
glDeleteTextures(1, &d->texture);
d->texture = 0;
d->width = 0;
@@ -168,7 +168,7 @@ static inline int npot(int size)
*/
void GLTexture::setImage(const QImage &img)
{
- if(img.isNull())
+ if (img.isNull())
return;
d->genTexture();
@@ -187,9 +187,9 @@ void GLTexture::setImage(const QImage &img)
#if 0
glGenerateMipmap(GL_TEXTURE_2D);
int e = glGetError();
- if(d->magFilter == Linear)
+ if (d->magFilter == Linear)
setMagFilter(MipmapLinear);
- if(d->minFilter == Linear)
+ if (d->minFilter == Linear)
setMinFilter((GLTexture::FilterMode)GL_LINEAR_MIPMAP_LINEAR);
#endif
}
@@ -228,7 +228,7 @@ int GLTexture::height() const
*/
void GLTexture::setSize(const QSize &size)
{
- if(size.width() <= 0 || size.height() <= 0) {
+ if (size.width() <= 0 || size.height() <= 0) {
clear();
return;
}
@@ -253,13 +253,13 @@ GLTexture::WrapMode GLTexture::verticalWrap() const
void GLTexture::setHorizontalWrap(WrapMode mode)
{
d->horizWrap = mode;
- if(d->texture) {
+ if (d->texture) {
GLint last;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, mode);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, last);
}
}
@@ -270,13 +270,13 @@ void GLTexture::setHorizontalWrap(WrapMode mode)
void GLTexture::setVerticalWrap(WrapMode mode)
{
d->vertWrap = mode;
- if(d->texture) {
+ if (d->texture) {
GLint last;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mode);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, last);
}
}
@@ -293,10 +293,10 @@ GLTexture::FilterMode GLTexture::magFilter() const
void GLTexture::setMinFilter(FilterMode f)
{
- if(d->minFilter == f)
+ if (d->minFilter == f)
return;
d->minFilter = f;
- if(d->texture) {
+ if (d->texture) {
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, d->minFilter);
}
@@ -304,10 +304,10 @@ void GLTexture::setMinFilter(FilterMode f)
void GLTexture::setMagFilter(FilterMode f)
{
- if(d->magFilter == f)
+ if (d->magFilter == f)
return;
d->magFilter = f;
- if(d->texture) {
+ if (d->texture) {
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, d->magFilter);
}
diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp
index 1cfb3b5..80a558d 100644
--- a/src/declarative/qml/parser/javascriptlexer.cpp
+++ b/src/declarative/qml/parser/javascriptlexer.cpp
@@ -789,7 +789,7 @@ int JavaScript::Lexer::lex()
case Eof:
return 0;
case Other:
- if(token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON)
+ if (token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON)
delimited = true;
return token;
case Identifier:
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 2d8d83e..1c662a7 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -100,10 +100,10 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj)
// ### is this threadsafe?
static int idx = -1;
- if(idx == -1)
+ if (idx == -1)
idx = QmlMetaType::attachedPropertiesFuncId(&T::staticMetaObject);
- if(idx == -1 || !obj)
+ if (idx == -1 || !obj)
return 0;
return qmlAttachedPropertiesObjectById(obj, idx);
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp
index c2632da..b312b40 100644
--- a/src/declarative/qml/qmlbindablevalue.cpp
+++ b/src/declarative/qml/qmlbindablevalue.cpp
@@ -80,7 +80,7 @@ void QmlBindableValue::setTarget(const QmlMetaProperty &prop)
void QmlBindableValue::init()
{
- if(_inited)
+ if (_inited)
return;
_inited = true;
update();
@@ -98,30 +98,30 @@ void QmlBindableValue::update()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindableValueUpdate> bu;
#endif
- if(!_inited)
+ if (!_inited)
return;
- if(_property.propertyCategory() == QmlMetaProperty::List) {
+ if (_property.propertyCategory() == QmlMetaProperty::List) {
QVariant value = this->value();
int listType = QmlMetaType::listType(_property.propertyType());
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = _property.read();
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(value.type() == uint(listType) ||
+ } else if (value.type() == uint(listType) ||
value.userType() == listType) {
QVariant listVar = _property.read();
QmlMetaType::clear(listVar);
QmlMetaType::append(listVar, value);
}
- } else if(_property.propertyCategory() == QmlMetaProperty::QmlList) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::QmlList) {
// XXX - optimize!
QVariant value = this->value();
QVariant list = _property.read();
@@ -137,13 +137,13 @@ void QmlBindableValue::update()
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -153,7 +153,7 @@ void QmlBindableValue::update()
void *d = (void *)&obj;
li->append(d);
}
- } else if(_property.propertyCategory() == QmlMetaProperty::Bindable) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Bindable) {
// NOTE: We assume that only core properties can have
// propertyType == Bindable
@@ -166,12 +166,12 @@ void QmlBindableValue::update()
_property.object()->qt_metacall(QMetaObject::WriteProperty,
idx, a);
- } else if(_property.propertyCategory() == QmlMetaProperty::Object) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Object) {
QVariant value = this->value();
- if((int)value.type() != qMetaTypeId<QObject *>()) {
- if(scriptWarnings()) {
- if(!value.isValid()) {
+ if ((int)value.type() != qMetaTypeId<QObject *>()) {
+ if (scriptWarnings()) {
+ if (!value.isValid()) {
qWarning() << "QmlBindableValue: Unable to assign invalid value to object property";
} else {
qWarning() << "QmlBindableValue: Unable to assign non-object to object property";
@@ -194,7 +194,7 @@ void QmlBindableValue::update()
_property.object()->qt_metacall(QMetaObject::WriteProperty,
idx, a);
- } else if(_property.propertyCategory() == QmlMetaProperty::Normal) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Normal) {
QVariant value = this->value();
_property.write(value);
}
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp
index 5359753..67e3dcf 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qmlboundsignal.cpp
@@ -59,7 +59,7 @@ QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val, QObject *me
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
- if(evaluateIdx == -1) evaluateIdx = QmlExpressionObject::staticMetaObject.indexOfMethod("value()");
+ if (evaluateIdx == -1) evaluateIdx = QmlExpressionObject::staticMetaObject.indexOfMethod("value()");
setTrackChange(false);
QFx_setParent_noEvent(this, parent);
@@ -78,7 +78,7 @@ QmlBoundSignalProxy::QmlBoundSignalProxy(QmlContext *ctxt, const QString &val, Q
int QmlBoundSignalProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
{
- if(c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
+ if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
params->setValues(a);
value();
params->clearValues();
@@ -103,17 +103,17 @@ QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
QList<QByteArray> paramTypes = method.parameterTypes();
QList<QByteArray> paramNames = method.parameterNames();
types = new int[paramTypes.count()];
- for(int ii = 0; ii < paramTypes.count(); ++ii) {
+ for (int ii = 0; ii < paramTypes.count(); ++ii) {
const QByteArray &type = paramTypes.at(ii);
const QByteArray &name = paramNames.at(ii);
- if(name.isEmpty() || type.isEmpty()) {
+ if (name.isEmpty() || type.isEmpty()) {
types[ii] = 0;
continue;
}
QVariant::Type t = (QVariant::Type)QMetaType::type(type.constData());
- if(QmlMetaType::isObject(t)) {
+ if (QmlMetaType::isObject(t)) {
types[ii] = QMetaType::QObjectStar;
QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*");
prop.setWritable(false);
@@ -147,7 +147,7 @@ void QmlBoundSignalParameters::clearValues()
int QmlBoundSignalParameters::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(c == QMetaObject::ReadProperty && id >= 1) {
+ if (c == QMetaObject::ReadProperty && id >= 1) {
QmlMetaType::copy(types[id - 1], a[0], values[id]);
return -1;
} else {
diff --git a/src/declarative/qml/qmlcompiledcomponent.cpp b/src/declarative/qml/qmlcompiledcomponent.cpp
index a8b2be0..2c76f0c 100644
--- a/src/declarative/qml/qmlcompiledcomponent.cpp
+++ b/src/declarative/qml/qmlcompiledcomponent.cpp
@@ -56,21 +56,21 @@ QmlCompiledComponent::QmlCompiledComponent()
QmlCompiledComponent::~QmlCompiledComponent()
{
- for(int ii = 0; ii < mos.count(); ++ii)
+ for (int ii = 0; ii < mos.count(); ++ii)
qFree(mos.at(ii));
}
void QmlCompiledComponent::dumpInstructions()
{
- if(!compilerDump())
+ if (!compilerDump())
return;
- if(!name.isEmpty())
+ if (!name.isEmpty())
qWarning() << name;
qWarning() << "Index\tLine\tOperation\t\tData1\tData2\t\tComments";
qWarning() << "-------------------------------------------------------------------------------";
- for(int ii = 0; ii < bytecode.count(); ++ii) {
+ for (int ii = 0; ii < bytecode.count(); ++ii) {
dump(&bytecode[ii], ii);
}
qWarning() << "-------------------------------------------------------------------------------";
@@ -79,29 +79,29 @@ void QmlCompiledComponent::dumpInstructions()
void QmlCompiledComponent::dump(int indent, Property *p)
{
QByteArray ba(indent * 4, ' ');
- for(int ii = 0; ii < p->values.count(); ++ii)
+ for (int ii = 0; ii < p->values.count(); ++ii)
dump(indent, p->values.at(ii));
- if(p->value)
+ if (p->value)
dump(indent, p->value);
}
void QmlCompiledComponent::dump(int indent, Object *o)
{
QByteArray ba(indent * 4, ' ');
- if(o->type != -1) {
+ if (o->type != -1) {
qWarning() << ba.constData() << "Object:" << types.at(o->type).className;
} else {
qWarning() << ba.constData() << "Object: fetched";
}
- for(QHash<QByteArray, Property *>::ConstIterator iter = o->properties.begin();
+ for (QHash<QByteArray, Property *>::ConstIterator iter = o->properties.begin();
iter != o->properties.end();
++iter) {
qWarning() << ba.constData() << " Property" << iter.key();
dump(indent + 1, *iter);
}
- if(o->defaultProperty) {
+ if (o->defaultProperty) {
qWarning() << ba.constData() << " Default property";
dump(indent + 1, o->defaultProperty);
}
@@ -142,7 +142,7 @@ void QmlCompiledComponent::dump(int indent, Value *v)
};
QByteArray ba(indent * 4, ' ');
- if(v->object) {
+ if (v->object) {
qWarning() << ba.constData() << "Value (" << type << "):";
dump(indent + 1, v->object);
} else {
@@ -152,7 +152,7 @@ void QmlCompiledComponent::dump(int indent, Value *v)
void QmlCompiledComponent::dumpPre()
{
- if(!(dumpStatus & DumpPre)) {
+ if (!(dumpStatus & DumpPre)) {
dumpInstructions();
dumpStatus = (DumpStatus)(dumpStatus | DumpPre);
}
@@ -160,7 +160,7 @@ void QmlCompiledComponent::dumpPre()
void QmlCompiledComponent::dumpPost()
{
- if(!(dumpStatus & DumpPost)) {
+ if (!(dumpStatus & DumpPost)) {
dumpInstructions();
dumpStatus = (DumpStatus)(dumpStatus | DumpPost);
}
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index d55647c..fae0f43 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -80,7 +80,7 @@ using namespace QmlParser;
int QmlCompiledData::indexForString(const QString &data)
{
int idx = primitives.indexOf(data);
- if(idx == -1) {
+ if (idx == -1) {
idx = primitives.count();
primitives << data;
}
@@ -90,7 +90,7 @@ int QmlCompiledData::indexForString(const QString &data)
int QmlCompiledData::indexForByteArray(const QByteArray &data)
{
int idx = datas.indexOf(data);
- if(idx == -1) {
+ if (idx == -1) {
idx = datas.count();
datas << data;
}
@@ -101,21 +101,21 @@ int QmlCompiledData::indexForFloat(float *data, int count)
{
Q_ASSERT(count > 0);
- for(int ii = 0; ii < floatData.count() - count; ++ii) {
+ for (int ii = 0; ii < floatData.count() - count; ++ii) {
bool found = true;
- for(int jj = 0; jj < count; ++jj) {
- if(floatData.at(ii + jj) != data[jj]) {
+ for (int jj = 0; jj < count; ++jj) {
+ if (floatData.at(ii + jj) != data[jj]) {
found = false;
break;
}
}
- if(found)
+ if (found)
return ii;
}
int idx = floatData.count();
- for(int ii = 0; ii < count; ++ii)
+ for (int ii = 0; ii < count; ++ii)
floatData << data[ii];
return idx;
@@ -125,21 +125,21 @@ int QmlCompiledData::indexForInt(int *data, int count)
{
Q_ASSERT(count > 0);
- for(int ii = 0; ii < floatData.count() - count; ++ii) {
+ for (int ii = 0; ii < floatData.count() - count; ++ii) {
bool found = true;
- for(int jj = 0; jj < count; ++jj) {
- if(intData.at(ii + jj) != data[jj]) {
+ for (int jj = 0; jj < count; ++jj) {
+ if (intData.at(ii + jj) != data[jj]) {
found = false;
break;
}
}
- if(found)
+ if (found)
return ii;
}
int idx = intData.count();
- for(int ii = 0; ii < count; ++ii)
+ for (int ii = 0; ii < count; ++ii)
intData << data[ii];
return idx;
@@ -167,12 +167,12 @@ QString QmlCompiler::errorDescription() const
bool QmlCompiler::isValidId(const QString &val)
{
- if(val.isEmpty())
+ if (val.isEmpty())
return false;
QChar u(QLatin1Char('_'));
- for(int ii = 0; ii < val.count(); ++ii)
- if(val.at(ii) != u &&
+ for (int ii = 0; ii < val.count(); ++ii)
+ if (val.at(ii) != u &&
((ii == 0 && !val.at(ii).isLetter()) ||
(ii != 0 && !val.at(ii).isLetterOrNumber())) )
return false;
@@ -208,15 +208,15 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
int coreIdx, int primitive,
const QString *string)
{
- if(!prop.isWritable())
+ if (!prop.isWritable())
return ReadOnly;
- if(prop.isEnumType()) {
+ if (prop.isEnumType()) {
int value;
if (prop.isFlagType()) {
value = prop.enumerator().keysToValue(string->toLatin1().constData());
} else
value = prop.enumerator().keyToValue(string->toLatin1().constData());
- if(value == -1)
+ if (value == -1)
return InvalidData;
instr.type = QmlInstruction::StoreInteger;
instr.storeInteger.propertyIndex = coreIdx;
@@ -228,7 +228,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
case -1:
instr.type = QmlInstruction::StoreVariant;
instr.storeString.propertyIndex = coreIdx;
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
instr.storeString.value = primitive;
break;
@@ -237,11 +237,11 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
{
instr.type = QmlInstruction::StoreString;
instr.storeString.propertyIndex = coreIdx;
- if(string->startsWith(QLatin1Char('\'')) && string->endsWith(QLatin1Char('\''))) {
+ if (string->startsWith(QLatin1Char('\'')) && string->endsWith(QLatin1Char('\''))) {
QString unquotedString = string->mid(1, string->length() - 2);
primitive = cdata.indexForString(unquotedString);
} else {
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
}
instr.storeString.value = primitive;
@@ -395,7 +395,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
default:
{
int t = prop.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = prop.userType();
QmlMetaType::StringConverter converter =
QmlMetaType::customStringConverter(t);
@@ -406,7 +406,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
instr.assignCustomType.valueIndex = index;
QmlCompiledData::CustomTypeData data;
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
data.index = primitive;
data.type = t;
@@ -428,8 +428,8 @@ void QmlCompiler::reset(QmlCompiledComponent *cc, bool deleteMemory)
cc->intData.clear();
cc->customTypeData.clear();
cc->datas.clear();
- if(deleteMemory) {
- for(int ii = 0; ii < cc->mos.count(); ++ii)
+ if (deleteMemory) {
+ for (int ii = 0; ii < cc->mos.count(); ++ii)
qFree(cc->mos.at(ii));
}
cc->mos.clear();
@@ -464,23 +464,23 @@ bool QmlCompiler::compile(QmlEngine *engine,
output = out;
// Compile types
- for(int ii = 0; ii < unit->types.count(); ++ii) {
+ for (int ii = 0; ii < unit->types.count(); ++ii) {
QmlCompositeTypeData::TypeReference &tref = unit->types[ii];
QmlCompiledComponent::TypeReference ref;
- if(tref.type)
+ if (tref.type)
ref.type = tref.type;
- else if(tref.unit) {
+ else if (tref.unit) {
ref.component = tref.unit->toComponent(engine);
ref.ref = tref.unit;
ref.ref->addref();
- } else if(tref.parser)
+ } else if (tref.parser)
ref.parser = tref.parser;
ref.className = unit->data.types().at(ii).toLatin1();
out->types << ref;
}
Object *root = unit->data.tree();
- if(!root) {
+ if (!root) {
exceptionDescription = QLatin1String("Can't compile because of earlier errors");
output = 0;
return false;
@@ -488,7 +488,7 @@ bool QmlCompiler::compile(QmlEngine *engine,
compileTree(root);
- if(!isError()) {
+ if (!isError()) {
out->dumpPre();
} else {
reset(out, true);
@@ -506,7 +506,7 @@ void QmlCompiler::compileTree(Object *tree)
init.init.dataSize = 0;
output->bytecode << init;
- if(!compileObject(tree, 0)) // Compile failed
+ if (!compileObject(tree, 0)) // Compile failed
return;
QmlInstruction def;
@@ -519,12 +519,12 @@ void QmlCompiler::compileTree(Object *tree)
bool QmlCompiler::compileObject(Object *obj, int ctxt)
{
- if(obj->type != -1) {
+ if (obj->type != -1) {
obj->metatype =
QmlMetaType::metaObjectForType(output->types.at(obj->type).className);
}
- if(output->types.at(obj->type).className == "Component") {
+ if (output->types.at(obj->type).className == "Component") {
COMPILE_CHECK(compileComponent(obj, ctxt));
return true;
}
@@ -535,24 +535,24 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
// doesn't have already have them
bool ignoreProperties = false;
bool ignoreSignals = false;
- if(obj->metatype && obj->metatype->indexOfProperty(PROPERTIES_NAME) != -1)
+ if (obj->metatype && obj->metatype->indexOfProperty(PROPERTIES_NAME) != -1)
ignoreProperties = true;
- if(obj->metatype && obj->metatype->indexOfProperty(SIGNALS_NAME) != -1)
+ if (obj->metatype && obj->metatype->indexOfProperty(SIGNALS_NAME) != -1)
ignoreSignals = true;
Property *propertiesProperty = ignoreProperties?0:obj->getProperty(PROPERTIES_NAME, false);
Property *signalsProperty = ignoreSignals?0:obj->getProperty(SIGNALS_NAME, false);
- if(propertiesProperty) {
+ if (propertiesProperty) {
obj->dynamicPropertiesProperty = propertiesProperty;
obj->properties.remove(PROPERTIES_NAME);
}
- if(signalsProperty) {
+ if (signalsProperty) {
obj->dynamicSignalsProperty = signalsProperty;
obj->properties.remove(SIGNALS_NAME);
}
- if(obj->type != -1 && output->types.at(obj->type).parser) {
+ if (obj->type != -1 && output->types.at(obj->type).parser) {
QByteArray data = obj->custom;
int ref = output->indexForByteArray(data);
@@ -573,15 +573,15 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
COMPILE_CHECK(compileDynamicPropertiesAndSignals(obj));
- if(obj->type != -1) {
- if(output->types.at(obj->type).component) {
+ if (obj->type != -1) {
+ if (output->types.at(obj->type).component) {
QmlInstruction begin;
begin.type = QmlInstruction::TryBeginObject;
begin.line = obj->line;
output->bytecode << begin;
} else {
int cast = QmlMetaType::qmlParserStatusCast(QmlMetaType::type(output->types.at(obj->type).className));
- if(cast != -1) {
+ if (cast != -1) {
QmlInstruction begin;
begin.type = QmlInstruction::BeginObject;
begin.begin.castValue = cast;
@@ -592,9 +592,9 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
foreach(Property *prop, obj->properties) {
- if(!ignoreProperties && prop->name == PROPERTIES_NAME) {
- } else if(!ignoreSignals && prop->name == SIGNALS_NAME) {
- } else if(prop->name.length() >= 3 && prop->name.startsWith("on") &&
+ if (!ignoreProperties && prop->name == PROPERTIES_NAME) {
+ } else if (!ignoreSignals && prop->name == SIGNALS_NAME) {
+ } else if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
COMPILE_CHECK(compileSignal(prop, obj));
} else {
@@ -602,18 +602,18 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
}
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
- if(obj->type != -1) {
- if(output->types.at(obj->type).component) {
+ if (obj->type != -1) {
+ if (output->types.at(obj->type).component) {
QmlInstruction complete;
complete.type = QmlInstruction::TryCompleteObject;
complete.line = obj->line;
output->bytecode << complete;
} else {
int cast = QmlMetaType::qmlParserStatusCast(QmlMetaType::type(output->types.at(obj->type).className));
- if(cast != -1) {
+ if (cast != -1) {
QmlInstruction complete;
complete.type = QmlInstruction::CompleteObject;
complete.complete.castValue = cast;
@@ -629,30 +629,30 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
bool QmlCompiler::compileComponent(Object *obj, int ctxt)
{
Property *idProp = 0;
- if(obj->properties.count() > 1 ||
+ if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
COMPILE_EXCEPTION("Invalid component specification");
- if(obj->defaultProperty &&
+ if (obj->defaultProperty &&
(obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 ||
(obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object)))
COMPILE_EXCEPTION("Invalid component body specification");
- if(obj->properties.count())
+ if (obj->properties.count())
idProp = *obj->properties.begin();
- if(idProp && (idProp->value || idProp->values.count() > 1))
+ if (idProp && (idProp->value || idProp->values.count() > 1))
COMPILE_EXCEPTION("Invalid component id specification");
Object *root = 0;
- if(obj->defaultProperty && obj->defaultProperty->values.count())
+ if (obj->defaultProperty && obj->defaultProperty->values.count())
root = obj->defaultProperty->values.first()->object;
COMPILE_CHECK(compileComponentFromRoot(root, ctxt));
- if(idProp && idProp->values.count()) {
+ if (idProp && idProp->values.count()) {
QString val = idProp->values.at(0)->primitive;
- if(!isValidId(val))
+ if (!isValidId(val))
COMPILE_EXCEPTION("Invalid id property value");
- if(ids.contains(val))
+ if (ids.contains(val))
COMPILE_EXCEPTION("id is not unique");
ids.insert(val);
@@ -684,7 +684,7 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt)
QSet<QString> oldIds = ids;
ids.clear();
- if(obj)
+ if (obj)
COMPILE_CHECK(compileObject(obj, ctxt));
ids = oldIds;
@@ -698,11 +698,11 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt)
bool QmlCompiler::compileFetchedObject(Object *obj, int ctxt)
{
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
foreach(Property *prop, obj->properties) {
- if(prop->name.length() >= 3 && prop->name.startsWith("on") &&
+ if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
COMPILE_CHECK(compileSignal(prop, obj));
} else {
@@ -715,18 +715,18 @@ bool QmlCompiler::compileFetchedObject(Object *obj, int ctxt)
bool QmlCompiler::compileSignal(Property *prop, Object *obj)
{
- if(prop->values.isEmpty() && !prop->value)
+ if (prop->values.isEmpty() && !prop->value)
return true;
- if(prop->value || prop->values.count() > 1)
+ if (prop->value || prop->values.count() > 1)
COMPILE_EXCEPTION("Incorrectly specified signal");
- if(prop->values.at(0)->object) {
+ if (prop->values.at(0)->object) {
int pr = output->indexForByteArray(prop->name);
bool rv = compileObject(prop->values.at(0)->object, 0);
- if(rv) {
+ if (rv) {
QmlInstruction assign;
assign.type = QmlInstruction::AssignSignalObject;
assign.line = prop->values.at(0)->line;
@@ -741,10 +741,10 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
} else {
QString script = prop->values.at(0)->primitive.trimmed();
- if(script.isEmpty())
+ if (script.isEmpty())
return true;
- if(isBinding(script))
+ if (isBinding(script))
COMPILE_EXCEPTION("Cannot assign binding to signal property");
int idx = output->indexForString(script);
@@ -766,25 +766,25 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
{
- if(prop->values.isEmpty() && !prop->value)
+ if (prop->values.isEmpty() && !prop->value)
return true;
// First we're going to need a reference to this property
- if(obj->type != -1) {
+ if (obj->type != -1) {
const QMetaObject *mo = obj->metaObject();
- if(mo) {
- if(prop->isDefault) {
+ if (mo) {
+ if (prop->isDefault) {
QMetaProperty p = QmlMetaType::defaultProperty(mo);
// XXX
// Currently we don't handle enums in the static analysis
// so we let them drop through to generateStoreInstruction()
- if(p.name() && !p.isEnumType()) {
+ if (p.name() && !p.isEnumType()) {
prop->index = mo->indexOfProperty(p.name());
prop->name = p.name();
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
@@ -795,9 +795,9 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
// XXX
// Currently we don't handle enums in the static analysis
// so we let them drop through to generateStoreInstruction()
- if(p.name() && !p.isEnumType()) {
+ if (p.name() && !p.isEnumType()) {
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
@@ -806,41 +806,41 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
}
} else {
const QMetaObject *mo = obj->metaObject();
- if(mo) {
- if(prop->isDefault) {
+ if (mo) {
+ if (prop->isDefault) {
QMetaProperty p = QmlMetaType::defaultProperty(mo);
- if(p.name()) {
+ if (p.name()) {
prop->index = mo->indexOfProperty(p.name());
prop->name = p.name();
}
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
} else {
prop->index = mo->indexOfProperty(prop->name.constData());
QMetaProperty p = mo->property(prop->index);
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
}
}
}
- if(prop->name == "id") {
+ if (prop->name == "id") {
COMPILE_CHECK(compileIdProperty(prop, obj));
- } else if(isAttachedProperty(prop->name)) {
+ } else if (isAttachedProperty(prop->name)) {
COMPILE_CHECK(compileAttachedProperty(prop, obj, ctxt));
- } else if(prop->value) {
+ } else if (prop->value) {
COMPILE_CHECK(compileNestedProperty(prop, ctxt));
- } else if(QmlMetaType::isQmlList(prop->type) ||
+ } else if (QmlMetaType::isQmlList(prop->type) ||
QmlMetaType::isList(prop->type)) {
COMPILE_CHECK(compileListProperty(prop, obj, ctxt));
@@ -857,24 +857,24 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
bool QmlCompiler::compileIdProperty(QmlParser::Property *prop,
QmlParser::Object *obj)
{
- if(prop->value)
+ if (prop->value)
COMPILE_EXCEPTION("The 'id' property cannot be fetched");
- if(prop->values.count() > 1)
+ if (prop->values.count() > 1)
COMPILE_EXCEPTION("The 'id' property cannot be multiset");
- if(prop->values.count() == 1) {
- if(prop->values.at(0)->object)
+ if (prop->values.count() == 1) {
+ if (prop->values.at(0)->object)
COMPILE_EXCEPTION("Cannot assign an object as an id");
QString val = prop->values.at(0)->primitive;
- if(!isValidId(val))
+ if (!isValidId(val))
COMPILE_EXCEPTION(val << "is not a valid id");
- if(ids.contains(val))
+ if (ids.contains(val))
COMPILE_EXCEPTION("id is not unique");
ids.insert(val);
int pref = output->indexForString(val);
- if(prop->type == QVariant::String) {
+ if (prop->type == QVariant::String) {
QmlInstruction assign;
assign.type = QmlInstruction::StoreString;
assign.storeString.propertyIndex = prop->index;
@@ -905,14 +905,14 @@ bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop,
QmlParser::Object *obj,
int ctxt)
{
- if(!prop->value)
+ if (!prop->value)
COMPILE_EXCEPTION("Incorrect usage of an attached property");
QmlInstruction fetch;
fetch.type = QmlInstruction::FetchAttached;
fetch.line = prop->line;
int id = QmlMetaType::attachedPropertiesFuncId(prop->name);
- if(id == -1)
+ if (id == -1)
COMPILE_EXCEPTION("Non-existant attached property object" << prop->name);
fetch.fetchAttached.id = id;
output->bytecode << fetch;
@@ -930,11 +930,11 @@ bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop,
bool QmlCompiler::compileNestedProperty(QmlParser::Property *prop,
int ctxt)
{
- if(prop->type != 0)
+ if (prop->type != 0)
prop->value->metatype = QmlMetaType::metaObjectForType(prop->type);
QmlInstruction fetch;
- if(prop->index != -1 &&
+ if (prop->index != -1 &&
QmlMetaType::isObject(prop->value->metatype)) {
fetch.type = QmlInstruction::FetchObject;
fetch.fetch.property = prop->index;
@@ -961,7 +961,7 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
int ctxt)
{
int t = prop->type;
- if(QmlMetaType::isQmlList(t)) {
+ if (QmlMetaType::isQmlList(t)) {
QmlInstruction fetch;
fetch.line = prop->line;
fetch.type = QmlInstruction::FetchQmlList;
@@ -969,9 +969,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
fetch.fetchQmlList.type = QmlMetaType::qmlListType(t);
output->bytecode << fetch;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
v->type = Value::CreatedObject;
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -999,9 +999,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
output->bytecode << fetch;
bool assignedBinding = false;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
v->type = Value::CreatedObject;
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -1010,8 +1010,8 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
assign.assignObject.property = output->indexForByteArray(prop->name);
assign.assignObject.castValue = 0;
output->bytecode << assign;
- } else if(isBinding(v->primitive)) {
- if(assignedBinding)
+ } else if (isBinding(v->primitive)) {
+ if (assignedBinding)
COMPILE_EXCEPTION("Can only assign one binding to lists");
compileBinding(v->primitive, prop, ctxt, obj->metaObject(), v->line);
@@ -1033,9 +1033,9 @@ bool QmlCompiler::compilePropertyAssignment(QmlParser::Property *prop,
QmlParser::Object *obj,
int ctxt)
{
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
COMPILE_CHECK(compilePropertyObjectAssignment(prop, obj, v, ctxt));
@@ -1054,10 +1054,10 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
QmlParser::Value *v,
int ctxt)
{
- if(v->object->type != -1)
+ if (v->object->type != -1)
v->object->metatype = QmlMetaType::metaObjectForType(output->types.at(v->object->type).className);
- if(v->object->metaObject()) {
+ if (v->object->metaObject()) {
const QMetaObject *propmo =
QmlMetaType::rawMetaObjectForType(prop->type);
@@ -1065,7 +1065,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
bool isPropertyValue = false;
bool isAssignable = false;
- if(propmo) {
+ if (propmo) {
// We want to raw metaObject here as the raw metaobject is the
// actual property type before we applied any extensions
const QMetaObject *c = v->object->metatype;
@@ -1082,14 +1082,14 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
}
}
- if(!propmo && !isPropertyValue) {
+ if (!propmo && !isPropertyValue) {
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
assign.type = QmlInstruction::AssignObject;
assign.line = v->object->line;
assign.assignObject.castValue = 0;
- if(prop->isDefault)
+ if (prop->isDefault)
assign.assignObject.property = -1;
else
assign.assignObject.property =
@@ -1097,7 +1097,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::CreatedObject;
- } else if(isAssignable) {
+ } else if (isAssignable) {
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -1109,7 +1109,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::CreatedObject;
- } else if(propmo == &QmlComponent::staticMetaObject) {
+ } else if (propmo == &QmlComponent::staticMetaObject) {
COMPILE_CHECK(compileComponentFromRoot(v->object, ctxt));
@@ -1122,7 +1122,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::Component;
- } else if(isPropertyValue) {
+ } else if (isPropertyValue) {
COMPILE_CHECK(compileObject(v->object, ctxt));
if (prop->index != -1) {
@@ -1165,7 +1165,7 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
QmlParser::Value *v,
int ctxt)
{
- if(isBinding(v->primitive)) {
+ if (isBinding(v->primitive)) {
compileBinding(v->primitive, prop, ctxt, obj->metaObject(), v->line);
@@ -1177,28 +1177,28 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
assign.line = v->line;
bool doassign = true;
- if(prop->index != -1) {
+ if (prop->index != -1) {
StoreInstructionResult r =
generateStoreInstruction(*output, assign, obj->metaObject()->property(prop->index), prop->index, -1, &v->primitive);
- if(r == Ok) {
+ if (r == Ok) {
doassign = false;
- } else if(r == InvalidData) {
+ } else if (r == InvalidData) {
//### we are restricted to a rather generic message here. If we can find a way to move
// the exception into generateStoreInstruction we could potentially have better messages.
// (the problem is that both compile and run exceptions can be generated, though)
COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to property" << obj->metaObject()->property(prop->index).name());
doassign = false;
- } else if(r == ReadOnly) {
+ } else if (r == ReadOnly) {
COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to the read-only property" << obj->metaObject()->property(prop->index).name());
} else {
doassign = true;
}
}
- if(doassign) {
+ if (doassign) {
assign.type = QmlInstruction::AssignConstant;
- if(prop->isDefault) {
+ if (prop->isDefault) {
assign.assignConstant.property = -1;
} else {
assign.assignConstant.property =
@@ -1238,17 +1238,17 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
sizeof(propTypeNameToTypes[0]);
- if(prop->value)
+ if (prop->value)
COMPILE_EXCEPTION("Invalid property specification");
bool seenDefault = false;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
QmlParser::Value *val = prop->values.at(ii);
- if(!val->object)
+ if (!val->object)
COMPILE_EXCEPTION("Invalid property specification");
QmlParser::Object *obj = val->object;
- if(obj->type == -1 || output->types.at(obj->type).className != "Property")
+ if (obj->type == -1 || output->types.at(obj->type).className != "Property")
COMPILE_EXCEPTION("Use Property tag to specify properties");
@@ -1259,75 +1259,75 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
Object::DynamicProperty propDef;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
obj->properties.begin();
iter != obj->properties.end();
++iter) {
QmlParser::Property *property = *iter;
- if(property->name == "name") {
+ if (property->name == "name") {
if (seen & Name)
COMPILE_EXCEPTION("May only specify Property name once");
seen = (Seen)(seen | Name);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property name");
propDef.name = property->values.at(0)->primitive.toLatin1();
- } else if(property->name == "type") {
+ } else if (property->name == "type") {
if (seen & Type)
COMPILE_EXCEPTION("May only specify Property type once");
seen = (Seen)(seen | Type);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property type");
QString type = property->values.at(0)->primitive.toLower();
bool found = false;
- for(int ii = 0; !found && ii < propTypeNameToTypesCount; ++ii) {
- if(type == QLatin1String(propTypeNameToTypes[ii].name)){
+ for (int ii = 0; !found && ii < propTypeNameToTypesCount; ++ii) {
+ if (type == QLatin1String(propTypeNameToTypes[ii].name)){
found = true;
propDef.type = propTypeNameToTypes[ii].type;
}
}
- if(!found)
+ if (!found)
COMPILE_EXCEPTION("Invalid Property type");
- } else if(property->name == "value") {
+ } else if (property->name == "value") {
if (seen & Value)
COMPILE_EXCEPTION("May only specify Property value once");
seen = (Seen)(seen | Value);
propDef.defaultValue = property;
- } else if(property->name == "onValueChanged") {
+ } else if (property->name == "onValueChanged") {
if (seen & ValueChanged)
COMPILE_EXCEPTION("May only specify Property onValueChanged once");
seen = (Seen)(seen | ValueChanged);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property onValueChanged");
propDef.onValueChanged = property->values.at(0)->primitive;
- } else if(property->name == "default") {
- if(seen & Default)
+ } else if (property->name == "default") {
+ if (seen & Default)
COMPILE_EXCEPTION("May only specify Property default once");
seen = (Seen)(seen | Default);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property default");
bool defaultValue =
QmlStringConverters::boolFromString(property->values.at(0)->primitive);
propDef.isDefaultProperty = defaultValue;
- if(defaultValue) {
- if(seenDefault)
+ if (defaultValue) {
+ if (seenDefault)
COMPILE_EXCEPTION("Only one property may be the default");
seenDefault = true;
}
@@ -1337,15 +1337,15 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
}
}
- if(obj->defaultProperty) {
- if(seen & Value)
+ if (obj->defaultProperty) {
+ if (seen & Value)
COMPILE_EXCEPTION("May only specify Property value once");
seen = (Seen)(seen | Value);
propDef.defaultValue = obj->defaultProperty;
}
- if(!(seen & Name))
+ if (!(seen & Name))
COMPILE_EXCEPTION("Must specify Property name");
definedProperties << propDef;
@@ -1360,33 +1360,33 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
{
QList<Object::DynamicSignal> definedSignals;
- if(sigs->value)
+ if (sigs->value)
COMPILE_EXCEPTION("Invalid signal specification");
- for(int ii = 0; ii < sigs->values.count(); ++ii) {
+ for (int ii = 0; ii < sigs->values.count(); ++ii) {
QmlParser::Value *val = sigs->values.at(ii);
- if(!val->object)
+ if (!val->object)
COMPILE_EXCEPTION("Invalid signal specification");
QmlParser::Object *obj = val->object;
- if(obj->type == -1 || output->types.at(obj->type).className != "Signal")
+ if (obj->type == -1 || output->types.at(obj->type).className != "Signal")
COMPILE_EXCEPTION("Use Signal tag to specify signals");
enum Seen { None = 0, Name = 0x01 } seen = None;
Object::DynamicSignal sigDef;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
obj->properties.begin();
iter != obj->properties.end();
++iter) {
QmlParser::Property *property = *iter;
- if(property->name == "name") {
+ if (property->name == "name") {
if (seen & Name)
COMPILE_EXCEPTION("May only specify Signal name once");
seen = (Seen)(seen | Name);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Signal name");
@@ -1398,10 +1398,10 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
}
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_EXCEPTION("Invalid Signal property");
- if(!(seen & Name))
+ if (!(seen & Name))
COMPILE_EXCEPTION("Must specify Signal name");
definedSignals << sigDef;
@@ -1413,23 +1413,23 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
{
- if(obj->dynamicPropertiesProperty)
+ if (obj->dynamicPropertiesProperty)
findDynamicProperties(obj->dynamicPropertiesProperty, obj);
- if(obj->dynamicSignalsProperty)
+ if (obj->dynamicSignalsProperty)
findDynamicSignals(obj->dynamicSignalsProperty, obj);
- if(obj->dynamicProperties.isEmpty() && obj->dynamicSignals.isEmpty())
+ if (obj->dynamicProperties.isEmpty() && obj->dynamicSignals.isEmpty())
return true;
QMetaObjectBuilder builder;
- if(obj->metatype)
+ if (obj->metatype)
builder.setClassName(QByteArray(obj->metatype->className()) + "QML");
builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
- for(int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
- if(p.isDefaultProperty)
+ if (p.isDefaultProperty)
builder.addClassInfo("DefaultProperty", p.name);
QByteArray type;
@@ -1461,12 +1461,12 @@ bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
builder.addProperty(p.name, type, ii);
}
- for(int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
const Object::DynamicSignal &s = obj->dynamicSignals.at(ii);
builder.addSignal(s.name + "()");
}
- if(obj->metatype)
+ if (obj->metatype)
builder.setSuperClass(obj->metatype);
obj->extObject = builder.toMetaObject();
@@ -1478,16 +1478,16 @@ bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
store.line = obj->line;
output->bytecode << store;
- for(int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
- if(p.defaultValue) {
+ if (p.defaultValue) {
p.defaultValue->name = p.name;
p.defaultValue->isDefault = false;
COMPILE_CHECK(compileProperty(p.defaultValue, obj, 0));
}
- if(!p.onValueChanged.isEmpty()) {
+ if (!p.onValueChanged.isEmpty()) {
QmlInstruction assign;
assign.type = QmlInstruction::AssignSignal;
assign.line = obj->line;
@@ -1512,7 +1512,7 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
bs.compile(bind.toLatin1());
int bref;
- if(bs.isValid()) {
+ if (bs.isValid()) {
bref = output->indexForByteArray(QByteArray(bs.compileData(), bs.compileDataSize()));
} else {
bref = output->indexForString(bind);
@@ -1521,8 +1521,8 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
QmlInstruction assign;
assign.assignBinding.context = ctxt;
assign.line = line;
- if(prop->index != -1) {
- if(bs.isValid())
+ if (prop->index != -1) {
+ if (bs.isValid())
assign.type = QmlInstruction::StoreCompiledBinding;
else
assign.type = QmlInstruction::StoreBinding;
@@ -1530,13 +1530,13 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
assign.assignBinding.property = prop->index;
assign.assignBinding.value = bref;
assign.assignBinding.category = QmlMetaProperty::Unknown;
- if(mo) {
+ if (mo) {
//XXX we should generate an exception if the property is read-only
QMetaProperty mp = mo->property(assign.assignBinding.property);
assign.assignBinding.category = QmlMetaProperty::propertyCategory(mp);
}
} else {
- if(bs.isValid())
+ if (bs.isValid())
assign.type = QmlInstruction::AssignCompiledBinding;
else
assign.type = QmlInstruction::AssignBinding;
@@ -1553,42 +1553,42 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
int saveCount = 0;
int newInstrs = 0;
- for(int ii = start; ii <= end; ++ii) {
+ for (int ii = start; ii <= end; ++ii) {
const QmlInstruction &instr = output->bytecode.at(ii);
- if(instr.type == QmlInstruction::CreateComponent) {
+ if (instr.type == QmlInstruction::CreateComponent) {
ii += instr.createComponent.count - 1;
continue;
}
- if(instr.type == QmlInstruction::SetId) {
+ if (instr.type == QmlInstruction::SetId) {
QString id = output->primitives.at(instr.setId.value);
ids.insert(id, ii);
}
}
- for(int ii = start; ii <= end; ++ii) {
+ for (int ii = start; ii <= end; ++ii) {
const QmlInstruction &instr = output->bytecode.at(ii);
- if(instr.type == QmlInstruction::CreateComponent) {
+ if (instr.type == QmlInstruction::CreateComponent) {
ii += instr.createComponent.count - 1;
continue;
}
- if(instr.type == QmlInstruction::StoreCompiledBinding) {
+ if (instr.type == QmlInstruction::StoreCompiledBinding) {
QmlBasicScript s(output->datas.at(instr.assignBinding.value).constData());
- if(s.isSingleLoad()) {
+ if (s.isSingleLoad()) {
QString slt = QLatin1String(s.singleLoadTarget());
- if(!slt.at(0).isUpper())
+ if (!slt.at(0).isUpper())
continue;
- if(ids.contains(slt) &&
+ if (ids.contains(slt) &&
instr.assignBinding.category == QmlMetaProperty::Object) {
int id = ids[slt];
int saveId = -1;
- if(output->bytecode.at(id).setId.save != -1) {
+ if (output->bytecode.at(id).setId.save != -1) {
saveId = output->bytecode.at(id).setId.save;
} else {
output->bytecode[id].setId.save = saveCount;
@@ -1615,7 +1615,7 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
}
- if(saveCount)
+ if (saveCount)
output->bytecode[patch].init.dataSize = saveCount;
return newInstrs;
@@ -1632,8 +1632,8 @@ QmlCompiledData::QmlCompiledData(const QmlCompiledData &other)
QmlCompiledData::~QmlCompiledData()
{
- for(int ii = 0; ii < types.count(); ++ii) {
- if(types.at(ii).ref)
+ for (int ii = 0; ii < types.count(); ++ii) {
+ if (types.at(ii).ref)
types.at(ii).ref->release();
}
}
@@ -1653,12 +1653,12 @@ QmlCompiledData &QmlCompiledData::operator=(const QmlCompiledData &other)
QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt) const
{
- if(type) {
+ if (type) {
QObject *rv = type->create();
- if(rv)
+ if (rv)
QmlEngine::setContextForObject(rv, ctxt);
return rv;
- } else if(component) {
+ } else if (component) {
return component->create(ctxt);
} else {
return 0;
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 92f6b28..2c3ebd6 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -130,7 +130,7 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
url = QUrl(data->url);
QmlCompiledComponent *c = data->toCompiledComponent(engine);
- if(!c) {
+ if (!c) {
Q_ASSERT(data->status == QmlCompositeTypeData::Error);
errorDescription = data->errorDescription;
@@ -148,13 +148,13 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
void QmlComponentPrivate::clear()
{
- if(typeData) {
+ if (typeData) {
typeData->remWaiter(this);
typeData->release();
typeData = 0;
}
- if(cc) {
+ if (cc) {
cc->release();
cc = 0;
}
@@ -186,11 +186,11 @@ QmlComponent::Status QmlComponent::status() const
{
Q_D(const QmlComponent);
- if(d->typeData)
+ if (d->typeData)
return Loading;
- else if(d->engine && d->cc)
+ else if (d->engine && d->cc)
return Ready;
- else if(!d->errorDescription.isEmpty())
+ else if (!d->errorDescription.isEmpty())
return Error;
else
return Null;
@@ -307,7 +307,7 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url)
QmlCompositeTypeData *typeData =
d->engine->d_func()->typeManager.getImmediate(data, url);
- if(typeData->status == QmlCompositeTypeData::Waiting) {
+ if (typeData->status == QmlCompositeTypeData::Waiting) {
d->typeData = typeData;
d->typeData->addWaiter(d);
@@ -335,7 +335,7 @@ void QmlComponent::loadUrl(const QUrl &url)
QmlCompositeTypeData *data =
d->engine->d_func()->typeManager.get(url);
- if(data->status == QmlCompositeTypeData::Waiting) {
+ if (data->status == QmlCompositeTypeData::Waiting) {
d->typeData = data;
d->typeData->addWaiter(d);
@@ -352,7 +352,7 @@ void QmlComponent::loadUrl(const QUrl &url)
QString QmlComponent::errorDescription() const
{
Q_D(const QmlComponent);
- if(isError())
+ if (isError())
return d->errorDescription;
else
return QString();
@@ -388,10 +388,10 @@ QObject *QmlComponent::create(QmlContext *context)
{
Q_D(QmlComponent);
- if(!context)
+ if (!context)
context = d->engine->rootContext();
- if(context->engine() != d->engine) {
+ if (context->engine() != d->engine) {
qWarning("QmlComponent::create(): Must create component in context from the same QmlEngine");
return 0;
}
@@ -428,12 +428,12 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
{
Q_D(QmlComponent);
- if(!context) {
+ if (!context) {
qWarning("QmlComponent::beginCreate(): Cannot create a component in a null context");
return 0;
}
- if(context->engine() != d->engine) {
+ if (context->engine() != d->engine) {
qWarning("QmlComponent::beginCreate(): Must create component in context from the same QmlEngine");
return 0;
}
@@ -443,7 +443,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
return 0;
}
- if(!isReady()) {
+ if (!isReady()) {
qWarning("QmlComponent: Cannot create un-ready component");
return 0;
}
@@ -451,7 +451,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::CreateComponent> perf;
#endif
- if(!d->engine->d_func()->rootComponent)
+ if (!d->engine->d_func()->rootComponent)
d->engine->d_func()->rootComponent = this;
QmlContext *ctxt =
@@ -462,7 +462,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
QmlVME vme;
QObject *rv = vme.run(ctxt, d->cc, d->start, d->count);
- if(vme.isError()) {
+ if (vme.isError()) {
qWarning().nospace()
#ifdef QML_VERBOSEERRORS_ENABLED
<< "QmlComponent: "
@@ -474,10 +474,10 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
ctxt->deactivate();
- if(rv) {
+ if (rv) {
QFx_setParent_noEvent(ctxt, rv);
QmlEnginePrivate *ep = d->engine->d_func();
- if(ep->rootComponent == this) {
+ if (ep->rootComponent == this) {
ep->rootComponent = 0;
d->bindValues = ep->currentBindValues;
@@ -508,13 +508,13 @@ void QmlComponent::completeCreate()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindInit> bi;
#endif
- for(int ii = 0; ii < d->bindValues.count(); ++ii)
+ for (int ii = 0; ii < d->bindValues.count(); ++ii)
d->bindValues.at(ii)->init();
}
QSet<QmlParserStatus *> done;
- for(int ii = 0; ii < d->parserStatus.count(); ++ii) {
+ for (int ii = 0; ii < d->parserStatus.count(); ++ii) {
QmlParserStatus *ps = d->parserStatus.at(ii);
- if(!done.contains(ps)) {
+ if (!done.contains(ps)) {
done.insert(ps);
ps->componentComplete();
}
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index b05a6fa..7f2cc58 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -57,13 +57,13 @@ QmlCompositeTypeData::QmlCompositeTypeData()
QmlCompositeTypeData::~QmlCompositeTypeData()
{
- for(int ii = 0; ii < dependants.count(); ++ii)
+ for (int ii = 0; ii < dependants.count(); ++ii)
dependants.at(ii)->release();
- if(compiledComponent)
+ if (compiledComponent)
compiledComponent->release();
- if(component)
+ if (component)
delete component;
}
@@ -79,10 +79,10 @@ void QmlCompositeTypeData::remWaiter(QmlComponentPrivate *p)
QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
{
- if(!component) {
+ if (!component) {
QmlCompiledComponent *cc = toCompiledComponent(engine);
- if(cc) {
+ if (cc) {
component = new QmlComponent(engine, cc, -1, -1, 0);
} else {
component = new QmlComponent(engine, 0);
@@ -96,14 +96,14 @@ QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
QmlCompiledComponent *
QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
{
- if(status == Complete && !compiledComponent) {
+ if (status == Complete && !compiledComponent) {
compiledComponent = new QmlCompiledComponent;
compiledComponent->url = QUrl(url);
compiledComponent->name = url.toLatin1(); // ###
QmlCompiler compiler;
- if(!compiler.compile(engine, this, compiledComponent)) {
+ if (!compiler.compile(engine, this, compiledComponent)) {
status = Error;
errorDescription = compiler.errorDescription() +
QLatin1String("@") +
@@ -117,7 +117,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
data.clear();
}
- if(compiledComponent)
+ if (compiledComponent)
compiledComponent->addref();
return compiledComponent;
@@ -137,7 +137,7 @@ QmlCompositeTypeData *QmlCompositeTypeManager::get(const QUrl &url)
{
QmlCompositeTypeData *unit = components.value(url.toString());
- if(!unit) {
+ if (!unit) {
unit = new QmlCompositeTypeData;
unit->status = QmlCompositeTypeData::Waiting;
unit->url = url.toString();
@@ -162,8 +162,8 @@ QmlCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url)
void QmlCompositeTypeManager::clearCache()
{
- for(Components::Iterator iter = components.begin(); iter != components.end();) {
- if((*iter)->status != QmlCompositeTypeData::Waiting) {
+ for (Components::Iterator iter = components.begin(); iter != components.end();) {
+ if ((*iter)->status != QmlCompositeTypeData::Waiting) {
(*iter)->release();
iter = components.erase(iter);
} else {
@@ -180,7 +180,7 @@ void QmlCompositeTypeManager::replyFinished()
QmlCompositeTypeData *unit = components.value(reply->url().toString());
Q_ASSERT(unit);
- if(reply->error() != QNetworkReply::NoError) {
+ if (reply->error() != QNetworkReply::NoError) {
QString errorDescription;
// ### - Fill in error
@@ -204,10 +204,10 @@ void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
{
QUrl url(unit->url);
- if(url.scheme() == QLatin1String("file")) {
+ if (url.scheme() == QLatin1String("file")) {
QFile file(url.toLocalFile());
- if(file.open(QFile::ReadOnly)) {
+ if (file.open(QFile::ReadOnly)) {
QByteArray data = file.readAll();
setData(unit, data, url);
} else {
@@ -231,7 +231,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
const QByteArray &data,
const QUrl &url)
{
- if(!unit->data.parse(data, url)) {
+ if (!unit->data.parse(data, url)) {
unit->status = QmlCompositeTypeData::Error;
unit->errorDescription = unit->data.errorDescription();
@@ -247,7 +247,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
{
- for(int ii = 0; ii < unit->dependants.count(); ++ii) {
+ for (int ii = 0; ii < unit->dependants.count(); ++ii) {
checkComplete(unit->dependants.at(ii));
unit->dependants.at(ii)->release();
}
@@ -261,26 +261,26 @@ void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit)
{
- if(unit->status != QmlCompositeTypeData::Waiting)
+ if (unit->status != QmlCompositeTypeData::Waiting)
return;
int waiting = 0;
- for(int ii = 0; ii < unit->types.count(); ++ii) {
+ for (int ii = 0; ii < unit->types.count(); ++ii) {
QmlCompositeTypeData *u = unit->types.at(ii).unit;
- if(!u)
+ if (!u)
continue;
- if(u->status == QmlCompositeTypeData::Error) {
+ if (u->status == QmlCompositeTypeData::Error) {
unit->status = QmlCompositeTypeData::Error;
unit->errorDescription = u->errorDescription;
doComplete(unit);
return;
- } else if(u->status == QmlCompositeTypeData::Waiting) {
+ } else if (u->status == QmlCompositeTypeData::Waiting) {
waiting++;
}
}
- if(!waiting) {
+ if (!waiting) {
unit->status = QmlCompositeTypeData::Complete;
doComplete(unit);
}
@@ -291,7 +291,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QStringList typeNames = unit->data.types();
int waiting = 0;
- for(int ii = 0; ii < typeNames.count(); ++ii) {
+ for (int ii = 0; ii < typeNames.count(); ++ii) {
QByteArray type = typeNames.at(ii).toLatin1();
QmlCompositeTypeData::TypeReference ref;
@@ -304,14 +304,14 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QmlCustomParser *parser =
QmlMetaType::customParser(type);
- if(parser) {
+ if (parser) {
ref.parser = parser;
unit->types << ref;
continue;
}
ref.type = QmlMetaType::qmlType(type);
- if(ref.type) {
+ if (ref.type) {
ref.parser = parser;
unit->types << ref;
continue;
@@ -320,7 +320,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url));
QmlCompositeTypeData *urlUnit = components.value(url.toString());
- if(!urlUnit) {
+ if (!urlUnit) {
urlUnit = new QmlCompositeTypeData;
urlUnit->status = QmlCompositeTypeData::Waiting;
urlUnit->url = url.toString();
@@ -351,7 +351,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
unit->types << ref;
}
- if(waiting) {
+ if (waiting) {
unit->status = QmlCompositeTypeData::Waiting;
} else {
unit->status = QmlCompositeTypeData::Complete;
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index 40e33c2..c1acdc7 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -68,16 +68,16 @@ void QmlContextPrivate::dump(int depth)
QByteArray ba(depth * 4, ' ');
qWarning() << ba << properties.keys();
qWarning() << ba << variantProperties.keys();
- if(parent)
+ if (parent)
parent->d_func()->dump(depth + 1);
}
void QmlContextPrivate::destroyed(QObject *obj)
{
defaultObjects.removeAll(obj);
- for(QHash<QString, QObject *>::Iterator iter = properties.begin();
+ for (QHash<QString, QObject *>::Iterator iter = properties.begin();
iter != properties.end(); ) {
- if(*iter == obj)
+ if (*iter == obj)
iter = properties.erase(iter);
else
++iter;
@@ -102,13 +102,13 @@ void QmlContextPrivate::init()
void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority)
{
- if(defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
+ if (defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
qWarning("QmlContext: Cannot have more than %d default objects on "
"one bind context.", MAXIMUM_DEFAULT_OBJECTS - 1);
return;
}
- if(priority == HighPriority) {
+ if (priority == HighPriority) {
defaultObjects.insert(highPriorityCount++, object);
} else {
defaultObjects.append(object);
@@ -233,7 +233,7 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent)
QmlContext::~QmlContext()
{
Q_D(QmlContext);
- if(d->component) d->component->release();
+ if (d->component) d->component->release();
}
@@ -313,7 +313,7 @@ void QmlContext::deactivate()
QmlEnginePrivate *ep = engine()->d_func();
Q_ASSERT(ep->activeContexts.top() == this);
ep->activeContexts.pop();
- if(ep->activeContexts.isEmpty())
+ if (ep->activeContexts.isEmpty())
ep->setCurrentBindContext(0);
else
ep->setCurrentBindContext(ep->activeContexts.top());
@@ -332,7 +332,7 @@ void QmlContext::deactivate()
QmlContext *QmlContext::activeContext()
{
QmlEngine *engine = QmlEngine::activeEngine();
- if(engine)
+ if (engine)
return engine->activeContext();
else
return 0;
@@ -351,16 +351,16 @@ QmlContext *QmlContext::activeContext()
QUrl QmlContext::resolvedUrl(const QUrl &src)
{
QmlContext *ctxt = this;
- if(src.isRelative()) {
- if(ctxt) {
+ if (src.isRelative()) {
+ if (ctxt) {
while(ctxt) {
- if(ctxt->d_func()->component)
+ if (ctxt->d_func()->component)
break;
else
ctxt = ctxt->parentContext();
}
- if(ctxt)
+ if (ctxt)
return ctxt->d_func()->component->url.resolved(src);
}
return QUrl();
@@ -380,16 +380,16 @@ QUrl QmlContext::resolvedUrl(const QUrl &src)
QUrl QmlContext::resolvedUri(const QUrl &src)
{
QmlContext *ctxt = this;
- if(src.isRelative()) {
- if(ctxt) {
+ if (src.isRelative()) {
+ if (ctxt) {
while(ctxt) {
- if(ctxt->d_func()->component)
+ if (ctxt->d_func()->component)
break;
else
ctxt = ctxt->parentContext();
}
- if(ctxt)
+ if (ctxt)
return ctxt->d_func()->engine->componentUrl(src, ctxt->d_func()->component->url);
}
return QUrl();
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index cbe5d5d..72c1c76 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -59,12 +59,12 @@ QmlDomDocumentPrivate::QmlDomDocumentPrivate(const QmlDomDocumentPrivate &other)
: QSharedData(other), root(0)
{
root = other.root;
- if(root) root->addref();
+ if (root) root->addref();
}
QmlDomDocumentPrivate::~QmlDomDocumentPrivate()
{
- if(root) root->release();
+ if (root) root->release();
}
/*!
@@ -152,7 +152,7 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
d->error = QString();
QmlScriptParser parser;
- if(!parser.parse(data)) {
+ if (!parser.parse(data)) {
d->error = parser.errorDescription();
return false;
}
@@ -162,12 +162,12 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
// ###
// compiler.compile(engine, parser, &component);
- if(compiler.isError()) {
+ if (compiler.isError()) {
d->error = compiler.errorDescription();
return false;
}
- if(parser.tree()) {
+ if (parser.tree()) {
component.dump(0, parser.tree());
d->root = parser.tree();
d->root->addref();
@@ -214,7 +214,7 @@ QmlDomObject QmlDomDocument::rootObject() const
{
QmlDomObject rv;
rv.d->object = d->root;
- if(rv.d->object) rv.d->object->addref();
+ if (rv.d->object) rv.d->object->addref();
return rv;
}
@@ -227,12 +227,12 @@ QmlDomPropertyPrivate::QmlDomPropertyPrivate(const QmlDomPropertyPrivate &other)
: QSharedData(other), property(0)
{
property = other.property;
- if(property) property->addref();
+ if (property) property->addref();
}
QmlDomPropertyPrivate::~QmlDomPropertyPrivate()
{
- if(property) property->release();
+ if (property) property->release();
}
/*!
@@ -313,7 +313,7 @@ QByteArray QmlDomProperty::propertyName() const
*/
QList<QByteArray> QmlDomProperty::propertyNameParts() const
{
- if(d->propertyName.isEmpty()) return QList<QByteArray>();
+ if (d->propertyName.isEmpty()) return QList<QByteArray>();
else return d->propertyName.split('.');
}
@@ -344,7 +344,7 @@ bool QmlDomProperty::isDefaultProperty() const
QmlDomValue QmlDomProperty::value() const
{
QmlDomValue rv;
- if(d->property) {
+ if (d->property) {
rv.d->property = d->property;
rv.d->value = d->property->values.at(0);
rv.d->property->addref();
@@ -371,13 +371,13 @@ QmlDomObjectPrivate::QmlDomObjectPrivate(const QmlDomObjectPrivate &other)
: QSharedData(other), object(0), isVirtualComponent(false)
{
object = other.object;
- if(object) object->addref();
+ if (object) object->addref();
isVirtualComponent = other.isVirtualComponent;
}
QmlDomObjectPrivate::~QmlDomObjectPrivate()
{
- if(object) object->release();
+ if (object) object->release();
}
QmlDomObjectPrivate::Properties
@@ -385,7 +385,7 @@ QmlDomObjectPrivate::properties() const
{
Properties rv;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
object->properties.begin();
iter != object->properties.end();
++iter) {
@@ -401,9 +401,9 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
{
Properties rv;
- if(property->value) {
+ if (property->value) {
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
property->value->properties.begin();
iter != property->value->properties.end();
++iter) {
@@ -413,13 +413,13 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
}
QByteArray name(property->name + ".");
- for(Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
+ for (Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
iter->second.prepend(name);
} else {
// We don't display "id" sets as a property in the dom
- if(property->values.count() != 1 ||
+ if (property->values.count() != 1 ||
property->values.at(0)->type != QmlParser::Value::Id)
rv << qMakePair(property, property->name);
@@ -515,7 +515,7 @@ bool QmlDomObject::isValid() const
*/
QByteArray QmlDomObject::objectType() const
{
- if(d->object) return d->object->typeName;
+ if (d->object) return d->object->typeName;
else return QByteArray();
}
@@ -530,7 +530,7 @@ QByteArray QmlDomObject::objectType() const
*/
QByteArray QmlDomObject::objectId() const
{
- if(d->object) return d->object->id;
+ if (d->object) return d->object->id;
else return QByteArray();
}
@@ -557,11 +557,11 @@ QList<QmlDomProperty> QmlDomObject::properties() const
{
QList<QmlDomProperty> rv;
- if(!d->object)
+ if (!d->object)
return rv;
QmlDomObjectPrivate::Properties properties = d->properties();
- for(int ii = 0; ii < properties.count(); ++ii) {
+ for (int ii = 0; ii < properties.count(); ++ii) {
QmlDomProperty domProperty;
domProperty.d->property = properties.at(ii).first;
@@ -571,7 +571,7 @@ QList<QmlDomProperty> QmlDomObject::properties() const
}
- if(d->object->defaultProperty) {
+ if (d->object->defaultProperty) {
QmlDomProperty domProperty;
domProperty.d->property = d->object->defaultProperty;
domProperty.d->property->addref();
@@ -596,8 +596,8 @@ QList<QmlDomProperty> QmlDomObject::properties() const
QmlDomProperty QmlDomObject::property(const QByteArray &name) const
{
QList<QmlDomProperty> props = properties();
- for(int ii = 0; ii < props.count(); ++ii)
- if(props.at(ii).propertyName() == name)
+ for (int ii = 0; ii < props.count(); ++ii)
+ if (props.at(ii).propertyName() == name)
return props.at(ii);
return QmlDomProperty();
}
@@ -684,7 +684,7 @@ bool QmlDomObject::isComponent() const
QmlDomComponent QmlDomObject::toComponent() const
{
QmlDomComponent rv;
- if(isComponent())
+ if (isComponent())
rv.d = d;
return rv;
}
@@ -698,12 +698,12 @@ QmlDomBasicValuePrivate::QmlDomBasicValuePrivate(const QmlDomBasicValuePrivate &
: QSharedData(other), value(0)
{
value = other.value;
- if(value) value->addref();
+ if (value) value->addref();
}
QmlDomBasicValuePrivate::~QmlDomBasicValuePrivate()
{
- if(value) value->release();
+ if (value) value->release();
}
/*!
@@ -761,7 +761,7 @@ QmlDomValueLiteral &QmlDomValueLiteral::operator=(const QmlDomValueLiteral &othe
*/
QString QmlDomValueLiteral::literal() const
{
- if(d->value) return d->value->primitive;
+ if (d->value) return d->value->primitive;
else return QString();
}
@@ -827,7 +827,7 @@ QmlDomValueBinding &QmlDomValueBinding::operator=(const QmlDomValueBinding &othe
*/
QString QmlDomValueBinding::binding() const
{
- if(d->value)
+ if (d->value)
return d->value->primitive.mid(1, d->value->primitive.length() - 2);
else
return QString();
@@ -907,7 +907,7 @@ QmlDomValueValueSource &QmlDomValueValueSource::operator=(const QmlDomValueValue
QmlDomObject QmlDomValueValueSource::object() const
{
QmlDomObject rv;
- if(d->value) {
+ if (d->value) {
rv.d->object = d->value->object;
rv.d->object->addref();
}
@@ -933,14 +933,14 @@ QmlDomValuePrivate::QmlDomValuePrivate(const QmlDomValuePrivate &other)
{
property = other.property;
value = other.value;
- if(property) property->addref();
- if(value) value->addref();
+ if (property) property->addref();
+ if (value) value->addref();
}
QmlDomValuePrivate::~QmlDomValuePrivate()
{
- if(property) property->release();
- if(value) value->release();
+ if (property) property->release();
+ if (value) value->release();
}
/*!
@@ -969,13 +969,13 @@ QmlDomValuePrivate::~QmlDomValuePrivate()
QmlDomObject root = document.rootObject();
QmlDomProperty text = root.property("text");
- if(text.value().isLiteral()) {
+ if (text.value().isLiteral()) {
QmlDomValueLiteral literal = text.value().toLiteral();
qDebug() << literal.literal();
}
QmlDomProperty y = root.property("y");
- if(y.value().isBinding()) {
+ if (y.value().isBinding()) {
QmlDomValueBinding binding = y.value().toBinding();
qDebug() << binding.binding();
}
@@ -1032,8 +1032,8 @@ QmlDomValue &QmlDomValue::operator=(const QmlDomValue &other)
*/
QmlDomValue::Type QmlDomValue::type() const
{
- if(d->property)
- if(QmlMetaType::isList(d->property->type) ||
+ if (d->property)
+ if (QmlMetaType::isList(d->property->type) ||
QmlMetaType::isQmlList(d->property->type) ||
(d->property && d->property->values.count() > 1))
return List;
@@ -1121,7 +1121,7 @@ bool QmlDomValue::isList() const
QmlDomValueLiteral QmlDomValue::toLiteral() const
{
QmlDomValueLiteral rv;
- if(type() == Literal) {
+ if (type() == Literal) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1137,7 +1137,7 @@ QmlDomValueLiteral QmlDomValue::toLiteral() const
QmlDomValueBinding QmlDomValue::toBinding() const
{
QmlDomValueBinding rv;
- if(type() == PropertyBinding) {
+ if (type() == PropertyBinding) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1153,7 +1153,7 @@ QmlDomValueBinding QmlDomValue::toBinding() const
QmlDomValueValueSource QmlDomValue::toValueSource() const
{
QmlDomValueValueSource rv;
- if(type() == ValueSource) {
+ if (type() == ValueSource) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1169,7 +1169,7 @@ QmlDomValueValueSource QmlDomValue::toValueSource() const
QmlDomObject QmlDomValue::toObject() const
{
QmlDomObject rv;
- if(type() == Object) {
+ if (type() == Object) {
rv.d->object = d->value->object;
rv.d->object->addref();
}
@@ -1185,7 +1185,7 @@ QmlDomObject QmlDomValue::toObject() const
QmlDomList QmlDomValue::toList() const
{
QmlDomList rv;
- if(type() == List) {
+ if (type() == List) {
rv.d = d;
}
return rv;
@@ -1254,10 +1254,10 @@ QmlDomList &QmlDomList::operator=(const QmlDomList &other)
QList<QmlDomValue> QmlDomList::values() const
{
QList<QmlDomValue> rv;
- if(!d->property)
+ if (!d->property)
return rv;
- for(int ii = 0; ii < d->property->values.count(); ++ii) {
+ for (int ii = 0; ii < d->property->values.count(); ++ii) {
QmlDomValue v;
v.d->value = d->property->values.at(ii);
v.d->value->addref();
@@ -1342,17 +1342,17 @@ QmlDomComponent &QmlDomComponent::operator=(const QmlDomComponent &other)
QmlDomObject QmlDomComponent::componentRoot() const
{
QmlDomObject rv;
- if(d->isVirtualComponent) {
+ if (d->isVirtualComponent) {
rv.d->object = d->object;
rv.d->object->addref();
- } else if(d->object) {
+ } else if (d->object) {
QmlParser::Object *obj = 0;
- if(d->object->defaultProperty &&
+ if (d->object->defaultProperty &&
d->object->defaultProperty->values.count() == 1 &&
d->object->defaultProperty->values.at(0)->object)
obj = d->object->defaultProperty->values.at(0)->object;
- if(obj) {
+ if (obj) {
rv.d->object = obj;
rv.d->object->addref();
}
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 5e698c2..30848c1 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -86,7 +86,7 @@ QML_DEFINE_TYPE(QObject,Object);
static QScriptValue qmlMetaProperty_emit(QScriptContext *ctx, QScriptEngine *engine)
{
QmlMetaProperty mp = qscriptvalue_cast<QmlMetaProperty>(ctx->thisObject());
- if(mp.type() & QmlMetaProperty::Signal)
+ if (mp.type() & QmlMetaProperty::Signal)
mp.emitSignal();
return engine->nullValue();
}
@@ -118,8 +118,8 @@ QmlEngineStack::QmlEngineStack()
QStack<QmlEngine *> *QmlEngineStack::engines()
{
- if(mainThread== 0) {
- if(!QCoreApplication::instance())
+ if (mainThread== 0) {
+ if (!QCoreApplication::instance())
return 0;
mainThread = QCoreApplication::instance()->thread();
}
@@ -127,11 +127,11 @@ QStack<QmlEngine *> *QmlEngineStack::engines()
// Note: This is very slightly faster than just using the thread storage
// for everything.
QStack<QmlEngine *> *engines = 0;
- if(QThread::currentThread() == mainThread) {
+ if (QThread::currentThread() == mainThread) {
engines = &mainThreadEngines;
} else {
engines = storage.localData();
- if(!engines) {
+ if (!engines) {
engines = new QStack<QmlEngine *>;
storage.setLocalData(engines);
}
@@ -171,7 +171,7 @@ void QmlEnginePrivate::init()
objectClass = new QmlObjectScriptClass(q);
rootContext = new QmlContext(q);
#ifdef QT_SCRIPTTOOLS_LIB
- if(debuggerEnabled()){
+ if (debuggerEnabled()){
debugger = new QScriptEngineDebugger(q);
debugger->attachTo(&scriptEngine);
}
@@ -196,7 +196,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
QScriptClass::QueryFlags rv = 0;
QmlMetaProperty prop(obj, propName);
- if(prop.type() == QmlMetaProperty::Invalid) {
+ if (prop.type() == QmlMetaProperty::Invalid) {
QPair<const QMetaObject *, QString> key =
qMakePair(obj->metaObject(), propName);
bool isFunction = false;
@@ -209,7 +209,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
functionCache()->insert(key, isFunction);
}
- if(isFunction) {
+ if (isFunction) {
*id = QmlScriptClass::FunctionId;
rv |= QScriptClass::HandlesReadAccess;
}
@@ -218,7 +218,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
*id |= prop.save();
rv |= QScriptClass::HandlesReadAccess;
- if(prop.isWritable())
+ if (prop.isWritable())
rv |= QScriptClass::HandlesWriteAccess;
}
@@ -228,25 +228,25 @@ QmlEnginePrivate::queryObject(const QString &propName,
QScriptValue QmlEnginePrivate::propertyObject(const QScriptString &propName,
QObject *obj, uint id)
{
- if(id == QmlScriptClass::FunctionId) {
+ if (id == QmlScriptClass::FunctionId) {
QScriptValue sobj = scriptEngine.newQObject(obj);
QScriptValue func = sobj.property(propName);
return func;
} else {
QmlMetaProperty prop;
prop.restore(id, obj);
- if(!prop.isValid())
+ if (!prop.isValid())
return QScriptValue();
- if(prop.type() & QmlMetaProperty::Signal) {
+ if (prop.type() & QmlMetaProperty::Signal) {
return scriptEngine.newVariant(qVariantFromValue(prop));
} else {
QVariant var = prop.read();
capturedProperties << prop;
QObject *varobj = QmlMetaType::toQObject(var);
- if(!varobj)
+ if (!varobj)
varobj = qvariant_cast<QObject *>(var);
- if(varobj) {
+ if (varobj) {
return scriptEngine.newObject(objectClass, scriptEngine.newVariant(QVariant::fromValue(varobj)));
} else {
if (var.type() == QVariant::Bool)
@@ -263,20 +263,20 @@ void QmlEnginePrivate::contextActivated(QmlContext *)
{
Q_Q(QmlEngine);
QmlEngineStack *stack = engineStack();
- if(!stack)
+ if (!stack)
return;
QStack<QmlEngine *> *engines = stack->engines();
- if(engines)
+ if (engines)
engines->push(q);
}
void QmlEnginePrivate::contextDeactivated(QmlContext *)
{
QmlEngineStack *stack = engineStack();
- if(!stack)
+ if (!stack)
return;
QStack<QmlEngine *> *engines = stack->engines();
- if(engines) {
+ if (engines) {
Q_ASSERT(engines->top() == q_func());
engines->pop();
}
@@ -289,19 +289,19 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
{
QmlMetaProperty prop(obj, propName);
- if(!prop.isValid())
+ if (!prop.isValid())
return false;
capturedProperties << prop;
- if(prop.type() & QmlMetaProperty::Attached) {
+ if (prop.type() & QmlMetaProperty::Attached) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Attached;
cache.attached = prop.d->attachedObject();
return true;
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Core;
@@ -309,14 +309,14 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
cache.coreType = prop.propertyType();
return true;
- } else if(prop.type() & QmlMetaProperty::SignalProperty) {
+ } else if (prop.type() & QmlMetaProperty::SignalProperty) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::SignalProperty;
cache.core = prop.coreIndex();
return true;
- } else if(prop.type() & QmlMetaProperty::Signal) {
+ } else if (prop.type() & QmlMetaProperty::Signal) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Signal;
@@ -331,25 +331,25 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
bool QmlEnginePrivate::loadCache(QmlBasicScriptNodeCache &cache, const QString &propName, QmlContextPrivate *context)
{
while(context) {
- if(context->variantProperties.contains(propName)) {
+ if (context->variantProperties.contains(propName)) {
cache.object = 0;
cache.type = QmlBasicScriptNodeCache::Variant;
cache.context = context;
return true;
}
- if(context->properties.contains(propName)) {
+ if (context->properties.contains(propName)) {
cache.object = context->properties[propName];
cache.type = QmlBasicScriptNodeCache::Explicit;
return true;
}
foreach(QObject *obj, context->defaultObjects) {
- if(fetchCache(cache, propName, obj))
+ if (fetchCache(cache, propName, obj))
return true;
}
- if(context->parent)
+ if (context->parent)
context = context->parent->d_func();
else
context = 0;
@@ -453,7 +453,7 @@ QmlContext *QmlEngine::rootContext()
QmlContext *QmlEngine::activeContext()
{
Q_D(QmlEngine);
- if(d->currentBindContext)
+ if (d->currentBindContext)
return d->currentBindContext;
else
return 0;
@@ -591,7 +591,7 @@ void QmlEngine::setNetworkAccessManager(QNetworkAccessManager *network)
QNetworkAccessManager *QmlEngine::networkAccessManager() const
{
Q_D(const QmlEngine);
- if(!d->networkAccessManager)
+ if (!d->networkAccessManager)
d->networkAccessManager = new QNetworkAccessManager;
return d->networkAccessManager;
}
@@ -613,12 +613,12 @@ void QmlEngine::setContextForObject(QObject *object, QmlContext *context)
QmlSimpleDeclarativeData *data =
static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
- if(data && data->context) {
+ if (data && data->context) {
qWarning("QmlEngine::setContextForObject(): Object already has a QmlContext");
return;
}
- if(!data) {
+ if (!data) {
priv->declarativeData = &context->d_func()->contextData;
} else {
// ### - Don't have to use extended data here
@@ -648,23 +648,23 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object)
QmlExtendedDeclarativeData *edata = (data && data->flags & QmlSimpleDeclarativeData::Extended)?static_cast<QmlExtendedDeclarativeData *>(data):0;
- if(edata) {
+ if (edata) {
QObject *rv = edata->attachedProperties.value(id);
- if(rv)
+ if (rv)
return rv;
}
QmlAttachedPropertiesFunc pf = QmlMetaType::attachedPropertiesFuncById(id);
- if(!pf)
+ if (!pf)
return 0;
QObject *rv = pf(const_cast<QObject *>(object));
- if(rv) {
- if(!edata) {
+ if (rv) {
+ if (!edata) {
edata = new QmlExtendedDeclarativeData;
- if(data) edata->context = data->context;
+ if (data) edata->context = data->context;
priv->declarativeData = edata;
}
@@ -697,15 +697,15 @@ QScriptEngine *QmlEngine::scriptEngine()
QmlEngine *QmlEngine::activeEngine()
{
QmlEngineStack *stack = engineStack();
- if(!stack) return 0;
+ if (!stack) return 0;
QStack<QmlEngine *> *engines = stack->engines();
- if(!engines) {
+ if (!engines) {
qWarning("QmlEngine::activeEngine() cannot be called before the construction of QCoreApplication");
return 0;
}
- if(engines->isEmpty())
+ if (engines->isEmpty())
return 0;
else
return engines->top();
@@ -726,7 +726,7 @@ QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, void *expr, QmlRefC
QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, const QString &expr, bool ssecompile)
: q(b), ctxt(0), expression(expr), sseData(0), proxy(0), me(0), trackChange(true)
{
- if(ssecompile) {
+ if (ssecompile) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindCompile> pt;
#endif
@@ -816,7 +816,7 @@ QmlContext *QmlExpression::context() const
*/
QString QmlExpression::expression() const
{
- if(d->sse.isValid())
+ if (d->sse.isValid())
return QLatin1String(d->sse.expression());
else
return d->expression;
@@ -835,7 +835,7 @@ void QmlExpression::clearExpression()
*/
void QmlExpression::setExpression(const QString &expression)
{
- if(d->sseData) {
+ if (d->sseData) {
d->sse.deleteScriptState(d->sseData);
d->sseData = 0;
}
@@ -844,7 +844,7 @@ void QmlExpression::setExpression(const QString &expression)
d->expression = expression;
- if(d->expression.isEmpty())
+ if (d->expression.isEmpty())
d->sse.clear();
else
d->sse.compile(expression.toLatin1());
@@ -875,10 +875,10 @@ void BindExpressionProxy::changed()
*/
QVariant QmlExpression::value()
{
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << "QmlEngine: Evaluating:" << expression();
QVariant rv;
- if(!d->ctxt || (!d->sse.isValid() && d->expression.isEmpty()))
+ if (!d->ctxt || (!d->sse.isValid() && d->expression.isEmpty()))
return rv;
#ifdef Q_ENABLE_PERFORMANCE_LOG
@@ -890,14 +890,14 @@ QVariant QmlExpression::value()
QmlEnginePrivate *ep = engine()->d_func();
QmlExpression *lastCurrentExpression = ep->currentExpression;
ep->currentExpression = this;
- if(d->sse.isValid()) {
+ if (d->sse.isValid()) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindValueSSE> perfsse;
#endif
context()->d_func()->defaultObjects.insert(context()->d_func()->highPriorityCount, d->me);
- if(!d->sseData)
+ if (!d->sseData)
d->sseData = d->sse.newScriptState();
rv = d->sse.run(context(), d->sseData, &cacheState);
@@ -920,7 +920,7 @@ QVariant QmlExpression::value()
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
- if(!exception.property(QLatin1String("fileName")).toString().isEmpty()){
+ if (!exception.property(QLatin1String("fileName")).toString().isEmpty()){
qWarning() << exception.property(QLatin1String("fileName")).toString()
<< scriptEngine->uncaughtExceptionLineNumber()
<< exception.toString();
@@ -932,14 +932,14 @@ QVariant QmlExpression::value()
}
context()->d_func()->defaultObjects.removeAt(context()->d_func()->highPriorityCount);
- if(svalue.isArray()) {
+ if (svalue.isArray()) {
int length = svalue.property(QLatin1String("length")).toInt32();
- if(length && svalue.property(0).isObject()) {
+ if (length && svalue.property(0).isObject()) {
QList<QObject *> list;
- for(int ii = 0; ii < length; ++ii) {
+ for (int ii = 0; ii < length; ++ii) {
QScriptValue arrayItem = svalue.property(ii);
QObject *d = qvariant_cast<QObject *>(arrayItem.data().toVariant());
- if(d) {
+ if (d) {
list << d;
} else {
list << 0;
@@ -954,7 +954,7 @@ QVariant QmlExpression::value()
if (objValue.isValid())
rv = objValue.toVariant();
}
- if(rv.isNull()) {
+ if (rv.isNull()) {
rv = svalue.toVariant();
}
@@ -967,35 +967,35 @@ QVariant QmlExpression::value()
}
ep->currentExpression = lastCurrentExpression;
- if(cacheState != QmlBasicScript::NoChange) {
- if(cacheState != QmlBasicScript::Incremental && d->proxy) {
+ if (cacheState != QmlBasicScript::NoChange) {
+ if (cacheState != QmlBasicScript::Incremental && d->proxy) {
delete d->proxy;
d->proxy = 0;
}
- if(trackChange() && ep->capturedProperties.count()) {
- if(!d->proxy)
+ if (trackChange() && ep->capturedProperties.count()) {
+ if (!d->proxy)
d->proxy = new BindExpressionProxy(this);
static int changedIndex = -1;
- if(changedIndex == -1)
+ if (changedIndex == -1)
changedIndex = BindExpressionProxy::staticMetaObject.indexOfSlot("changed()");
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " Depends on:";
- for(int ii = 0; ii < ep->capturedProperties.count(); ++ii) {
+ for (int ii = 0; ii < ep->capturedProperties.count(); ++ii) {
const QmlMetaProperty &prop =
ep->capturedProperties.at(ii);
- if(prop.hasChangedNotifier()) {
+ if (prop.hasChangedNotifier()) {
prop.connectNotifier(d->proxy, changedIndex);
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " property"
<< prop.name()
<< prop.object()
<< prop.object()->metaObject()->superClass()->className();
- } else if(bindValueDebug()) {
+ } else if (bindValueDebug()) {
qWarning() << " non-subscribable property"
<< prop.name()
<< prop.object()
@@ -1006,7 +1006,7 @@ QVariant QmlExpression::value()
}
ep->capturedProperties.clear();
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " Result:" << rv
<< "(SSE: " << d->sse.isValid() << ")";
return rv;
@@ -1177,10 +1177,10 @@ QmlContextScriptClass::queryProperty(const QScriptValue &object,
*id = ObjectListPropertyId;
}
- for(int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) {
+ for (int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) {
rv = engine->d_func()->queryObject(propName, id,
bindContext->d_func()->defaultObjects.at(ii));
- if(rv)
+ if (rv)
*id |= (ii << 24);
}
@@ -1234,7 +1234,7 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object,
QObject *obj = bindContext->d_func()->defaultObjects.at(objId);
QScriptValue rv = engine->d_func()->propertyObject(name, obj,
id & ~QmlScriptClass::ClassIdSelectorMask);
- if(rv.isValid()) {
+ if (rv.isValid()) {
#ifdef PROPERTY_DEBUG
qWarning() << "~Property: Resolved property" << propName
<< "to context default object" << bindContext << obj <<". Value:" << rv.toVariant();
@@ -1340,7 +1340,7 @@ QScriptValue QmlObjectScriptClass::property(const QScriptValue &object,
#endif
QScriptValue rv = engine->d_func()->propertyObject(name, obj, id);
- if(rv.isValid()) {
+ if (rv.isValid()) {
#ifdef PROPERTY_DEBUG
qWarning() << "~Property: Resolved property" << propName
<< "to object" << obj <<". Value:" << rv.toVariant();
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index dc7f44c..a2b304f 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -75,7 +75,7 @@ QmlInfo::QmlInfo(QObject *object)
: QDebug(QtWarningMsg)
{
*this << "QML";
- if(object)
+ if (object)
*this << object->metaObject()->className();
*this << "(unknown location):";
}
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp
index 848c8db..82924c8 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qmlinstruction.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
void QmlCompiledComponent::dump(QmlInstruction *instr, int idx)
{
QByteArray lineNumber = QByteArray::number(instr->line);
- if(instr->line == (unsigned short)-1)
+ if (instr->line == (unsigned short)-1)
lineNumber = "NA";
const char *line = lineNumber.constData();
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 780f8a8..1a511eb 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -127,13 +127,13 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt)
void QmlMetaProperty::initDefault(QObject *obj)
{
- if(!obj)
+ if (!obj)
return;
d->object = obj;
QHash<const QMetaObject *, QMetaPropertyEx>::ConstIterator iter =
qmlCacheDefProp.find(obj->metaObject());
- if(iter != qmlCacheDefProp.end()) {
+ if (iter != qmlCacheDefProp.end()) {
d->prop = *iter;
d->propType = iter->propertyType;
d->coreIdx = iter->propertyType;
@@ -142,10 +142,10 @@ void QmlMetaProperty::initDefault(QObject *obj)
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = d->prop.propertyIndex();
- if(!QObjectPrivate::get(obj)->metaObject)
+ if (!QObjectPrivate::get(obj)->metaObject)
qmlCacheDefProp.insert(obj->metaObject(), d->prop);
}
- if(d->prop.name() != 0) {
+ if (d->prop.name() != 0) {
d->type = Property | Default;
d->name = QLatin1String(d->prop.name());
}
@@ -169,7 +169,7 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, int idx, PropertyCategory cat, Qm
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = idx;
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
d->name = QLatin1String(d->prop.name());
}
@@ -203,22 +203,22 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
{
d->name = name;
d->object = obj;
- if(name.isEmpty() || !obj)
+ if (name.isEmpty() || !obj)
return;
- if(name.at(0).isUpper()) {
+ if (name.at(0).isUpper()) {
// Attached property
d->attachedFunc = QmlMetaType::attachedPropertiesFuncId(name.toLatin1());
- if(d->attachedFunc != -1)
+ if (d->attachedFunc != -1)
d->type = Property | Attached;
return;
- } else if(name.count() >= 3 && name.startsWith(QLatin1String("on")) && name.at(2).isUpper()) {
+ } else if (name.count() >= 3 && name.startsWith(QLatin1String("on")) && name.at(2).isUpper()) {
// Signal
QString signalName = name.mid(2);
signalName[0] = signalName.at(0).toLower();
d->findSignalInt(obj, signalName);
- if(d->signal.signature() != 0) {
+ if (d->signal.signature() != 0) {
d->type = SignalProperty;
return;
}
@@ -227,7 +227,7 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
// Property
QHash<QString, QMetaPropertyEx> &props = qmlCacheProps[obj->metaObject()];
QHash<QString, QMetaPropertyEx>::ConstIterator iter = props.find(name);
- if(iter != props.end()) {
+ if (iter != props.end()) {
d->prop = *iter;
d->propType = iter->propertyType;
d->coreIdx = iter->propertyIndex();
@@ -239,12 +239,12 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
if (!QObjectPrivate::get(obj)->metaObject)
props.insert(name, p);
}
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
d->type = Property;
- if(d->type == Invalid) {
+ if (d->type == Invalid) {
int sig = findSignal(obj, name.toLatin1());
- if(sig != -1) {
+ if (sig != -1) {
d->signal = obj->metaObject()->method(sig);
d->type = Signal;
d->coreIdx = sig;
@@ -271,17 +271,17 @@ QmlMetaProperty::PropertyCategory QmlMetaProperty::propertyCategory() const
QmlMetaProperty::PropertyCategory
QmlMetaPropertyPrivate::propertyCategory() const
{
- if(category == QmlMetaProperty::Unknown) {
+ if (category == QmlMetaProperty::Unknown) {
int type = propertyType();
- if(type == QmlMetaProperty::Invalid)
+ if (type == QmlMetaProperty::Invalid)
category = QmlMetaProperty::InvalidProperty;
- else if(type == qMetaTypeId<QmlBindableValue *>())
+ else if (type == qMetaTypeId<QmlBindableValue *>())
category = QmlMetaProperty::Bindable;
- else if(QmlMetaType::isList(type))
+ else if (QmlMetaType::isList(type))
category = QmlMetaProperty::List;
- else if(QmlMetaType::isQmlList(type))
+ else if (QmlMetaType::isQmlList(type))
category = QmlMetaProperty::QmlList;
- else if(QmlMetaType::isObject(type))
+ else if (QmlMetaType::isObject(type))
category = QmlMetaProperty::Object;
else
category = QmlMetaProperty::Normal;
@@ -295,22 +295,22 @@ QmlMetaPropertyPrivate::propertyCategory() const
QmlMetaProperty::PropertyCategory
QmlMetaProperty::propertyCategory(const QMetaProperty &prop)
{
- if(prop.name()) {
+ if (prop.name()) {
int type = 0;
- if(prop.type() == QVariant::LastType)
+ if (prop.type() == QVariant::LastType)
type = qMetaTypeId<QVariant>();
- else if(prop.type() == QVariant::UserType)
+ else if (prop.type() == QVariant::UserType)
type = prop.userType();
else
type = prop.type();
- if(type == qMetaTypeId<QmlBindableValue *>())
+ if (type == qMetaTypeId<QmlBindableValue *>())
return Bindable;
- else if(QmlMetaType::isList(type))
+ else if (QmlMetaType::isList(type))
return List;
- else if(QmlMetaType::isQmlList(type))
+ else if (QmlMetaType::isQmlList(type))
return QmlList;
- else if(QmlMetaType::isObject(type))
+ else if (QmlMetaType::isObject(type))
return Object;
else
return Normal;
@@ -325,7 +325,7 @@ QmlMetaProperty::propertyCategory(const QMetaProperty &prop)
*/
const char *QmlMetaProperty::propertyTypeName() const
{
- if(d->prop.name()) {
+ if (d->prop.name()) {
return d->prop.typeName();
} else {
return 0;
@@ -357,12 +357,12 @@ int QmlMetaPropertyPrivate::propertyType() const
{
int rv = QVariant::Invalid;
- if(prop.name()) {
- if(propType == (int)QVariant::LastType)
+ if (prop.name()) {
+ if (propType == (int)QVariant::LastType)
rv = qMetaTypeId<QVariant>();
else
rv = propType;
- } else if(attachedFunc) {
+ } else if (attachedFunc) {
rv = qMetaTypeId<QObject *>();
}
@@ -423,11 +423,11 @@ QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other)
*/
bool QmlMetaProperty::isWritable() const
{
- if(propertyCategory() == List || propertyCategory() == QmlList)
+ if (propertyCategory() == List || propertyCategory() == QmlList)
return true;
- else if(d->prop.name() != 0)
+ else if (d->prop.name() != 0)
return d->prop.isWritable();
- else if(type() & SignalProperty)
+ else if (type() & SignalProperty)
return true;
else
return false;
@@ -438,7 +438,7 @@ bool QmlMetaProperty::isWritable() const
*/
bool QmlMetaProperty::isDesignable() const
{
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
return d->prop.isDesignable();
else
return false;
@@ -458,12 +458,12 @@ bool QmlMetaProperty::isValid() const
*/
QStringList QmlMetaProperty::properties(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QStringList();
QStringList rv;
const QMetaObject *mo = obj->metaObject();
- for(int ii = 0; ii < mo->propertyCount(); ++ii) {
+ for (int ii = 0; ii < mo->propertyCount(); ++ii) {
QMetaProperty prop = mo->property(ii);
rv << QLatin1String(prop.name());
}
@@ -490,16 +490,16 @@ const QMetaProperty &QmlMetaProperty::property() const
*/
QmlBindableValue *QmlMetaProperty::binding()
{
- if(!isProperty() || type() & Attached)
+ if (!isProperty() || type() & Attached)
return 0;
const QObjectList &children = object()->children();
- for(QObjectList::ConstIterator iter = children.begin();
+ for (QObjectList::ConstIterator iter = children.begin();
iter != children.end(); ++iter) {
QObject *child = *iter;
- if(child->metaObject() == &QmlBindableValue::staticMetaObject) {
+ if (child->metaObject() == &QmlBindableValue::staticMetaObject) {
QmlBindableValue *v = static_cast<QmlBindableValue *>(child);
- if(v->property() == *this)
+ if (v->property() == *this)
return v;
}
}
@@ -511,16 +511,16 @@ int QmlMetaProperty::findSignal(const QObject *obj, const char *name)
{
const QMetaObject *mo = obj->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
- if(method.methodType() != QMetaMethod::Signal)
+ if (method.methodType() != QMetaMethod::Signal)
continue;
QByteArray methodName = method.signature();
int idx = methodName.indexOf('(');
methodName = methodName.left(idx);
- if(methodName == name)
+ if (methodName == name)
return ii;
}
return -1;
@@ -531,13 +531,13 @@ void QmlMetaPropertyPrivate::findSignalInt(QObject *obj, const QString &name)
const QMetaObject *mo = obj->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
QString methodName = QLatin1String(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
- if(methodName == name) {
+ if (methodName == name) {
signal = method;
coreIdx = ii;
return;
@@ -547,7 +547,7 @@ void QmlMetaPropertyPrivate::findSignalInt(QObject *obj, const QString &name)
QObject *QmlMetaPropertyPrivate::attachedObject() const
{
- if(attachedFunc == -1)
+ if (attachedFunc == -1)
return 0;
else
return qmlAttachedPropertiesObjectById(attachedFunc, object);
@@ -558,17 +558,17 @@ QObject *QmlMetaPropertyPrivate::attachedObject() const
*/
QVariant QmlMetaProperty::read() const
{
- if(type() & SignalProperty) {
+ if (type() & SignalProperty) {
const QObjectList &children = object()->children();
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QmlBoundSignal *sig = qobject_cast<QmlBoundSignal *>(children.at(ii));
- if(sig && sig->index() == d->coreIdx)
+ if (sig && sig->index() == d->coreIdx)
return sig->expression();
}
- } else if(type() & Property) {
- if(type() & Attached)
+ } else if (type() & Property) {
+ if (type() & Attached)
return QVariant::fromValue(d->attachedObject());
else
return d->prop.read(object());
@@ -583,10 +583,10 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
QString expr = value.toString();
const QObjectList &children = object->children();
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QmlBoundSignal *sig = qobject_cast<QmlBoundSignal *>(children.at(ii));
- if(sig && sig->index() == coreIdx) {
- if(expr.isEmpty()) {
+ if (sig && sig->index() == coreIdx) {
+ if (expr.isEmpty()) {
sig->disconnect();
sig->deleteLater();
} else {
@@ -596,7 +596,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
}
}
- if(!expr.isEmpty()) {
+ if (!expr.isEmpty()) {
// XXX scope
(void *)new QmlBoundSignal(QmlContext::activeContext(), expr, object,
coreIdx, object);
@@ -605,7 +605,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
- if(prop.isEnumType()) {
+ if (prop.isEnumType()) {
QVariant v = value;
if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles
double integral;
@@ -615,43 +615,43 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
}
prop.write(object, v);
} else {
- if(!value.isValid())
+ if (!value.isValid())
return;
int t = propertyType();
int vt = value.type();
- if(vt == t ||
+ if (vt == t ||
value.userType() == t) {
void *a[1];
a[0] = (void *)value.constData();
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- } else if(qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == t) {
prop.write(object, value);
- } else if(propertyCategory() == QmlMetaProperty::Object) {
+ } else if (propertyCategory() == QmlMetaProperty::Object) {
QObject *o = QmlMetaType::toQObject(value);
- if(o)
+ if (o)
prop.write(object, QmlMetaType::fromObject(o, propertyType()));
} else if (propertyCategory() == QmlMetaProperty::List) {
int listType = QmlMetaType::listType(t);
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = prop.read(object);
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(vt == listType ||
+ } else if (vt == listType ||
value.userType() == listType) {
QVariant listVar = prop.read(object);
if (!QmlMetaType::append(listVar, value)) {
@@ -673,13 +673,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -689,22 +689,22 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
void *d = (void *)&obj;
li->append(d);
}
- } else if(propertyCategory() == QmlMetaProperty::Normal) {
+ } else if (propertyCategory() == QmlMetaProperty::Normal) {
switch(t) {
case QVariant::Double:
{
qreal r;
bool found = true;
- if(vt == QVariant::Int) {
+ if (vt == QVariant::Int) {
r = value.toInt();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
r = value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &r;
QMetaObject::metacall(object,
@@ -719,15 +719,15 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
int i;
bool found = true;
- if(vt == QVariant::Double) {
+ if (vt == QVariant::Double) {
i = (int)value.toDouble();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
i = (int)value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &i;
QMetaObject::metacall(object,
@@ -742,13 +742,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
QString s;
bool found = true;
- if(vt == QVariant::ByteArray) {
+ if (vt == QVariant::ByteArray) {
s = QLatin1String(value.toByteArray());
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &s;
QMetaObject::metacall(object,
@@ -774,13 +774,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
*/
void QmlMetaProperty::write(const QVariant &value) const
{
- if(type() & SignalProperty) {
+ if (type() & SignalProperty) {
d->writeSignalProperty(value);
- } else if(d->prop.name()) {
+ } else if (d->prop.name()) {
- if(d->prop.isEnumType()) {
+ if (d->prop.isEnumType()) {
QVariant v = value;
if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles
double integral;
@@ -790,43 +790,43 @@ void QmlMetaProperty::write(const QVariant &value) const
}
d->prop.write(object(), v);
} else {
- if(!value.isValid())
+ if (!value.isValid())
return;
int t = propertyType();
int vt = value.type();
- if(vt == t ||
+ if (vt == t ||
value.userType() == t) {
void *a[1];
a[0] = (void *)value.constData();
QMetaObject::metacall(object(), QMetaObject::WriteProperty, d->coreIdx, a);
- } else if(qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == t) {
d->prop.write(object(), value);
- } else if(propertyCategory() == Object) {
+ } else if (propertyCategory() == Object) {
QObject *o = QmlMetaType::toQObject(value);
- if(o)
+ if (o)
d->prop.write(object(), QmlMetaType::fromObject(o, propertyType()));
} else if (propertyCategory() == List) {
int listType = QmlMetaType::listType(t);
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = d->prop.read(object());
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(vt == listType ||
+ } else if (vt == listType ||
value.userType() == listType) {
QVariant listVar = d->prop.read(object());
if (!QmlMetaType::append(listVar, value)) {
@@ -848,13 +848,13 @@ void QmlMetaProperty::write(const QVariant &value) const
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -864,22 +864,22 @@ void QmlMetaProperty::write(const QVariant &value) const
void *d = (void *)&obj;
li->append(d);
}
- } else if(propertyCategory() == Normal) {
+ } else if (propertyCategory() == Normal) {
switch(t) {
case QVariant::Double:
{
qreal r;
bool found = true;
- if(vt == QVariant::Int) {
+ if (vt == QVariant::Int) {
r = value.toInt();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
r = value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &r;
QMetaObject::metacall(object(),
@@ -894,15 +894,15 @@ void QmlMetaProperty::write(const QVariant &value) const
{
int i;
bool found = true;
- if(vt == QVariant::Double) {
+ if (vt == QVariant::Double) {
i = (int)value.toDouble();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
i = (int)value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &i;
QMetaObject::metacall(object(),
@@ -917,13 +917,13 @@ void QmlMetaProperty::write(const QVariant &value) const
{
QString s;
bool found = true;
- if(vt == QVariant::ByteArray) {
+ if (vt == QVariant::ByteArray) {
s = QLatin1String(value.toByteArray());
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &s;
QMetaObject::metacall(object(),
@@ -950,7 +950,7 @@ void QmlMetaProperty::write(const QVariant &value) const
*/
bool QmlMetaProperty::hasChangedNotifier() const
{
- if(type() & Property && !(type() & Attached)) {
+ if (type() & Property && !(type() & Attached)) {
return d->prop.hasNotifySignal();
}
return false;
@@ -966,10 +966,10 @@ bool QmlMetaProperty::hasChangedNotifier() const
*/
bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
{
- if(!(type() & Property) || type() & Attached)
+ if (!(type() & Property) || type() & Attached)
return false;
- if(d->prop.hasNotifySignal()) {
+ if (d->prop.hasNotifySignal()) {
return QMetaObject::connect(d->object, d->prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
} else {
return false;
@@ -986,10 +986,10 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
*/
bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
{
- if(!(type() & Property) || type() & Attached)
+ if (!(type() & Property) || type() & Attached)
return false;
- if(d->prop.hasNotifySignal()) {
+ if (d->prop.hasNotifySignal()) {
QByteArray signal(QByteArray("2") + d->prop.notifySignal().signature());
return QObject::connect(d->object, signal.constData(), dest, slot);
} else {
@@ -1000,8 +1000,8 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
/*! \internal */
void QmlMetaProperty::emitSignal()
{
- if(type() & Signal) {
- if(d->signal.parameterTypes().isEmpty())
+ if (type() & Signal) {
+ if (d->signal.parameterTypes().isEmpty())
d->object->metaObject()->activate(d->object, d->coreIdx, 0);
else
qWarning() << "QmlMetaProperty: Cannot emit signal with parameters";
@@ -1023,9 +1023,9 @@ int QmlMetaProperty::coreIndex() const
quint32 QmlMetaProperty::save() const
{
quint32 rv = 0;
- if(type() & Attached) {
+ if (type() & Attached) {
rv = d->attachedFunc;
- } else if(type() != Invalid) {
+ } else if (type() != Invalid) {
rv = d->coreIdx;
}
@@ -1050,14 +1050,14 @@ void QmlMetaProperty::restore(quint32 id, QObject *obj)
d->type = id >> 16;
id &= 0xFFFF;
- if(d->type & Attached) {
+ if (d->type & Attached) {
d->attachedFunc = id;
- } else if(d->type & Property) {
+ } else if (d->type & Property) {
QMetaPropertyEx p(obj->metaObject()->property(id));
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = id;
- } else if(d->type & SignalProperty || d->type & Signal) {
+ } else if (d->type & SignalProperty || d->type & Signal) {
d->signal = obj->metaObject()->method(id);
d->coreIdx = id;
}
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index c12f01a..9b99917 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -164,7 +164,7 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_extFunc = extFunc;
d->m_index = index;
- if(extMetaObject)
+ if (extMetaObject)
d->m_extMetaObject = extMetaObject;
}
@@ -175,16 +175,16 @@ QmlType::~QmlType()
void QmlTypePrivate::init() const
{
- if(m_isSetup) return;
+ if (m_isSetup) return;
QWriteLocker lock(metaTypeDataLock());
- if(m_isSetup)
+ if (m_isSetup)
return;
// Setup extended meta object
// XXX - very inefficient
const QMetaObject *mo = m_baseMetaObject;
- if(m_extFunc) {
+ if (m_extFunc) {
QMetaObject *mmo = new QMetaObject;
*mmo = *m_extMetaObject;
mmo->d.superdata = mo;
@@ -195,12 +195,12 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
while(mo) {
QmlType *t = metaTypeData()->metaObjectToType.value(mo);
- if(t) {
- if(t->d->m_extFunc) {
+ if (t) {
+ if (t->d->m_extFunc) {
QMetaObject *mmo = new QMetaObject;
*mmo = *t->d->m_extMetaObject;
mmo->d.superdata = m_baseMetaObject;
- if(!m_metaObjects.isEmpty())
+ if (!m_metaObjects.isEmpty())
m_metaObjects.last().metaObject->d.superdata = mmo;
QmlProxyMetaObject::ProxyData data = { mmo, t->d->m_extFunc, 0 };
m_metaObjects << data;
@@ -209,7 +209,7 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
}
- for(int ii = 0; ii < m_metaObjects.count(); ++ii)
+ for (int ii = 0; ii < m_metaObjects.count(); ++ii)
m_metaObjects[ii].propertyOffset =
m_metaObjects.at(ii).metaObject->propertyOffset();
@@ -218,7 +218,7 @@ void QmlTypePrivate::init() const
const QMetaObject *myMetaObject = m_metaObjects.isEmpty()?m_baseMetaObject:m_metaObjects.first().metaObject;
- for(int ii = 0; ii < myMetaObject->propertyCount(); ++ii) {
+ for (int ii = 0; ii < myMetaObject->propertyCount(); ++ii) {
QMetaProperty prop = myMetaObject->property(ii);
hashData.append(prop.type());
hashData.append("|");
@@ -226,7 +226,7 @@ void QmlTypePrivate::init() const
hashData.append("|");
}
- for(int ii = 0; ii < myMetaObject->methodCount(); ++ii) {
+ for (int ii = 0; ii < myMetaObject->methodCount(); ++ii) {
QMetaMethod method = myMetaObject->method(ii);
hashData.append(method.signature());
hashData.append("|");
@@ -240,7 +240,7 @@ void QmlTypePrivate::init() const
QByteArray QmlType::typeName() const
{
- if(d->m_baseMetaObject)
+ if (d->m_baseMetaObject)
return d->m_baseMetaObject->className();
else
return QByteArray();
@@ -324,7 +324,7 @@ const QMetaObject *QmlType::metaObject() const
{
d->init();
- if(d->m_metaObjects.isEmpty())
+ if (d->m_metaObjects.isEmpty())
return d->m_baseMetaObject;
else
return d->m_metaObjects.first().metaObject;
@@ -383,11 +383,11 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
data->idToType.insert(type->qmlListTypeId(), type);
data->nameToType.insert(type->qmlTypeName(), type);
- if(data->interfaces.size() < id.typeId)
+ if (data->interfaces.size() < id.typeId)
data->interfaces.resize(id.typeId + 16);
- if(data->qmllists.size() < id.qmlListId)
+ if (data->qmllists.size() < id.qmlListId)
data->qmllists.resize(id.qmlListId + 16);
- if(data->lists.size() < id.listId)
+ if (data->lists.size() < id.listId)
data->lists.resize(id.listId + 16);
data->interfaces.setBit(id.typeId, true);
data->qmllists.setBit(id.qmlListId, true);
@@ -403,8 +403,8 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
QmlMetaTypeData *data = metaTypeData();
QString name = QLatin1String(cname);
- for(int ii = 0; ii < name.count(); ++ii) {
- if(!name.at(ii).isLetterOrNumber()) {
+ for (int ii = 0; ii < name.count(); ++ii) {
+ if (!name.at(ii).isLetterOrNumber()) {
qWarning("QmlMetaType: Invalid QML name %s", cname);
return -1;
}
@@ -421,16 +421,16 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
data->idToType.insert(type->qListTypeId(), type);
data->idToType.insert(type->qmlListTypeId(), type);
- if(!type->qmlTypeName().isEmpty())
+ if (!type->qmlTypeName().isEmpty())
data->nameToType.insert(type->qmlTypeName(), type);
data->metaObjectToType.insert(type->baseMetaObject(), type);
- if(data->objects.size() <= id.typeId)
+ if (data->objects.size() <= id.typeId)
data->objects.resize(id.typeId + 16);
- if(data->qmllists.size() <= id.qmlListId)
+ if (data->qmllists.size() <= id.qmlListId)
data->qmllists.resize(id.qmlListId + 16);
- if(data->lists.size() <= id.listId)
+ if (data->lists.size() <= id.listId)
data->lists.resize(id.listId + 16);
data->objects.setBit(id.typeId, true);
data->qmllists.setBit(id.qmlListId, true);
@@ -446,7 +446,7 @@ void QmlMetaType::registerCustomParser(const char *qmlName,
QmlMetaTypeData *data = metaTypeData();
Q_ASSERT(parser);
- if(data->customParsers.contains(qmlName)) {
+ if (data->customParsers.contains(qmlName)) {
delete parser;
return;
}
@@ -468,7 +468,7 @@ int QmlMetaType::qmlParserStatusCast(int userType)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
- if(type && type->typeId() == userType)
+ if (type && type->typeId() == userType)
return type->parserStatusCast();
else
return -1;
@@ -476,7 +476,7 @@ int QmlMetaType::qmlParserStatusCast(int userType)
QObject *QmlMetaType::toQObject(const QVariant &v)
{
- if(!isObject(v.userType()))
+ if (!isObject(v.userType()))
return 0;
// NOTE: This assumes a cast to QObject does not alter the
@@ -493,7 +493,7 @@ int QmlMetaType::listType(int id)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->qListTypeId() == id)
+ if (type && type->qListTypeId() == id)
return type->typeId();
else
return 0;
@@ -507,7 +507,7 @@ int QmlMetaType::qmlListType(int id)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->qmlListTypeId() == id)
+ if (type && type->qmlListTypeId() == id)
return type->typeId();
else
return 0;
@@ -520,7 +520,7 @@ bool QmlMetaType::clear(const QVariant &list)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType) {
+ if (type && type->qListTypeId() == userType) {
type->listClear(list);
return true;
} else {
@@ -535,7 +535,7 @@ bool QmlMetaType::append(const QVariant &list, const QVariant &item)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType &&
+ if (type && type->qListTypeId() == userType &&
item.userType() == type->typeId()) {
type->listAppend(list, item);
return true;
@@ -551,7 +551,7 @@ QObject *QmlMetaType::create(const QByteArray &name)
lock.unlock();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->create();
else
return 0;
@@ -563,7 +563,7 @@ QVariant QmlMetaType::fromObject(QObject *obj, int typeId)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(typeId);
- if(type && type->typeId() == typeId)
+ if (type && type->typeId() == typeId)
return type->fromObject(obj);
else
return QVariant();
@@ -575,7 +575,7 @@ const QMetaObject *QmlMetaType::rawMetaObjectForType(int id)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->typeId() == id)
+ if (type && type->typeId() == id)
return type->baseMetaObject();
else
return 0;
@@ -587,7 +587,7 @@ const QMetaObject *QmlMetaType::rawMetaObjectForType(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->baseMetaObject();
else
return 0;
@@ -600,7 +600,7 @@ const QMetaObject *QmlMetaType::metaObjectForType(int id)
QmlType *type = data->idToType.value(id);
lock.unlock();
- if(type && type->typeId() == id)
+ if (type && type->typeId() == id)
return type->metaObject();
else
return 0;
@@ -613,7 +613,7 @@ const QMetaObject *QmlMetaType::metaObjectForType(const QByteArray &name)
QmlType *type = data->nameToType.value(name);
lock.unlock();
- if(type)
+ if (type)
return type->metaObject();
else
return 0;
@@ -625,7 +625,7 @@ int QmlMetaType::type(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->typeId();
else
return 0;
@@ -637,7 +637,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type && type->attachedPropertiesFunction())
+ if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
@@ -649,7 +649,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->metaObjectToType.value(mo);
- if(type && type->attachedPropertiesFunction())
+ if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
@@ -657,7 +657,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
QmlAttachedPropertiesFunc QmlMetaType::attachedPropertiesFuncById(int id)
{
- if(id < 0)
+ if (id < 0)
return 0;
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
@@ -670,7 +670,7 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->attachedPropertiesFunction();
else
return 0;
@@ -679,15 +679,15 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name)
QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultProperty");
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
QMetaClassInfo info = metaObject->classInfo(idx);
- if(!info.value())
+ if (!info.value())
return QMetaProperty();
idx = metaObject->indexOfProperty(info.value());
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
return metaObject->property(idx);
@@ -695,7 +695,7 @@ QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QMetaProperty();
const QMetaObject *metaObject = obj->metaObject();
@@ -705,15 +705,15 @@ QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultMethod");
- if(-1 == idx)
+ if (-1 == idx)
return QMetaMethod();
QMetaClassInfo info = metaObject->classInfo(idx);
- if(!info.value())
+ if (!info.value())
return QMetaMethod();
idx = metaObject->indexOfMethod(info.value());
- if(-1 == idx)
+ if (-1 == idx)
return QMetaMethod();
return metaObject->method(idx);
@@ -721,7 +721,7 @@ QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
QMetaMethod QmlMetaType::defaultMethod(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QMetaMethod();
const QMetaObject *metaObject = obj->metaObject();
@@ -739,13 +739,13 @@ QMetaProperty QmlMetaType::property(QObject *obj, const QByteArray &bname)
*/
QMetaProperty QmlMetaType::property(QObject *obj, const char *name)
{
- if(!obj)
+ if (!obj)
return QMetaProperty();
const QMetaObject *metaObject = obj->metaObject();
int idx = metaObject->indexOfProperty(name);
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
return metaObject->property(idx);
@@ -771,7 +771,7 @@ const char *QmlMetaType::interfaceIId(int userType)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->isInterface() && type->typeId() == userType)
+ if (type && type->isInterface() && type->typeId() == userType)
return type->interfaceIId();
else
return 0;
@@ -780,7 +780,7 @@ const char *QmlMetaType::interfaceIId(int userType)
bool QmlMetaType::isObject(const QMetaObject *mo)
{
while(mo) {
- if(mo == &QObject::staticMetaObject)
+ if (mo == &QObject::staticMetaObject)
return true;
mo = mo->superClass();
}
@@ -815,7 +815,7 @@ int QmlMetaType::listCount(const QVariant &v)
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType)
+ if (type && type->qListTypeId() == userType)
return type->listCount(v);
else
return 0;
@@ -830,7 +830,7 @@ QVariant QmlMetaType::listAt(const QVariant &v, int idx)
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType)
+ if (type && type->qListTypeId() == userType)
return type->listAt(v, idx);
else
return 0;
@@ -856,7 +856,7 @@ void QmlMetaType::registerCustomStringConverter(int type, StringConverter conver
QWriteLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
- if(data->stringConverters.contains(type))
+ if (data->stringConverters.contains(type))
return;
data->stringConverters.insert(type, converter);
}
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index c17d47f..83fb60b 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -199,7 +199,7 @@ int qmlRegisterExtendedType(const char *typeName)
QmlAttachedPropertiesFunc attached =
QmlPrivate::attachedPropertiesFunc<E>();
- if(!attached)
+ if (!attached)
attached = QmlPrivate::attachedPropertiesFunc<T>();
return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0,
@@ -221,7 +221,7 @@ int qmlRegisterExtendedType(const char *qmlName, const char *typeName)
QmlAttachedPropertiesFunc attached =
QmlPrivate::attachedPropertiesFunc<E>();
- if(!attached)
+ if (!attached)
attached = QmlPrivate::attachedPropertiesFunc<T>();
return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>,
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index 1dd0d4e..ecb6f0b 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -70,16 +70,16 @@ QmlParser::Object::Object()
QmlParser::Object::~Object()
{
- if(defaultProperty) defaultProperty->release();
+ if (defaultProperty) defaultProperty->release();
foreach(Property *prop, properties)
prop->release();
- if(dynamicPropertiesProperty) dynamicPropertiesProperty->release();
- if(dynamicSignalsProperty) dynamicSignalsProperty->release();
+ if (dynamicPropertiesProperty) dynamicPropertiesProperty->release();
+ if (dynamicSignalsProperty) dynamicSignalsProperty->release();
}
const QMetaObject *Object::metaObject() const
{
- if(extObject && metatype)
+ if (extObject && metatype)
return extObject;
else
return metatype;
@@ -87,15 +87,15 @@ const QMetaObject *Object::metaObject() const
QmlParser::Property *Object::getDefaultProperty()
{
- if(!defaultProperty)
+ if (!defaultProperty)
defaultProperty = new Property;
return defaultProperty;
}
Property *QmlParser::Object::getProperty(const QByteArray &name, bool create)
{
- if(!properties.contains(name)) {
- if(create)
+ if (!properties.contains(name)) {
+ if (create)
properties.insert(name, new Property(name));
else
return 0;
@@ -140,12 +140,12 @@ QmlParser::Property::~Property()
{
foreach(Value *value, values)
value->release();
- if(value) value->release();
+ if (value) value->release();
}
Object *QmlParser::Property::getValue()
{
- if(!value) value = new Object;
+ if (!value) value = new Object;
return value;
}
@@ -167,7 +167,7 @@ QmlParser::Value::Value()
QmlParser::Value::~Value()
{
- if(object) object->release();
+ if (object) object->release();
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index 183f42b..590e0c0 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -221,7 +221,7 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val,
const QVariant &value,
void **out)
{
- if(op == QmlPrivate::Create) {
+ if (op == QmlPrivate::Create) {
QObject *obj = static_cast<QObject *>(new T);
*((QObject **)out) = obj;
return 0;
@@ -256,7 +256,7 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val,
{
QObject *fromObj = value.value<QObject *>();
T *me = qobject_cast<T *>(fromObj);
- if(me) {
+ if (me) {
*((QVariant *)*out) = QVariant::fromValue(me);
}
}
@@ -304,7 +304,7 @@ int QmlPrivate::list_nocreate_op(QmlPrivate::ListOp op, int val,
{
QObject *fromObj = value.value<QObject *>();
T *me = qobject_cast<T *>(fromObj);
- if(me) {
+ if (me) {
*((QVariant *)*out) = QVariant::fromValue(me);
}
}
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 3b9f6ca..d24c5c4 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -53,7 +53,7 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
*static_cast<QMetaObject *>(this) = *metaObjects->last().metaObject;
QObjectPrivate *op = QObjectPrivate::get(obj);
- if(op->metaObject)
+ if (op->metaObject)
parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
op->metaObject = this;
@@ -69,31 +69,31 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
QmlProxyMetaObject::~QmlProxyMetaObject()
{
- if(parent)
+ if (parent)
delete parent;
parent = 0;
- if(proxies)
+ if (proxies)
delete [] proxies;
proxies = 0;
}
int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if((c == QMetaObject::ReadProperty ||
+ if ((c == QMetaObject::ReadProperty ||
c == QMetaObject::WriteProperty) &&
id >= metaObjects->last().propertyOffset) {
- for(int ii = 0; ii < metaObjects->count(); ++ii) {
+ for (int ii = 0; ii < metaObjects->count(); ++ii) {
const ProxyData &data = metaObjects->at(ii);
- if(id >= data.propertyOffset) {
- if(!proxies) {
+ if (id >= data.propertyOffset) {
+ if (!proxies) {
proxies = new QObject*[metaObjects->count()];
::memset(proxies, 0,
sizeof(QObject *) * metaObjects->count());
}
- if(!proxies[ii])
+ if (!proxies[ii])
proxies[ii] = data.createFunc(object);
int proxyOffset = proxies[ii]->metaObject()->propertyOffset();
@@ -104,7 +104,7 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- if(parent)
+ if (parent)
return parent->metaCall(c, id, a);
else
return object->qt_metacall(c, id, a);
diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qmlrefcount.cpp
index 4e47ee1..8f71f1b 100644
--- a/src/declarative/qml/qmlrefcount.cpp
+++ b/src/declarative/qml/qmlrefcount.cpp
@@ -60,7 +60,7 @@ void QmlRefCount::release()
{
Q_ASSERT(refCount > 0);
--refCount;
- if(refCount == 0)
+ if (refCount == 0)
delete this;
}
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index 4e0c283..317a3bf 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -247,7 +247,7 @@ Object *ProcessAST::defineObjectBinding_helper(int line,
Value *v = new Value;
v->object = obj;
v->line = line;
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -403,7 +403,7 @@ QString ProcessAST::getPrimitive(const QByteArray &propertyName, AST::Expression
{
QString primitive;
- if(isSignalProperty(propertyName)) {
+ if (isSignalProperty(propertyName)) {
primitive = asString(expr);
} else if (propertyName == "id" && expr && expr->kind == AST::Node::Kind_IdentifierExpression) {
primitive = asString(expr);
@@ -593,7 +593,7 @@ Object *QmlScriptParser::tree() const
void QmlScriptParser::clear()
{
- if(root) {
+ if (root) {
root->release();
root = 0;
}
diff --git a/src/declarative/qml/qmlstringconverters.cpp b/src/declarative/qml/qmlstringconverters.cpp
index 82d6eee..c1f4b8c 100644
--- a/src/declarative/qml/qmlstringconverters.cpp
+++ b/src/declarative/qml/qmlstringconverters.cpp
@@ -51,18 +51,18 @@ QT_BEGIN_NAMESPACE
static uchar fromHex(const uchar c, const uchar c2)
{
uchar rv = 0;
- if(c >= '0' && c <= '9')
+ if (c >= '0' && c <= '9')
rv += (c - '0') * 16;
- else if(c >= 'A' && c <= 'F')
+ else if (c >= 'A' && c <= 'F')
rv += (c - 'A' + 10) * 16;
- else if(c >= 'a' && c <= 'f')
+ else if (c >= 'a' && c <= 'f')
rv += (c - 'a' + 10) * 16;
- if(c2 >= '0' && c2 <= '9')
+ if (c2 >= '0' && c2 <= '9')
rv += (c2 - '0');
- else if(c2 >= 'A' && c2 <= 'F')
+ else if (c2 >= 'A' && c2 <= 'F')
rv += (c2 - 'A' + 10);
- else if(c2 >= 'a' && c2 <= 'f')
+ else if (c2 >= 'a' && c2 <= 'f')
rv += (c2 - 'a' + 10);
return rv;
@@ -77,41 +77,41 @@ static uchar fromHex(const QString &s, int idx)
QVariant QmlStringConverters::variantFromString(const QString &s)
{
- if(s.isEmpty())
+ if (s.isEmpty())
return QVariant(s);
- if(s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) {
+ if (s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) {
QString data = s.mid(1, s.length() - 2);
return QVariant(data);
}
bool ok = false;
QRectF r = rectFFromString(s, &ok);
- if(ok) return QVariant(r);
+ if (ok) return QVariant(r);
QColor c = colorFromString(s, &ok);
- if(ok) return QVariant(c);
+ if (ok) return QVariant(c);
QPointF p = pointFFromString(s, &ok);
- if(ok) return QVariant(p);
+ if (ok) return QVariant(p);
QSizeF sz = sizeFFromString(s, &ok);
- if(ok) return QVariant(sz);
+ if (ok) return QVariant(sz);
bool b = boolFromString(s, &ok);
- if(ok) return QVariant(b);
+ if (ok) return QVariant(b);
return QVariant(s);
}
QColor QmlStringConverters::colorFromString(const QString &s, bool *ok)
{
- if(s.startsWith(QLatin1Char('#')) && s.length() == 9) {
+ if (s.startsWith(QLatin1Char('#')) && s.length() == 9) {
uchar a = fromHex(s, 1);
uchar r = fromHex(s, 3);
uchar g = fromHex(s, 5);
uchar b = fromHex(s, 7);
- if(ok) *ok = true;
+ if (ok) *ok = true;
return QColor(r, g, b, a);
} else {
QColor rv;
- if(s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower()))
+ if (s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower()))
rv = QColor(s);
- if(ok) *ok = rv.isValid();
+ if (ok) *ok = rv.isValid();
return rv;
}
}
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 62a0864..253e9a7 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -224,13 +224,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QStack<QmlMetaProperty> pushedProperties;
QObject **savedObjects = 0;
- if(start == -1) start = 0;
- if(count == -1) count = comp->bytecode.count();
+ if (start == -1) start = 0;
+ if (count == -1) count = comp->bytecode.count();
- for(int ii = start; !isError() && ii < (start + count); ++ii) {
+ for (int ii = start; !isError() && ii < (start + count); ++ii) {
QmlInstruction &instr = comp->bytecode[ii];
- if(instr.type >= QmlInstruction::StoreInstructionsStart &&
+ if (instr.type >= QmlInstruction::StoreInstructionsStart &&
instr.type <= QmlInstruction::StoreInstructionsEnd) {
runStoreInstruction(stack, instr, comp);
@@ -240,7 +240,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
switch(instr.type) {
case QmlInstruction::Init:
{
- if(instr.init.dataSize) {
+ if (instr.init.dataSize) {
savedObjects = new QObject*[instr.init.dataSize];
::memset(savedObjects, 0,
sizeof(QObject *)*instr.init.dataSize);
@@ -254,10 +254,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QFxCompilerTimer<QFxCompiler::InstrCreateObject> cc;
#endif
QObject *o = types.at(instr.create.type).createInstance(QmlContext::activeContext());
- if(!o)
+ if (!o)
VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className);
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
}
@@ -274,11 +274,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
types.at(instr.createCustom.type).parser->create(datas.at(instr.createCustom.data));
// XXX
QObject *o = QmlMetaType::toQObject(v);
- if(!o)
+ if (!o)
VME_EXCEPTION("Unable to create" << types.at(instr.create.type).className);
QmlEngine::setContextForObject(o, QmlContext::activeContext());
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
}
@@ -296,7 +296,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlContext::activeContext();
ctxt->setContextProperty(primitives.at(instr.setId.value), target);
- if(instr.setId.save != -1)
+ if (instr.setId.save != -1)
savedObjects[instr.setId.save] = target;
}
break;
@@ -365,14 +365,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QByteArray &pr = datas.at(sigIdx);
QmlMetaProperty prop(target, QLatin1String(pr));
- if(prop.type() & QmlMetaProperty::SignalProperty) {
+ if (prop.type() & QmlMetaProperty::SignalProperty) {
int coreIdx = prop.coreIndex();
int primRef = instr.assignSignal.value;
instr.type = QmlInstruction::StoreSignal;
instr.storeSignal.signalIndex = coreIdx;
instr.storeSignal.value = primRef;
--ii;
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
int prop = sigIdx;
int primRef = instr.assignSignal.value;
instr.type = QmlInstruction::AssignConstant;
@@ -398,18 +398,18 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QByteArray &pr = datas.at(sigIdx);
QmlMetaProperty prop(target, QLatin1String(pr));
- if(prop.type() & QmlMetaProperty::SignalProperty) {
+ if (prop.type() & QmlMetaProperty::SignalProperty) {
QMetaMethod method = QmlMetaType::defaultMethod(assign);
- if(method.signature() == 0)
+ if (method.signature() == 0)
VME_EXCEPTION("Cannot assign object type" << assign->metaObject()->className() << "with no default method");
- if(!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
+ if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
VME_EXCEPTION("Cannot connect mismatched signal/slot" << method.signature() << prop.method().signature());
QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex());
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
instr.type = QmlInstruction::AssignObject;
instr.assignObject.castValue = 0;
instr.assignObject.property = sigIdx;
@@ -432,7 +432,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QMetaMethod signal =
target->metaObject()->method(instr.storeSignal.signalIndex);
- if(signal.parameterTypes().isEmpty()) {
+ if (signal.parameterTypes().isEmpty()) {
(void *)new QmlBoundSignal(QmlContext::activeContext(), primitives.at(instr.storeSignal.value), target, instr.storeSignal.signalIndex, target);
} else {
(void *)new QmlBoundSignalProxy(new QmlContext(QmlContext::activeContext(), target), primitives.at(instr.storeSignal.value), target, instr.storeSignal.signalIndex, target);
@@ -450,9 +450,9 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int propIdx = instr.assignConstant.property;
int idx = instr.assignConstant.constant;
QByteArray pr;
- if(propIdx == -1) {
+ if (propIdx == -1) {
pr = QmlMetaType::defaultProperty(target).name();
- if(pr.isEmpty())
+ if (pr.isEmpty())
VME_EXCEPTION("Cannot resolve defalt property on type" << target->metaObject()->className());
} else {
pr = datas.at(propIdx);
@@ -460,14 +460,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int coreIdx = qIndexOfProperty(target, pr);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
QMetaProperty prop =
target->metaObject()->property(coreIdx);
bool replace = !prop.isDynamic();
QmlInstruction *writeInstr = 0;
QmlInstruction dummy;
- if(replace) {
+ if (replace) {
writeInstr = &instr;
} else {
writeInstr = &dummy;
@@ -476,8 +476,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlCompiler::StoreInstructionResult r = QmlCompiler::generateStoreInstruction(*comp, *writeInstr, prop,
coreIdx, idx, &primitives.at(idx));
- if(r != QmlCompiler::Ok) {
- if(prop.isEnumType()){
+ if (r != QmlCompiler::Ok) {
+ if (prop.isEnumType()){
VME_EXCEPTION(primitives.at(idx) << "is not a valid enumeration value");
} else if (r == QmlCompiler::UnknownType) {
VME_EXCEPTION("Property" << prop.name() << "is of an unknown type");
@@ -507,7 +507,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlParserStatus *status =
qobject_cast<QmlParserStatus *>(target);
- if(status) {
+ if (status) {
instr.type = QmlInstruction::BeginObject;
instr.begin.castValue = int(reinterpret_cast<char *>(status) - reinterpret_cast<char *>(target));
--ii;
@@ -538,7 +538,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlParserStatus *status =
qobject_cast<QmlParserStatus *>(target);
- if(status) {
+ if (status) {
instr.type = QmlInstruction::CompleteObject;
instr.complete.castValue = int(reinterpret_cast<char *>(status) - reinterpret_cast<char *>(target));
--ii;
@@ -570,10 +570,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int idx = qIndexOfProperty(target, pr);
// XXX - need to check if the type is QmlBindableValue*
- if(idx == -1) {
+ if (idx == -1) {
VME_EXCEPTION("Unknown property" << pr);
} else {
- if(QmlInstruction::AssignCompiledBinding == instr.type)
+ if (QmlInstruction::AssignCompiledBinding == instr.type)
instr.type = QmlInstruction::StoreCompiledBinding;
else
instr.type = QmlInstruction::StoreBinding;
@@ -589,16 +589,16 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.at(stack.count() - 2);
int propIdx = instr.assignValueSource.property;
QByteArray pr;
- if(propIdx == -1) {
+ if (propIdx == -1) {
pr = QmlMetaType::defaultProperty(target).name();
- if(pr.isEmpty())
+ if (pr.isEmpty())
VME_EXCEPTION("Unable to resolve default property");
} else {
pr = datas.at(propIdx);
}
int coreIdx = qIndexOfProperty(target, pr);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
instr.type = QmlInstruction::StoreValueSource;
instr.assignValueSource.property = coreIdx;
ii--;
@@ -685,18 +685,18 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
#endif
QObject *assign = stack.pop();
const ListInstance &list = qliststack.top();
- if(list.qmlListInterface) {
+ if (list.qmlListInterface) {
int type = list.type;
void *d = 0;
void *ptr = 0;
bool found = false;
- if(QmlMetaType::isInterface(type)) {
+ if (QmlMetaType::isInterface(type)) {
const char *iid = QmlMetaType::interfaceIId(type);
- if(iid)
+ if (iid)
ptr = assign->qt_metacast(iid);
- if(ptr) {
+ if (ptr) {
d = &ptr;
found = true;
}
@@ -706,7 +706,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QMetaObject *assignMo = assign->metaObject();
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
@@ -718,7 +718,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Cannot assign object to list");
list.qmlListInterface->append(d);
@@ -726,10 +726,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
} else {
int type = list.type;
- if(QmlMetaType::isInterface(type)) {
+ if (QmlMetaType::isInterface(type)) {
void *ptr = 0;
const char *iid = QmlMetaType::interfaceIId(type);
- if(iid)
+ if (iid)
ptr = assign->qt_metacast(iid);
QVariant v(list.type, &ptr);
QmlMetaType::append(list.list, v);
@@ -750,7 +750,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
QByteArray property;
- if(instr.assignObject.property == -1) {
+ if (instr.assignObject.property == -1) {
// XXX - optimize!
property =
QmlMetaType::defaultProperty(target).name();
@@ -760,17 +760,17 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int coreIdx = qIndexOfProperty(target, property);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
QMetaProperty prop =
target->metaObject()->property(coreIdx);
int t = prop.userType();
// XXX - optimize!
- if(QmlMetaType::isList(t)) {
+ if (QmlMetaType::isList(t)) {
QVariant list = prop.read(target);
int listtype = QmlMetaType::listType(t);
QVariant v = QmlMetaType::fromObject(assign, listtype);
QmlMetaType::append(list, v);
- } else if(QmlMetaType::isQmlList(t)) {
+ } else if (QmlMetaType::isQmlList(t)) {
// XXX - optimize!
QVariant list = prop.read(target);
@@ -785,13 +785,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QMetaObject *assignMo = assign->metaObject();
bool found = false;
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Cannot assign object to list");
// NOTE: This assumes a cast to QObject does not alter
@@ -799,12 +799,12 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
void *d = (void *)&assign;
li->append(d);
- } else if(QmlMetaType::isInterface(t)) {
+ } else if (QmlMetaType::isInterface(t)) {
const char *iid = QmlMetaType::interfaceIId(t);
bool ok = false;
- if(iid) {
+ if (iid) {
void *ptr = assign->qt_metacast(iid);
- if(ptr) {
+ if (ptr) {
void *a[1];
a[0] = &ptr;
QMetaObject::metacall(target, QMetaObject::WriteProperty,
@@ -813,10 +813,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
}
- if(!ok)
+ if (!ok)
VME_EXCEPTION("Cannot assign object to interface property" << property);
- } else if(prop.userType() == -1 /* means qvariant */) {
+ } else if (prop.userType() == -1 /* means qvariant */) {
prop.write(target, qVariantFromValue(assign));
} else {
const QMetaObject *propmo =
@@ -831,11 +831,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
c = c->superClass();
}
- if(isAssignable) {
+ if (isAssignable) {
// XXX - optimize!
QVariant v = QmlMetaType::fromObject(assign, t);
prop.write(target, v);
- } else if(isPropertyValue) {
+ } else if (isPropertyValue) {
QmlPropertyValueSource *vs =
static_cast<QmlPropertyValueSource *>(assign);
vs->setParent(target);
@@ -862,7 +862,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
- if(!qmlObject)
+ if (!qmlObject)
VME_EXCEPTION("Unable to create attached object");
stack.push(qmlObject);
@@ -883,7 +883,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
a[0] = &list;
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
- if(!list)
+ if (!list)
VME_EXCEPTION("Cannot assign to null list");
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
@@ -911,14 +911,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
const QByteArray &pr = datas.at(instr.fetch.property);
int idx = qIndexOfProperty(target, pr);
- if(idx == -1)
+ if (idx == -1)
VME_EXCEPTION("Cannot resolve property" << pr);
QMetaProperty prop = target->metaObject()->property(idx);
instr.type = QmlInstruction::FetchObject;
instr.fetch.property = idx;
- if(QmlMetaType::isObject(prop.userType())) {
+ if (QmlMetaType::isObject(prop.userType())) {
instr.fetch.isObject = true;
- } else if(prop.userType() == -1) {
+ } else if (prop.userType() == -1) {
instr.fetch.isObject = false;
} else {
VME_EXCEPTION("Cannot set properties on" << prop.name() << "as it is of unknown type");
@@ -935,7 +935,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
QObject *obj = 0;
- if(instr.fetch.isObject) {
+ if (instr.fetch.isObject) {
// NOTE: This assumes a cast to QObject does not alter the
// object pointer
void *a[1];
@@ -952,7 +952,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
- if(!obj)
+ if (!obj)
VME_EXCEPTION("Cannot set properties on" << target->metaObject()->property(instr.fetch.property).name() << "as it is null");
stack.push(obj);
@@ -994,13 +994,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
bool found = false;
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Unable to assign object");
instr.type = QmlInstruction::StoreStackObject;
@@ -1042,8 +1042,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
}
- if(isError()) {
- if(!stack.isEmpty()) {
+ if (isError()) {
+ if (!stack.isEmpty()) {
delete stack.at(0);
}
return 0;
@@ -1055,10 +1055,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
comp->dumpPost();
- if(savedObjects)
+ if (savedObjects)
delete [] savedObjects;
- if(stack.isEmpty())
+ if (stack.isEmpty())
return 0;
else
return stack.top();
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 2b1060b..f7d2635 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -52,7 +52,7 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QmlRefCount *rc)
: object(obj), ref(rc)
{
- if(ref)
+ if (ref)
ref->addref();
*static_cast<QMetaObject *>(this) = *other;
@@ -64,9 +64,9 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
data = new QVariant[propertyCount() - baseProp];
vTypes.resize(propertyCount() - baseProp);
- for(int ii = baseProp; ii < propertyCount(); ++ii) {
+ for (int ii = baseProp; ii < propertyCount(); ++ii) {
QMetaProperty prop = property(ii);
- if((int)prop.type() != -1) {
+ if ((int)prop.type() != -1) {
data[ii - baseProp] = QVariant((QVariant::Type)prop.userType());
} else {
vTypes.setBit(ii - baseProp, true);
@@ -76,27 +76,27 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QmlVMEMetaObject::~QmlVMEMetaObject()
{
- if(ref)
+ if (ref)
ref->release();
delete [] data;
}
int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(id >= baseProp) {
+ if (id >= baseProp) {
int propId = id - baseProp;
bool needActivate = false;
- if(vTypes.testBit(propId)) {
- if(c == QMetaObject::ReadProperty) {
+ if (vTypes.testBit(propId)) {
+ if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = data[propId];
- } else if(c == QMetaObject::WriteProperty) {
+ } else if (c == QMetaObject::WriteProperty) {
needActivate =
(data[propId] != *reinterpret_cast<QVariant *>(a[0]));
data[propId] = *reinterpret_cast<QVariant *>(a[0]);
}
} else {
- if(c == QMetaObject::ReadProperty) {
+ if (c == QMetaObject::ReadProperty) {
switch(data[propId].type()) {
case QVariant::Int:
*reinterpret_cast<int *>(a[0]) = data[propId].toInt();
@@ -120,7 +120,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
qFatal("Unknown type");
break;
}
- } else if(c == QMetaObject::WriteProperty) {
+ } else if (c == QMetaObject::WriteProperty) {
QVariant value = QVariant((QVariant::Type)data[propId].type(), a[0]);
needActivate = (data[propId] != value);
@@ -128,7 +128,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- if(c == QMetaObject::WriteProperty && needActivate) {
+ if (c == QMetaObject::WriteProperty && needActivate) {
activate(object, baseSig + propId, 0);
}
diff --git a/src/declarative/qml/qmlxmlparser.cpp b/src/declarative/qml/qmlxmlparser.cpp
index 0af9115..b3565a0 100644
--- a/src/declarative/qml/qmlxmlparser.cpp
+++ b/src/declarative/qml/qmlxmlparser.cpp
@@ -70,7 +70,7 @@ struct QmlXmlParserStateStack : public QStack<QmlXmlParserState>
void pushProperty(const QString &name, int lineNumber)
{
const QmlXmlParserState &state = top();
- if(state.property) {
+ if (state.property) {
QmlXmlParserState s(state.property->getValue(),
state.property->getValue()->getProperty(name.toLatin1()));
s.property->line = lineNumber;
@@ -86,7 +86,7 @@ struct QmlXmlParserStateStack : public QStack<QmlXmlParserState>
QmlXmlParser::~QmlXmlParser()
{
- if(root)
+ if (root)
root->release();
}
@@ -189,7 +189,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
if (isType) {
// Class
int typeId = _typeNames.indexOf(qualifiedname);
- if(typeId == -1) {
+ if (typeId == -1) {
typeId = _typeNames.count();
_typeNames.append(qualifiedname);
}
@@ -214,7 +214,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
}
- if(!root) {
+ if (!root) {
root = obj;
states.pushObject(obj);
} else {
@@ -222,7 +222,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
Value *v = new Value;
v->object = obj;
v->line = line;
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -235,7 +235,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
break;
}
QStringList str = name.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii) {
+ for (int ii = 0; ii < str.count(); ++ii) {
QString s = str.at(ii);
states.pushProperty(s, line);
}
@@ -253,7 +253,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
foreach(QXmlStreamAttribute attr, attrs) {
QStringList str = attr.name().toString().split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii) {
+ for (int ii = 0; ii < str.count(); ++ii) {
QString s = str.at(ii);
states.pushProperty(s, line);
}
@@ -264,7 +264,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
v->line = reader.lineNumber();
state.property->addValue(v);
- for(int ii = str.count() - 1; ii >= 0; --ii)
+ for (int ii = str.count() - 1; ii >= 0; --ii)
states.pop();
}
}
@@ -280,24 +280,24 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
{
QString name = reader.name().toString();
Q_ASSERT(!name.isEmpty());
- if(name.at(0).isUpper() && !name.contains(QLatin1Char('.'))) {
+ if (name.at(0).isUpper() && !name.contains(QLatin1Char('.'))) {
// Class
states.pop();
} else {
// Property
QStringList str = name.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii)
+ for (int ii = 0; ii < str.count(); ++ii)
states.pop();
}
}
break;
case QXmlStreamReader::Characters:
- if(!reader.isWhitespace()) {
+ if (!reader.isWhitespace()) {
const QmlXmlParserState &state = states.top();
Value *v = new Value;
v->primitive = reader.text().toString();
v->line = reader.lineNumber();
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -309,11 +309,11 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
case QXmlStreamReader::EntityReference:
break;
case QXmlStreamReader::ProcessingInstruction:
- if(reader.processingInstructionTarget() == QLatin1String("qtfx")) {
+ if (reader.processingInstructionTarget() == QLatin1String("qtfx")) {
QString str = reader.processingInstructionData().toString();
QString token, data;
int idx = str.indexOf(QLatin1Char(':'));
- if(-1 != idx) {
+ if (-1 != idx) {
token = str.left(idx);
data = str.mid(idx + 1);
} else {
@@ -324,7 +324,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
// <?qtfx namespacepath: namespace=path>
- if(token == QLatin1String("namespacepath")) {
+ if (token == QLatin1String("namespacepath")) {
int eq=data.indexOf(QLatin1Char('='));
if (eq>=0) {
_nameSpacePaths.insertMulti(data.left(eq),data.mid(eq+1));
@@ -338,7 +338,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
}
}
- if(reader.hasError()) {
+ if (reader.hasError()) {
if (root) {
root->release();
root = 0;
@@ -379,7 +379,7 @@ QString QmlXmlParser::errorDescription() const
void QmlXmlParser::clear()
{
- if(root) {
+ if (root) {
root->release();
root = 0;
}
diff --git a/src/declarative/qml/script/generator/main.cpp b/src/declarative/qml/script/generator/main.cpp
index 676671f..a841cbc 100644
--- a/src/declarative/qml/script/generator/main.cpp
+++ b/src/declarative/qml/script/generator/main.cpp
@@ -72,7 +72,7 @@ void newState(QList<State> &states, const char *token, const char *lexem)
while(*lexem) {
int next = states[state].next[(int)*lexem];
- if(!next) {
+ if (!next) {
next = states.size();
states += State(character?"CHARACTER":"INCOMPLETE");
states[state].next[(int)*lexem] = next;
@@ -89,7 +89,7 @@ void newState(QList<State> &states, const char *token, const char *lexem)
void newState(QList<State> &states, const char *token, char lexem)
{
int next = states[0].next[(int)lexem];
- if(!next) {
+ if (!next) {
next = states.size();
states += State(token);
states[0].next[(int)lexem] = next;
@@ -111,11 +111,11 @@ int main()
newState(states, "CHARACTER", '_');
// add digits
- for(int cc = '0'; cc <= '9'; ++cc)
+ for (int cc = '0'; cc <= '9'; ++cc)
newState(states, "DIGIT", cc);
// keywords
- for(int ii = 0; keywords[ii].lexem; ++ii)
+ for (int ii = 0; keywords[ii].lexem; ++ii)
newState(states, keywords[ii].token, keywords[ii].lexem);
::printf("static const struct\n{\n"
@@ -123,9 +123,9 @@ int main()
" char next[128];\n"
"} keywords[] = {\n");
- for(int ii = 0; ii < states.size(); ++ii) {
+ for (int ii = 0; ii < states.size(); ++ii) {
printf("%s { %s, { ", ii?",\n":"", states[ii].token.data());
- for(int jj = 0; jj < 128; jj++)
+ for (int jj = 0; jj < 128; jj++)
printf("%s%d", jj?",":"", states[ii].next[jj]);
printf(" } }");
}
diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp
index 4f40016..8b38e08 100644
--- a/src/declarative/qml/script/qmlbasicscript.cpp
+++ b/src/declarative/qml/script/qmlbasicscript.cpp
@@ -48,7 +48,7 @@ public:
static unsigned int alignRound(int s)
{
- if(s % 4)
+ if (s % 4)
s += 4 - (s % 4);
return s;
}
@@ -171,7 +171,7 @@ static QVariant fetch_value(QObject *o, int idx, int type)
break;
default:
{
- if(QmlMetaType::isObject(type)) {
+ if (QmlMetaType::isObject(type)) {
// NOTE: This assumes a cast to QObject does not alter the
// object pointer
QObject *val = 0;
@@ -180,7 +180,7 @@ static QVariant fetch_value(QObject *o, int idx, int type)
return QVariant::fromValue(val);
} else {
QVariant var = o->metaObject()->property(idx).read(o);
- if(QmlMetaType::isObject(var.userType())) {
+ if (QmlMetaType::isObject(var.userType())) {
QObject *obj = 0;
obj = *(QObject **)var.data();
var = QVariant::fromValue(obj);
@@ -299,7 +299,7 @@ QmlBasicScript::QmlBasicScript()
QmlBasicScript::QmlBasicScript(const char *data, QmlRefCount *owner)
: flags(0), d((QmlBasicScriptPrivate *)data), rc(owner)
{
- if(rc) rc->addref();
+ if (rc) rc->addref();
}
/*!
@@ -307,7 +307,7 @@ QmlBasicScript::QmlBasicScript(const char *data, QmlRefCount *owner)
*/
QByteArray QmlBasicScript::expression() const
{
- if(!d)
+ if (!d)
return QByteArray();
else
return QByteArray(d->expr());
@@ -318,9 +318,9 @@ QByteArray QmlBasicScript::expression() const
*/
QmlBasicScript::~QmlBasicScript()
{
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
- if(rc) rc->release();
+ if (rc) rc->release();
d = 0;
rc = 0;
}
@@ -331,9 +331,9 @@ QmlBasicScript::~QmlBasicScript()
*/
void QmlBasicScript::clear()
{
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
- if(rc) rc->release();
+ if (rc) rc->release();
d = 0;
rc = 0;
flags = 0;
@@ -345,7 +345,7 @@ void QmlBasicScript::clear()
*/
void *QmlBasicScript::newScriptState()
{
- if(!d) {
+ if (!d) {
return 0;
} else {
void *rv = ::malloc(d->stateSize * sizeof(QmlBasicScriptNodeCache));
@@ -359,7 +359,7 @@ void *QmlBasicScript::newScriptState()
*/
void QmlBasicScript::deleteScriptState(void *data)
{
- if(!data) return;
+ if (!data) return;
Q_ASSERT(d);
clearCache(data);
free(data);
@@ -370,12 +370,12 @@ void QmlBasicScript::deleteScriptState(void *data)
*/
void QmlBasicScript::dump()
{
- if(!d)
+ if (!d)
return;
qWarning() << d->instructionCount << "instructions:";
const char *data = d->data();
- for(int ii = 0; ii < d->instructionCount; ++ii) {
+ for (int ii = 0; ii < d->instructionCount; ++ii) {
const ScriptInstruction &instr = d->instructions()[ii];
switch(instr.type) {
@@ -438,7 +438,7 @@ bool QmlBasicScript::compile(const QByteArray &src)
*/
bool QmlBasicScript::compile(const char *src)
{
- if(!src) return false;
+ if (!src) return false;
QmlBasicScriptCompiler bsc;
bsc.script = this;
@@ -446,14 +446,14 @@ bool QmlBasicScript::compile(const char *src)
bsc.src = src;
// dumpTokens(src, bsc.tokens);
- if(d) {
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (d) {
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
d = 0;
flags = 0;
}
- if(bsc.compile()) {
+ if (bsc.compile()) {
int len = ::strlen(src);
flags = QmlBasicScriptPrivate::OwnData;
int size = sizeof(QmlBasicScriptPrivate) +
@@ -465,7 +465,7 @@ bool QmlBasicScript::compile(const char *src)
d->instructionCount = bsc.bytecode.count();
d->exprLen = len;
::memcpy((char *)d->expr(), src, len + 1);
- for(int ii = 0; ii < d->instructionCount; ++ii)
+ for (int ii = 0; ii < d->instructionCount; ++ii)
d->instructions()[ii] = bsc.bytecode.at(ii);
::memcpy((char *)d->data(), bsc.data.constData(), bsc.data.count());
}
@@ -481,21 +481,21 @@ void QmlBasicScriptCompiler::skipWhitespace()
bool QmlBasicScriptCompiler::compile()
{
- if(!compileExpr())
+ if (!compileExpr())
return false;
skipWhitespace();
- if(atEnd())
+ if (atEnd())
return true;
int t = token();
- if(t != AND)
+ if (t != AND)
return false;
adv();
skipWhitespace();
- if(!compileExpr())
+ if (!compileExpr())
return false;
ScriptInstruction instr;
@@ -513,12 +513,12 @@ bool QmlBasicScriptCompiler::compileExpr()
EXPRESSION := <NAME><OPERATOR>[<CONSTANT>|<NAME>]
*/
- if(!parseName())
+ if (!parseName())
return false;
skipWhitespace();
- if(atEnd())
+ if (atEnd())
return true;
int t = token();
@@ -539,7 +539,7 @@ bool QmlBasicScriptCompiler::compileExpr()
skipWhitespace();
- if(!parseConstant() &&
+ if (!parseConstant() &&
!parseName())
return false;
@@ -578,18 +578,18 @@ bool QmlBasicScriptCompiler::parseName()
bool pushed = false;
while(!atEnd()) {
int t = token();
- if(t == CHARACTER) {
+ if (t == CHARACTER) {
named = true;
seendot = false;
seenchar = true;
namestart = index();
adv();
- } else if(t == DIGIT) {
- if(!seenchar) break;
+ } else if (t == DIGIT) {
+ if (!seenchar) break;
adv();
- } else if(t == DOT) {
+ } else if (t == DOT) {
seendot = true;
- if(namestart == -1)
+ if (namestart == -1)
break;
seenchar = false;
@@ -598,7 +598,7 @@ bool QmlBasicScriptCompiler::parseName()
data.append(name);
data.append('\0');
ScriptInstruction instr;
- if(pushed)
+ if (pushed)
instr.type = ScriptInstruction::Fetch;
else
instr.type = ScriptInstruction::Load;
@@ -613,13 +613,13 @@ bool QmlBasicScriptCompiler::parseName()
}
}
- if(namestart != -1) {
+ if (namestart != -1) {
QByteArray name = string(namestart, index() - 1);
int nref = data.count();
data.append(name);
data.append('\0');
ScriptInstruction instr;
- if(pushed)
+ if (pushed)
instr.type = ScriptInstruction::Fetch;
else
instr.type = ScriptInstruction::Load;
@@ -629,7 +629,7 @@ bool QmlBasicScriptCompiler::parseName()
++stateSize;
}
- if(seendot)
+ if (seendot)
return false;
else
return named;
@@ -688,7 +688,7 @@ int QmlBasicScriptCompiler::index() const
QByteArray QmlBasicScriptCompiler::string(int from, int to)
{
QByteArray rv;
- for(int ii = from; ii <= to; ++ii) {
+ for (int ii = from; ii <= to; ++ii) {
const LexerToken &token = tokens.at(ii);
rv.append(QByteArray(src + token.start, token.end - token.start + 1));
}
@@ -703,8 +703,8 @@ void QmlBasicScript::clearCache(void *voidCache)
QmlBasicScriptNodeCache *dataCache =
reinterpret_cast<QmlBasicScriptNodeCache *>(voidCache);
- for(int ii = 0; ii < d->stateSize; ++ii) {
- if(!dataCache[ii].isCore() && !dataCache[ii].isExplicit() &&
+ for (int ii = 0; ii < d->stateSize; ++ii) {
+ if (!dataCache[ii].isCore() && !dataCache[ii].isExplicit() &&
dataCache[ii].object) {
QMetaObject::removeGuard(&dataCache[ii].object);
dataCache[ii].object = 0;
@@ -715,9 +715,9 @@ void QmlBasicScript::clearCache(void *voidCache)
void QmlBasicScript::guard(QmlBasicScriptNodeCache &n)
{
- if(n.object) {
- if(n.isExplicit()) {
- } else if(n.isCore()) {
+ if (n.object) {
+ if (n.isExplicit()) {
+ } else if (n.isCore()) {
n.metaObject =
n.object->metaObject();
} else {
@@ -750,7 +750,7 @@ bool QmlBasicScript::valid(QmlBasicScriptNodeCache &n, QObject *obj)
*/
QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *cached)
{
- if(!isValid())
+ if (!isValid())
return QVariant();
QmlBasicScriptNodeCache *dataCache =
@@ -763,7 +763,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
const char *data = d->data();
- if(dataCache[0].type == QmlBasicScriptNodeCache::Invalid) {
+ if (dataCache[0].type == QmlBasicScriptNodeCache::Invalid) {
resetting = true;
hasReset = true;
}
@@ -771,7 +771,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState state = NoChange;
dataCacheItem = 0;
- for(int idx = 0; idx < d->instructionCount; ++idx) {
+ for (int idx = 0; idx < d->instructionCount; ++idx) {
const ScriptInstruction &instr = d->instructions()[idx];
switch(instr.type) {
@@ -781,9 +781,9 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
const char *id = data + instr.fetch.idx;
QmlBasicScriptNodeCache &n = dataCache[dataCacheItem];
- if(instr.type == ScriptInstruction::Load) {
+ if (instr.type == ScriptInstruction::Load) {
- if(n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid) {
context->engine()->d_func()->loadCache(n, QLatin1String(id), static_cast<QmlContextPrivate*>(context->d_ptr));
state = Incremental;
}
@@ -792,9 +792,9 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
QVariant o = stack.pop();
QObject *obj = qvariant_cast<QObject *>(o);
- if(!obj) {
- if(n.type == QmlBasicScriptNodeCache::Invalid) {
- if(scriptWarnings())
+ if (!obj) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (scriptWarnings())
qWarning() << "QmlBasicScript: Unable to convert" << o;
*cached = state;
return QVariant();
@@ -804,11 +804,11 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState dummy;
return run(context, voidCache, &dummy);
}
- } else if(n.type == QmlBasicScriptNodeCache::Invalid) {
+ } else if (n.type == QmlBasicScriptNodeCache::Invalid) {
context->engine()->d_func()->fetchCache(n, QLatin1String(id), obj);
guard(n);
state = Incremental;
- } else if(!valid(n, obj)) {
+ } else if (!valid(n, obj)) {
clearCache(dataCache);
*cached = Reset;
CacheState dummy;
@@ -875,7 +875,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
*cached = state;
- if(stack.isEmpty())
+ if (stack.isEmpty())
return QVariant();
else
return stack.top();
@@ -895,7 +895,7 @@ const char *QmlBasicScript::compileData() const
*/
unsigned int QmlBasicScript::compileDataSize() const
{
- if(d)
+ if (d)
return d->size;
else
return 0;
@@ -903,7 +903,7 @@ unsigned int QmlBasicScript::compileDataSize() const
bool QmlBasicScript::isSingleLoad() const
{
- if(!d)
+ if (!d)
return false;
return d->instructionCount == 1 &&
@@ -912,7 +912,7 @@ bool QmlBasicScript::isSingleLoad() const
QByteArray QmlBasicScript::singleLoadTarget() const
{
- if(!isSingleLoad())
+ if (!isSingleLoad())
return QByteArray();
// We know there is one instruction and it is a load
diff --git a/src/declarative/test/qfxtestengine.cpp b/src/declarative/test/qfxtestengine.cpp
index d9e3533..70e600d 100644
--- a/src/declarative/test/qfxtestengine.cpp
+++ b/src/declarative/test/qfxtestengine.cpp
@@ -110,15 +110,15 @@ public:
bool QFxTestEnginePrivate::compare(const QImage &img1, const QImage &img2)
{
- if(img1.size() != img2.size())
+ if (img1.size() != img2.size())
return false;
int errorCount = 0;
- for(int yy = 0; yy < img1.height(); ++yy) {
- for(int xx = 0; xx < img1.width(); ++xx) {
- if(img1.pixel(xx, yy) != img2.pixel(xx, yy)) {
+ for (int yy = 0; yy < img1.height(); ++yy) {
+ for (int xx = 0; xx < img1.width(); ++xx) {
+ if (img1.pixel(xx, yy) != img2.pixel(xx, yy)) {
errorCount++;
- if(errorCount > MAX_MISMATCHED_PIXELS)
+ if (errorCount > MAX_MISMATCHED_PIXELS)
return false;
}
}
@@ -138,13 +138,13 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir,
d->testDirectory = dir;
d->testMode = mode;
- if(d->testMode == RecordTest) {
+ if (d->testMode == RecordTest) {
qWarning("QFxTestEngine: Record ON");
- } else if(d->testMode == PlaybackTest) {
+ } else if (d->testMode == PlaybackTest) {
QString fileName(d->testDirectory + QLatin1String("/manifest.xml"));
QFile f(fileName);
- if(!f.open(QIODevice::ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
qWarning() << "QFxTestEngine: Unable to open file" << fileName;
return;
}
@@ -153,7 +153,7 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir,
QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.xml")));
QObject *o = c.create();
TestLog *log = qobject_cast<TestLog *>(o);
- if(log) {
+ if (log) {
log->setParent(this);
d->playbackTestData.actions() = log->actions();
qWarning("QFxTestEngine: Playback ON");
@@ -164,18 +164,18 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir,
}
}
- if(d->testMode != NoTest) {
+ if (d->testMode != NoTest) {
QUnifiedTimer::instance()->setConsistentTiming(true);
QObject::connect(canvas, SIGNAL(framePainted()),
this, SLOT(framePainted()));
canvas->installEventFilter(this);
- for(int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) {
+ for (int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) {
TestObject *o = d->playbackTestData.actions().at(ii);
- if(TestMouse *m = qobject_cast<TestMouse *>(o))
+ if (TestMouse *m = qobject_cast<TestMouse *>(o))
d->toPost << m;
- else if(TestKey *k = qobject_cast<TestKey *>(o))
+ else if (TestKey *k = qobject_cast<TestKey *>(o))
d->toPost << k;
}
}
@@ -190,7 +190,7 @@ void QFxTestEngine::framePainted()
{
QImage img = d->canvas->asImage();
- if(d->fullFrame) {
+ if (d->fullFrame) {
d->fullFrame = false;
d->recordFullFrameEvent(img);
} else {
@@ -207,11 +207,11 @@ void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img)
fullFrames << img;
testData.actions() << ff;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestFullFrame *pf = qobject_cast<TestFullFrame *>(playbackTestData.next());
QString filename = testDirectory + QLatin1String("/image") + QString::number(pf->frameId()) + QLatin1String(".png");
QImage recImg(filename);
- if(!pf || !compare(recImg, img) || pf->time() != QUnifiedTimer::instance()->elapsedTime()) {
+ if (!pf || !compare(recImg, img) || pf->time() != QUnifiedTimer::instance()->elapsedTime()) {
message(Fail, "FFrame mismatch");
} else {
message(Success, "FFrame OK");
@@ -226,11 +226,11 @@ static QByteArray toHex(uchar c)
QByteArray rv;
uint h = c / 16;
uint l = c % 16;
- if(h >= 10)
+ if (h >= 10)
rv.append(h - 10 + 'A');
else
rv.append(h + '0');
- if(l >= 10)
+ if (l >= 10)
rv.append(l - 10 + 'A');
else
rv.append(l + '0');
@@ -245,7 +245,7 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img)
QByteArray result = hash.result();
QByteArray hexResult;
- for(int ii = 0; ii < result.count(); ++ii)
+ for (int ii = 0; ii < result.count(); ++ii)
hexResult.append(toHex(result.at(ii)));
TestFrame *f = new TestFrame(q);
@@ -253,13 +253,13 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img)
f->setHash(QLatin1String(hexResult));
testData.actions() << f;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestObject *o = playbackTestData.next();
TestFrame *f = qobject_cast<TestFrame *>(o);
- if(!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
+ if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
f->hash() != QLatin1String(hexResult)) {
mismatchedFrames++;
- if(mismatchedFrames > MAX_MISMATCHED_FRAMES ||
+ if (mismatchedFrames > MAX_MISMATCHED_FRAMES ||
lastFrameMismatch)
message(Fail, "Frame mismatch");
else
@@ -276,23 +276,23 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img)
void QFxTestEnginePrivate::updateCurrentTime(int)
{
- if(status != Working)
+ if (status != Working)
return;
while(!toPost.isEmpty()) {
int t = QUnifiedTimer::instance()->elapsedTime();
TestObject *o = toPost.first();
- if(testMode == QFxTestEngine::RecordTest)
+ if (testMode == QFxTestEngine::RecordTest)
o->setTime(t);
- else if(o->time() != t)
+ else if (o->time() != t)
return;
toPost.takeFirst();
- if(TestMouse *m = qobject_cast<TestMouse *>(o)) {
+ if (TestMouse *m = qobject_cast<TestMouse *>(o)) {
QMouseEvent e((QEvent::Type)m->type(), m->pos(), m->globalPos(), (Qt::MouseButton)m->button(), (Qt::MouseButtons)m->buttons(), (Qt::KeyboardModifiers)0);
postedEvents.insert(&e);
QApplication::sendEvent(canvas, &e);
- } else if(TestKey *k = qobject_cast<TestKey *>(o)) {
+ } else if (TestKey *k = qobject_cast<TestKey *>(o)) {
QKeyEvent e((QEvent::Type)k->type(), k->key(), (Qt::KeyboardModifiers)k->modifiers(), k->text());
postedEvents.insert(&e);
QApplication::sendEvent(canvas, &e);
@@ -302,25 +302,25 @@ void QFxTestEnginePrivate::updateCurrentTime(int)
bool QFxTestEngine::eventFilter(QObject *, QEvent *event)
{
- if(d->status != QFxTestEnginePrivate::Working)
+ if (d->status != QFxTestEnginePrivate::Working)
return false;
- if(event->type() == QEvent::MouseButtonPress ||
+ if (event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::MouseButtonDblClick ||
event->type() == QEvent::MouseButtonRelease ||
event->type() == QEvent::MouseMove) {
- if(d->testMode == RecordTest && d->postedEvents.contains(event)) {
+ if (d->testMode == RecordTest && d->postedEvents.contains(event)) {
d->postedEvents.remove(event);
} else {
d->recordMouseEvent(static_cast<QMouseEvent *>(event));
return d->testMode == RecordTest;
}
- } else if(event->type() == QEvent::KeyPress ||
+ } else if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::KeyRelease) {
QKeyEvent *key = static_cast<QKeyEvent *>(event);
- if(key->key() < Qt::Key_F1 || key->key() > Qt::Key_F9) {
+ if (key->key() < Qt::Key_F1 || key->key() > Qt::Key_F9) {
- if(d->testMode == RecordTest && d->postedEvents.contains(event)) {
+ if (d->testMode == RecordTest && d->postedEvents.contains(event)) {
d->postedEvents.remove(event);
} else {
d->recordKeyEvent(key);
@@ -344,9 +344,9 @@ void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e)
m->setPos(e->pos());
testData.actions() << m;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestMouse *m = qobject_cast<TestMouse *>(playbackTestData.next());
- if(!m || m->time() != QUnifiedTimer::instance()->elapsedTime() ||
+ if (!m || m->time() != QUnifiedTimer::instance()->elapsedTime() ||
m->type() != e->type() ||
m->button() != e->button() ||
m->buttons() != e->buttons() ||
@@ -372,9 +372,9 @@ void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e)
k->setText(e->text());
k->setKey(e->key());
testData.actions() << k;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestKey *f = qobject_cast<TestKey *>(playbackTestData.next());
- if(!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
+ if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
f->type() != e->type() ||
f->modifiers() != e->QInputEvent::modifiers() ||
f->text() != e->text() ||
@@ -396,10 +396,10 @@ void QFxTestEngine::captureFullFrame()
void QFxTestEnginePrivate::message(MessageType t, const char *message)
{
- if(exitOnFail)
+ if (exitOnFail)
qWarning("%s", message);
- if(t == Fail) {
- if(exitOnFail) {
+ if (t == Fail) {
+ if (exitOnFail) {
save(QLatin1String("manifest-fail.xml"), false);
qFatal("Failed");
} else {
@@ -417,15 +417,15 @@ void QFxTestEnginePrivate::save(const QString &filename, bool images)
testData.save(&manifest);
manifest.close();
- if(images) {
- for(int ii = 0; ii < fullFrames.count(); ++ii)
+ if (images) {
+ for (int ii = 0; ii < fullFrames.count(); ++ii)
fullFrames.at(ii).save(testDirectory + QLatin1String("/image") + QString::number(ii) + QLatin1String(".png"));
}
}
void QFxTestEngine::save()
{
- if(d->testMode != RecordTest)
+ if (d->testMode != RecordTest)
return;
d->save(QLatin1String("manifest.xml"));
@@ -433,9 +433,9 @@ void QFxTestEngine::save()
void QFxTestEnginePrivate::testPass()
{
- if(playbackTestData.atEnd()) {
+ if (playbackTestData.atEnd()) {
qWarning("Test PASSED");
- if(exitOnFail) {
+ if (exitOnFail) {
save(QLatin1String("manifest-play.xml"));
exit(0);
} else {
diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp
index e93b9ed..be1ab07 100644
--- a/src/declarative/test/qfxtestobjects.cpp
+++ b/src/declarative/test/qfxtestobjects.cpp
@@ -71,7 +71,7 @@ int TestObject::time() const
void TestObject::setTime(int t)
{
- if(t == _time)
+ if (t == _time)
return;
_time = t;
emit dataChanged();
@@ -97,7 +97,7 @@ QString TestFrame::hash() const
void TestFrame::setHash(const QString &h)
{
- if(_hash == h)
+ if (_hash == h)
return;
_hash = h;
emit frameChanged();
@@ -123,7 +123,7 @@ int TestFullFrame::frameId() const
void TestFullFrame::setFrameId(int id)
{
- if(id == _frameId)
+ if (id == _frameId)
return;
_frameId = id;
emit frameChanged();
@@ -149,7 +149,7 @@ int TestMouse::type() const
void TestMouse::setType(int t)
{
- if(_type == t)
+ if (_type == t)
return;
_type = t;
emit mouseChanged();
@@ -162,7 +162,7 @@ int TestMouse::button() const
void TestMouse::setButton(int b)
{
- if(b == _button)
+ if (b == _button)
return;
_button = b;
emit mouseChanged();
@@ -175,7 +175,7 @@ int TestMouse::buttons() const
void TestMouse::setButtons(int buttons)
{
- if(_buttons == buttons)
+ if (_buttons == buttons)
return;
_buttons = buttons;
emit mouseChanged();
@@ -188,7 +188,7 @@ QPoint TestMouse::globalPos() const
void TestMouse::setGlobalPos(const QPoint &g)
{
- if(_globalPos == g)
+ if (_globalPos == g)
return;
_globalPos = g;
emit mouseChanged();
@@ -201,7 +201,7 @@ QPoint TestMouse::pos() const
void TestMouse::setPos(const QPoint &p)
{
- if(p == _pos)
+ if (p == _pos)
return;
_pos = p;
emit mouseChanged();
@@ -231,7 +231,7 @@ int TestKey::type() const
void TestKey::setType(int t)
{
- if(t == _type)
+ if (t == _type)
return;
_type = t;
emit keyChanged();
@@ -244,7 +244,7 @@ int TestKey::modifiers() const
void TestKey::setModifiers(int m)
{
- if(m == _modifiers)
+ if (m == _modifiers)
return;
_modifiers = m;
emit keyChanged();
@@ -257,7 +257,7 @@ QString TestKey::text() const
void TestKey::setText(const QString &t)
{
- if(_text == t)
+ if (_text == t)
return;
_text = t;
emit keyChanged();
@@ -270,7 +270,7 @@ int TestKey::key() const
void TestKey::setKey(int k)
{
- if(_key == k)
+ if (_key == k)
return;
_key = k;
emit keyChanged();
@@ -283,7 +283,7 @@ void TestKey::save(QXmlStreamWriter *device)
device->writeAttribute(QLatin1String("type"), QString::number(type()));
device->writeAttribute(QLatin1String("modifiers"), QString::number(modifiers()));
device->writeAttribute(QLatin1String("key"), QString::number(key()));
- if(key() != Qt::Key_Escape)
+ if (key() != Qt::Key_Escape)
device->writeAttribute(QLatin1String("text"), text());
device->writeEndElement();
}
@@ -317,7 +317,7 @@ void TestLog::save(QIODevice *device)
writer.setAutoFormatting(true);
writer.writeStartDocument(QLatin1String("1.0"));
writer.writeStartElement(QLatin1String("TestLog"));
- for(int ii = 0; ii < _actions.count(); ++ii)
+ for (int ii = 0; ii < _actions.count(); ++ii)
_actions.at(ii)->save(&writer);
writer.writeEndElement();
writer.writeEndDocument();
@@ -325,7 +325,7 @@ void TestLog::save(QIODevice *device)
TestObject *TestLog::next()
{
- if(atEnd())
+ if (atEnd())
return 0;
TestObject *rv = _actions.at(_current);
_current++;
@@ -334,7 +334,7 @@ TestObject *TestLog::next()
bool TestLog::atEnd() const
{
- if(_current >= _actions.count())
+ if (_current >= _actions.count())
return true;
else
return false;
diff --git a/src/declarative/timeline/qmltimeline.cpp b/src/declarative/timeline/qmltimeline.cpp
index fc901eb..b9f79ac 100644
--- a/src/declarative/timeline/qmltimeline.cpp
+++ b/src/declarative/timeline/qmltimeline.cpp
@@ -141,7 +141,7 @@ QmlTimeLinePrivate::QmlTimeLinePrivate(QmlTimeLine *parent)
void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
{
- if(g._t && g._t != q) {
+ if (g._t && g._t != q) {
qWarning() << "QmlTimeLine: Cannot modify a QmlTimeLineValue owned by"
<< "another timeline.";
return;
@@ -149,12 +149,12 @@ void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
g._t = q;
Ops::Iterator iter = ops.find(&g);
- if(iter == ops.end()) {
+ if (iter == ops.end()) {
iter = ops.insert(&g, TimeLine());
- if(syncPoint > 0)
+ if (syncPoint > 0)
q->pause(g, syncPoint);
}
- if(!iter->ops.isEmpty() &&
+ if (!iter->ops.isEmpty() &&
o.type == Op::Pause &&
iter->ops.last().type == Op::Pause) {
iter->ops.last().length += o.length;
@@ -164,22 +164,22 @@ void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
iter->length += o.length;
}
- if(iter->length > length)
+ if (iter->length > length)
length = iter->length;
- if(!clockRunning) {
+ if (!clockRunning) {
q->stop();
prevTime = 0;
clockRunning = true;
- if(syncMode == QmlTimeLine::LocalSync) {
+ if (syncMode == QmlTimeLine::LocalSync) {
syncAdj = -1;
} else {
syncAdj = 0;
}
q->start();
/* q->tick(0);
- if(syncMode == QmlTimeLine::LocalSync) {
+ if (syncMode == QmlTimeLine::LocalSync) {
syncAdj = -1;
} else {
syncAdj = 0;
@@ -201,33 +201,33 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
case Op::Set:
return op.value;
case Op::Move:
- if(time == 0) {
+ if (time == 0) {
return base;
- } else if(time == (op.length)) {
+ } else if (time == (op.length)) {
return op.value;
} else {
qreal delta = op.value - base;
qreal pTime = (qreal)(time) / (qreal)op.length;
- if(op.easing.type() == QEasingCurve::Linear)
+ if (op.easing.type() == QEasingCurve::Linear)
return base + delta * pTime;
else
return base + delta * op.easing.valueForProgress(pTime);
}
case Op::MoveBy:
- if(time == 0) {
+ if (time == 0) {
return base;
- } else if(time == (op.length)) {
+ } else if (time == (op.length)) {
return base + op.value;
} else {
qreal delta = op.value;
qreal pTime = (qreal)(time) / (qreal)op.length;
- if(op.easing.type() == QEasingCurve::Linear)
+ if (op.easing.type() == QEasingCurve::Linear)
return base + delta * pTime;
else
return base + delta * op.easing.valueForProgress(pTime);
}
case Op::Accel:
- if(time == 0) {
+ if (time == 0) {
return base;
} else {
qreal t = (qreal)(time) / 1000.0f;
@@ -235,9 +235,9 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
return base + delta;
}
case Op::AccelDistance:
- if(time == 0) {
+ if (time == 0) {
return base;
- } else if(time == (op.length)) {
+ } else if (time == (op.length)) {
return base + op.value2;
} else {
qreal t = (qreal)(time) / 1000.0f;
@@ -326,7 +326,7 @@ QmlTimeLine::QmlTimeLine(QObject *parent)
*/
QmlTimeLine::~QmlTimeLine()
{
- for(QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter)
iter.key()->_t = 0;
@@ -359,7 +359,7 @@ void QmlTimeLine::setSyncMode(SyncMode syncMode)
*/
void QmlTimeLine::pause(QmlTimeLineObject &obj, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Pause, time, 0., 0., d->order++);
d->add(obj, op);
}
@@ -390,7 +390,7 @@ void QmlTimeLine::set(QmlTimeLineValue &timeLineValue, qreal value)
*/
int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal acceleration)
{
- if((velocity > 0.0f) == (acceleration > 0.0f))
+ if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
@@ -416,10 +416,10 @@ int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal ac
Q_ASSERT(acceleration >= 0.0f && maxDistance >= 0.0f);
qreal maxAccel = (velocity * velocity) / (2.0f * maxDistance);
- if(maxAccel > acceleration)
+ if (maxAccel > acceleration)
acceleration = maxAccel;
- if((velocity > 0.0f) == (acceleration > 0.0f))
+ if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
@@ -457,7 +457,7 @@ int QmlTimeLine::accelDistance(QmlTimeLineValue &timeLineValue, qreal velocity,
*/
void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++);
d->add(timeLineValue, op);
}
@@ -468,7 +468,7 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int t
*/
void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const QEasingCurve &easing, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QmlTimeLineEvent(), easing);
d->add(timeLineValue, op);
}
@@ -479,7 +479,7 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const
*/
void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++);
d->add(timeLineValue, op);
}
@@ -490,7 +490,7 @@ void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time
*/
void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QEasingCurve &easing, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QmlTimeLineEvent(), easing);
d->add(timeLineValue, op);
}
@@ -500,9 +500,9 @@ void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QE
*/
void QmlTimeLine::reset(QmlTimeLineValue &timeLineValue)
{
- if(!timeLineValue._t)
+ if (!timeLineValue._t)
return;
- if(timeLineValue._t != this) {
+ if (timeLineValue._t != this) {
qWarning() << "QmlTimeLine: Cannot reset a QmlTimeLineValue owned by another timeline.";
return;
}
@@ -529,12 +529,12 @@ int QmlTimeLine::duration() const
void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo)
{
QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&syncTo);
- if(iter == d->ops.end())
+ if (iter == d->ops.end())
return;
int length = iter->length;
iter = d->ops.find(&timeLineValue);
- if(iter == d->ops.end()) {
+ if (iter == d->ops.end()) {
pause(timeLineValue, length);
} else {
int glength = iter->length;
@@ -554,7 +554,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo
void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
{
QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&timeLineValue);
- if(iter == d->ops.end()) {
+ if (iter == d->ops.end()) {
pause(timeLineValue, d->length);
} else {
pause(timeLineValue, d->length - iter->length);
@@ -591,7 +591,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
/*void QmlTimeLine::sync()
{
- for(QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter)
pause(*iter.key(), d->length - iter->length);
@@ -658,7 +658,7 @@ void QmlTimeLine::complete()
*/
void QmlTimeLine::clear()
{
- for(QmlTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
+ for (QmlTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
iter.key()->_t = 0;
d->ops.clear();
d->length = 0;
@@ -680,13 +680,13 @@ int QmlTimeLine::time() const
void QmlTimeLine::updateCurrentTime(int v)
{
- if(d->syncAdj == -1)
+ if (d->syncAdj == -1)
d->syncAdj = v;
v -= d->syncAdj;
int timeChanged = v - d->prevTime;
#if 0
- if(!timeChanged)
+ if (!timeChanged)
return;
#endif
d->prevTime = v;
@@ -694,18 +694,18 @@ void QmlTimeLine::updateCurrentTime(int v)
emit updated();
// Do we need to stop the clock?
- if(d->ops.isEmpty()) {
+ if (d->ops.isEmpty()) {
stop();
d->prevTime = 0;
d->clockRunning = false;
emit completed();
- } /*else if(pauseTime > 0) {
+ } /*else if (pauseTime > 0) {
GfxClock::cancelClock();
d->prevTime = 0;
GfxClock::pauseFor(pauseTime);
d->syncAdj = 0;
d->clockRunning = false;
- }*/ else if(/*!GfxClock::isActive()*/ state() != Running) {
+ }*/ else if (/*!GfxClock::isActive()*/ state() != Running) {
stop();
d->prevTime = 0;
d->clockRunning = true;
@@ -729,14 +729,14 @@ int QmlTimeLinePrivate::advance(int t)
pauseTime = -1;
// Minimal advance time
int advanceTime = t;
- for(Ops::Iterator iter = ops.begin(); iter != ops.end(); ++iter) {
+ for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ++iter) {
TimeLine &tl = *iter;
Op &op = tl.ops.first();
int length = op.length - tl.consumedOpLength;
- if(length < advanceTime) {
+ if (length < advanceTime) {
advanceTime = length;
- if(advanceTime == 0)
+ if (advanceTime == 0)
break;
}
}
@@ -746,28 +746,28 @@ int QmlTimeLinePrivate::advance(int t)
// sets.
QList<QPair<int, Update> > updates;
- for(Ops::Iterator iter = ops.begin(); iter != ops.end(); ) {
+ for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ) {
QmlTimeLineValue *v = static_cast<QmlTimeLineValue *>(iter.key());
TimeLine &tl = *iter;
Q_ASSERT(!tl.ops.isEmpty());
do {
Op &op = tl.ops.first();
- if(advanceTime == 0 && op.length != 0)
+ if (advanceTime == 0 && op.length != 0)
continue;
- if(tl.consumedOpLength == 0 &&
+ if (tl.consumedOpLength == 0 &&
op.type != Op::Pause &&
op.type != Op::Execute)
tl.base = v->value();
- if((tl.consumedOpLength + advanceTime) == op.length) {
- if(op.type == Op::Execute) {
+ if ((tl.consumedOpLength + advanceTime) == op.length) {
+ if (op.type == Op::Execute) {
updates << qMakePair(op.order, Update(op.event));
} else {
bool changed = false;
qreal val = value(op, op.length, tl.base, &changed);
- if(changed)
+ if (changed)
updates << qMakePair(op.order, Update(v, val));
}
tl.length -= qMin(advanceTime, tl.length);
@@ -777,7 +777,7 @@ int QmlTimeLinePrivate::advance(int t)
tl.consumedOpLength += advanceTime;
bool changed = false;
qreal val = value(op, tl.consumedOpLength, tl.base, &changed);
- if(changed)
+ if (changed)
updates << qMakePair(op.order, Update(v, val));
tl.length -= qMin(advanceTime, tl.length);
break;
@@ -786,13 +786,13 @@ int QmlTimeLinePrivate::advance(int t)
} while(!tl.ops.isEmpty() && advanceTime == 0 && tl.ops.first().length == 0);
- if(tl.ops.isEmpty()) {
+ if (tl.ops.isEmpty()) {
iter = ops.erase(iter);
v->_t = 0;
} else {
- if(tl.ops.first().type == Op::Pause && pauseTime != 0) {
+ if (tl.ops.first().type == Op::Pause && pauseTime != 0) {
int opPauseTime = tl.ops.first().length - tl.consumedOpLength;
- if(pauseTime == -1 || opPauseTime < pauseTime)
+ if (pauseTime == -1 || opPauseTime < pauseTime)
pauseTime = opPauseTime;
} else {
pauseTime = 0;
@@ -806,9 +806,9 @@ int QmlTimeLinePrivate::advance(int t)
qSort(updates.begin(), updates.end());
updateQueue = &updates;
- for(int ii = 0; ii < updates.count(); ++ii) {
+ for (int ii = 0; ii < updates.count(); ++ii) {
const Update &v = updates.at(ii).second;
- if(v.g)
+ if (v.g)
v.g->setValue(v.v);
else
v.e.execute();
@@ -826,27 +826,27 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
int len = iter->length;
d->ops.erase(iter);
- if(len == d->length) {
+ if (len == d->length) {
// We need to recalculate the length
d->length = 0;
- for(QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter) {
- if(iter->length > d->length)
+ if (iter->length > d->length)
d->length = iter->length;
}
}
- if(d->ops.isEmpty()) {
+ if (d->ops.isEmpty()) {
stop();
d->clockRunning = false;
- } else if(/*!GfxClock::isActive()*/ state() != Running) {
+ } else if (/*!GfxClock::isActive()*/ state() != Running) {
stop();
d->prevTime = 0;
d->clockRunning = true;
- if(d->syncMode == QmlTimeLine::LocalSync) {
+ if (d->syncMode == QmlTimeLine::LocalSync) {
d->syncAdj = -1;
} else {
d->syncAdj = 0;
@@ -854,9 +854,9 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
start();
}
- if(d->updateQueue) {
- for(int ii = 0; ii < d->updateQueue->count(); ++ii) {
- if(d->updateQueue->at(ii).second.g == v ||
+ if (d->updateQueue) {
+ for (int ii = 0; ii < d->updateQueue->count(); ++ii) {
+ if (d->updateQueue->at(ii).second.g == v ||
d->updateQueue->at(ii).second.e.eventObject() == v) {
d->updateQueue->removeAt(ii);
--ii;
@@ -906,7 +906,7 @@ QmlTimeLineObject::QmlTimeLineObject()
QmlTimeLineObject::~QmlTimeLineObject()
{
- if(_t) {
+ if (_t) {
_t->remove(this);
_t = 0;
}
diff --git a/src/declarative/timeline/qmltimelinevalueproxy.h b/src/declarative/timeline/qmltimelinevalueproxy.h
index add45dd..853db4e 100644
--- a/src/declarative/timeline/qmltimelinevalueproxy.h
+++ b/src/declarative/timeline/qmltimelinevalueproxy.h
@@ -69,8 +69,8 @@ public:
virtual void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- if(_setFunctionReal) (_class->*_setFunctionReal)(v);
- else if(_setFunctionInt) (_class->*_setFunctionInt)((int)v);
+ if (_setFunctionReal) (_class->*_setFunctionReal)(v);
+ else if (_setFunctionInt) (_class->*_setFunctionInt)((int)v);
}
private:
diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h
index 52cf021..887351d 100644
--- a/src/declarative/util/qfxglobal.h
+++ b/src/declarative/util/qfxglobal.h
@@ -88,10 +88,10 @@ QT_MODULE(Declarative)
static bool name() \
{ \
static enum { Yes, No, Unknown } status = Unknown; \
- if(status == Unknown) { \
+ if (status == Unknown) { \
QByteArray v = qgetenv(#var); \
bool value = !v.isEmpty() && v != "0" && v != "false"; \
- if(value) status = Yes; \
+ if (value) status = Yes; \
else status = No; \
} \
return status == Yes; \
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index 993d5cb..1e9d5a4 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -200,7 +200,7 @@ void QFxView::execute()
d->component = new QmlComponent(&d->engine, d->xml.toUtf8(), d->source);
}
- if(!d->component->isLoading()) {
+ if (!d->component->isLoading()) {
continueExecute();
} else {
connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
@@ -211,18 +211,18 @@ void QFxView::continueExecute()
{
disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- if(!d->component){
+ if (!d->component){
qWarning() << "Error in loading" << d->source;
return;
}
QObject *obj = d->component->create();
rootContext()->deactivate();
- if(obj) {
- if(QFxItem *item = qobject_cast<QFxItem *>(obj)) {
+ if (obj) {
+ if (QFxItem *item = qobject_cast<QFxItem *>(obj)) {
item->QSimpleCanvasItem::setParent(QSimpleCanvas::root());
- if(itemTreeDump())
+ if (itemTreeDump())
item->dump();
QPerformanceLog::displayData();
@@ -231,7 +231,7 @@ void QFxView::continueExecute()
connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
sizeChanged();
- } else if(QWidget *wid = qobject_cast<QWidget *>(obj)) {
+ } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
window()->setAttribute(Qt::WA_NoSystemBackground, false);
if (!layout()) {
@@ -256,14 +256,14 @@ void QFxView::sizeChanged()
QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent)
{
- if(!d->root)
+ if (!d->root)
return 0;
QmlComponent component(&d->engine, xml.toUtf8(), QUrl());
QObject *obj = component.create();
- if(obj){
+ if (obj){
QFxItem *item = static_cast<QFxItem *>(obj);
- if(!parent)
+ if (!parent)
parent = d->root;
item->setItemParent(parent);
@@ -280,7 +280,7 @@ void QFxView::reset()
void QFxView::clearItems()
{
- if(!d->root)
+ if (!d->root)
return;
delete d->root;
d->root = 0;
@@ -293,7 +293,7 @@ QFxItem *QFxView::root() const
void QFxView::resizeEvent(QResizeEvent *e)
{
- if(d->root) {
+ if (d->root) {
d->root->setWidth(width());
d->root->setHeight(height());
}
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 91a5361..1ee13e2 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -73,9 +73,9 @@ QEasingCurve stringToCurve(const QString &curve)
bool hasParams = curve.contains(QLatin1Char('('));
QStringList props;
- if(hasParams) {
+ if (hasParams) {
QString easeName = curve.trimmed();
- if(!easeName.endsWith(QLatin1Char(')'))) {
+ if (!easeName.endsWith(QLatin1Char(')'))) {
qWarning("QEasingCurve: Unmatched perenthesis in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -107,7 +107,7 @@ QEasingCurve stringToCurve(const QString &curve)
foreach(QString str, props) {
int sep = str.indexOf(QLatin1Char(':'));
- if(sep == -1) {
+ if (sep == -1) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -117,7 +117,7 @@ QEasingCurve stringToCurve(const QString &curve)
bool isOk;
qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
- if(propName.isEmpty() || !isOk) {
+ if (propName.isEmpty() || !isOk) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -211,7 +211,7 @@ void QmlAbstractAnimationPrivate::commence()
q->prepare(userProperty.value);
q->qtAnimation()->start();
- if(!q->qtAnimation()->state() == QAbstractAnimation::Running) {
+ if (!q->qtAnimation()->state() == QAbstractAnimation::Running) {
running = false;
emit q->completed();
}
@@ -220,17 +220,17 @@ void QmlAbstractAnimationPrivate::commence()
void QmlAbstractAnimation::setRunning(bool r)
{
Q_D(QmlAbstractAnimation);
- if(d->running == r)
+ if (d->running == r)
return;
- if(d->group) {
+ if (d->group) {
qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
return;
}
d->running = r;
- if(d->running) {
- if(!d->connectedTimeLine) {
+ if (d->running) {
+ if (!d->connectedTimeLine) {
QObject::connect(qtAnimation(), SIGNAL(finished()),
this, SLOT(timelineComplete()));
d->connectedTimeLine = true;
@@ -241,7 +241,7 @@ void QmlAbstractAnimation::setRunning(bool r)
d->startOnCompletion = true;
emit started();
} else {
- if(!d->finishPlaying)
+ if (!d->finishPlaying)
qtAnimation()->stop();
emit completed();
}
@@ -286,7 +286,7 @@ bool QmlAbstractAnimation::finishPlaying() const
void QmlAbstractAnimation::setFinishPlaying(bool f)
{
Q_D(QmlAbstractAnimation);
- if(d->finishPlaying == f)
+ if (d->finishPlaying == f)
return;
d->finishPlaying = f;
@@ -320,7 +320,7 @@ bool QmlAbstractAnimation::repeat() const
void QmlAbstractAnimation::setRepeat(bool r)
{
Q_D(QmlAbstractAnimation);
- if(r == d->repeat)
+ if (r == d->repeat)
return;
d->repeat = r;
@@ -338,20 +338,20 @@ QmlAnimationGroup *QmlAbstractAnimation::group() const
void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
{
Q_D(QmlAbstractAnimation);
- if(d->group == g)
+ if (d->group == g)
return;
- if(d->group)
+ if (d->group)
static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.removeAll(this);
d->group = g;
- if(d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.contains(this))
+ if (d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.contains(this))
static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.append(this);
if (d->group)
((QAnimationGroup*)d->group->qtAnimation())->addAnimation(qtAnimation());
- //if(g) //if removed from a group, then the group should no longer be the parent
+ //if (g) //if removed from a group, then the group should no longer be the parent
setParent(g);
}
@@ -371,11 +371,11 @@ QObject *QmlAbstractAnimation::target() const
void QmlAbstractAnimation::setTarget(QObject *o)
{
Q_D(QmlAbstractAnimation);
- if(d->target == o)
+ if (d->target == o)
return;
d->target = o;
- if(d->target && !d->propertyName.isEmpty()) {
+ if (d->target && !d->propertyName.isEmpty()) {
d->userProperty = QmlMetaProperty(d->target, d->propertyName);
} else {
d->userProperty.invalidate();
@@ -400,11 +400,11 @@ QString QmlAbstractAnimation::property() const
void QmlAbstractAnimation::setProperty(const QString &n)
{
Q_D(QmlAbstractAnimation);
- if(d->propertyName == n)
+ if (d->propertyName == n)
return;
d->propertyName = n;
- if(d->target && !d->propertyName.isEmpty()) {
+ if (d->target && !d->propertyName.isEmpty()) {
d->userProperty = QmlMetaProperty(d->target, d->propertyName);
} else {
d->userProperty.invalidate();
@@ -487,7 +487,7 @@ void QmlAbstractAnimation::restart()
*/
void QmlAbstractAnimation::complete()
{
- if(isRunning()) {
+ if (isRunning()) {
qtAnimation()->setCurrentTime(qtAnimation()->duration());
}
}
@@ -495,7 +495,7 @@ void QmlAbstractAnimation::complete()
void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p)
{
Q_D(QmlAbstractAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->userProperty = p;
}
@@ -588,13 +588,13 @@ int QmlPauseAnimation::duration() const
void QmlPauseAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlPauseAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlPauseAnimation);
- if(d->pa->duration() == duration)
+ if (d->pa->duration() == duration)
return;
d->pa->setDuration(duration);
emit durationChanged(duration);
@@ -603,7 +603,7 @@ void QmlPauseAnimation::setDuration(int duration)
void QmlPauseAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlPauseAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -678,13 +678,13 @@ int QmlColorAnimation::duration() const
void QmlColorAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlColorAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlColorAnimation);
- if(d->ca->duration() == duration)
+ if (d->ca->duration() == duration)
return;
d->ca->setDuration(duration);
emit durationChanged(duration);
@@ -707,7 +707,7 @@ QColor QmlColorAnimation::from() const
void QmlColorAnimation::setFrom(const QColor &f)
{
Q_D(QmlColorAnimation);
- if(d->fromValue.isValid() && f == d->fromValue)
+ if (d->fromValue.isValid() && f == d->fromValue)
return;
d->fromValue = f;
emit fromChanged(f);
@@ -730,7 +730,7 @@ QColor QmlColorAnimation::to() const
void QmlColorAnimation::setTo(const QColor &t)
{
Q_D(QmlColorAnimation);
- if(d->toValue.isValid() && t == d->toValue)
+ if (d->toValue.isValid() && t == d->toValue)
return;
d->toValue = t;
emit toChanged(t);
@@ -753,7 +753,7 @@ QString QmlColorAnimation::easing() const
void QmlColorAnimation::setEasing(const QString &e)
{
Q_D(QmlColorAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -786,7 +786,7 @@ QList<QObject *> *QmlColorAnimation::exclude()
void QmlColorAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlColorAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -813,7 +813,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
QmlStateActions actions;
void write(QmlMetaProperty &property, const QColor &color)
{
- if(property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == qMetaTypeId<QColor>()) {
property.write(color);
}
}
@@ -821,17 +821,17 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QColor to(action.toValue.value<QColor>());
- if(v == 1.) {
+ if (v == 1.) {
write(action.property, to);
} else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- if(action.fromValue.isNull())
+ if (action.fromValue.isNull())
action.fromValue = QVariant(QColor());
}
@@ -852,26 +852,26 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
//XXX should we get rid of this?
QStringList props;
props << QLatin1String("color");
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->fromValue.isValid())
+ if (d->fromValue.isValid())
myAction.fromValue = QVariant(d->fromValue);
- if(d->toValue.isValid())
+ if (d->toValue.isValid())
myAction.toValue = QVariant(d->toValue);
modified << action.property;
@@ -880,13 +880,13 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
}
}
- if(d->toValue.isValid() && target() && !objs.contains(target())) {
+ if (d->toValue.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->fromValue.isValid())
+ if (d->fromValue.isValid())
myAction.fromValue = QVariant(d->fromValue);
myAction.toValue = QVariant(d->toValue);
@@ -896,7 +896,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count())
+ if (data->actions.count())
d->ca->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
else
delete data;
@@ -905,8 +905,8 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
void QmlColorAnimationPrivate::valueChanged(qreal v)
{
- if(!fromSourced) {
- if(!fromValue.isValid()) {
+ if (!fromSourced) {
+ if (!fromValue.isValid()) {
fromValue = QColor(qvariant_cast<QColor>(property.read()));
}
fromSourced = true;
@@ -918,7 +918,7 @@ void QmlColorAnimationPrivate::valueChanged(qreal v)
uint blue = uint(qreal(fromValue.blue()) + v * (qreal(toValue.blue()) - qreal(fromValue.blue())));
uint alpha = uint(qreal(fromValue.alpha()) + v * (qreal(toValue.alpha()) - qreal(fromValue.alpha())));
- if(property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == qMetaTypeId<QColor>()) {
property.write(QColor(red, green, blue, alpha));
}
}
@@ -967,7 +967,7 @@ QString QmlRunScriptAction::script() const
void QmlRunScriptAction::setScript(const QString &script)
{
Q_D(QmlRunScriptAction);
- if(script == d->script)
+ if (script == d->script)
return;
d->script = script;
emit scriptChanged(script);
@@ -986,7 +986,7 @@ QString QmlRunScriptAction::file() const
void QmlRunScriptAction::setFile(const QString &file)
{
Q_D(QmlRunScriptAction);
- if(file == d->file)
+ if (file == d->file)
return;
d->file = file;
emit fileChanged(file);
@@ -996,14 +996,14 @@ void QmlRunScriptActionPrivate::execute()
{
Q_Q(QmlRunScriptAction);
QString scriptStr = script;
- if(!file.isEmpty()){
+ if (!file.isEmpty()){
QFile scriptFile(file);
- if(scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)){
+ if (scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)){
scriptStr = QString::fromUtf8(scriptFile.readAll());
}
}
- if(!scriptStr.isEmpty()) {
+ if (!scriptStr.isEmpty()) {
QmlExpression expr(qmlContext(q), scriptStr, q);
expr.setTrackChange(false);
expr.value();
@@ -1074,7 +1074,7 @@ QString QmlSetPropertyAction::properties() const
void QmlSetPropertyAction::setProperties(const QString &p)
{
Q_D(QmlSetPropertyAction);
- if(d->properties == p)
+ if (d->properties == p)
return;
d->properties = p;
emit propertiesChanged(p);
@@ -1116,7 +1116,7 @@ QVariant QmlSetPropertyAction::value() const
void QmlSetPropertyAction::setValue(const QVariant &v)
{
Q_D(QmlSetPropertyAction);
- if(d->value.isNull || d->value != v) {
+ if (d->value.isNull || d->value != v) {
d->value = v;
emit valueChanged(v);
}
@@ -1137,7 +1137,7 @@ void QmlSetPropertyAction::prepare(QmlMetaProperty &p)
{
Q_D(QmlSetPropertyAction);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1157,7 +1157,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
QmlStateActions actions;
virtual void doAction()
{
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
QmlBehaviour::_ignore = true;
action.property.write(action.toValue);
@@ -1167,27 +1167,27 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->value.isValid())
+ if (d->value.isValid())
myAction.toValue = d->value;
modified << action.property;
@@ -1196,9 +1196,9 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
}
- if(d->value.isValid() && target() && !objs.contains(target())) {
+ if (d->value.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
myAction.toValue = d->value;
@@ -1206,7 +1206,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->spa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1249,7 +1249,7 @@ void QmlParentChangeAction::prepare(QmlMetaProperty &p)
{
Q_D(QmlParentChangeAction);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1275,7 +1275,7 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QmlStateActions actions;
virtual void doAction()
{
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
QmlBehaviour::_ignore = true;
action.property.write(action.toValue);
@@ -1287,17 +1287,17 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QmlParentChangeActionData *data = new QmlParentChangeActionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((!target() || target() == obj) && propertyName == QString(QLatin1String("moveToParent"))) {
+ if ((!target() || target() == obj) && propertyName == QString(QLatin1String("moveToParent"))) {
objs.insert(obj);
Action myAction = action;
- /*if(d->value.isValid())
+ /*if (d->value.isValid())
myAction.toValue = d->value;*/
modified << action.property;
@@ -1306,9 +1306,9 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
}
}
- /*if(d->value.isValid() && target() && !objs.contains(target())) {
+ /*if (d->value.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
myAction.toValue = d->value;
@@ -1316,7 +1316,7 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
}
}*/
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->cpa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1387,13 +1387,13 @@ int QmlNumericAnimation::duration() const
void QmlNumericAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlNumericAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlNumericAnimation);
- if(d->na->duration() == duration)
+ if (d->na->duration() == duration)
return;
d->na->setDuration(duration);
emit durationChanged(duration);
@@ -1417,7 +1417,7 @@ qreal QmlNumericAnimation::from() const
void QmlNumericAnimation::setFrom(qreal f)
{
Q_D(QmlNumericAnimation);
- if(!d->from.isNull && f == d->from)
+ if (!d->from.isNull && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -1441,7 +1441,7 @@ qreal QmlNumericAnimation::to() const
void QmlNumericAnimation::setTo(qreal t)
{
Q_D(QmlNumericAnimation);
- if(!d->to.isNull && t == d->to)
+ if (!d->to.isNull && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -1513,7 +1513,7 @@ QString QmlNumericAnimation::easing() const
void QmlNumericAnimation::setEasing(const QString &e)
{
Q_D(QmlNumericAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -1544,7 +1544,7 @@ QString QmlNumericAnimation::properties() const
void QmlNumericAnimation::setProperties(const QString &prop)
{
Q_D(QmlNumericAnimation);
- if(d->properties == prop)
+ if (d->properties == prop)
return;
d->properties = prop;
@@ -1575,8 +1575,8 @@ QList<QObject *> *QmlNumericAnimation::exclude()
void QmlNumericAnimationPrivate::valueChanged(qreal r)
{
- if(!fromSourced) {
- if(from.isNull) {
+ if (!fromSourced) {
+ if (from.isNull) {
fromValue = qvariant_cast<qreal>(property.read());
} else {
fromValue = from;
@@ -1584,7 +1584,7 @@ void QmlNumericAnimationPrivate::valueChanged(qreal r)
fromSourced = true;
}
- if(r == 1.) {
+ if (r == 1.) {
property.write(to.value);
} else {
qreal val = fromValue + (to-fromValue) * r;
@@ -1595,7 +1595,7 @@ void QmlNumericAnimationPrivate::valueChanged(qreal r)
void QmlNumericAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlNumericAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1623,16 +1623,16 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QmlBehaviour::_ignore = true;
- if(v == 1.)
+ if (v == 1.)
action.property.write(action.toValue.toDouble());
else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = QVariant(0.);
}
}
@@ -1647,31 +1647,31 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->from.isValid()) {
+ if (d->from.isValid()) {
myAction.fromValue = QVariant(d->from);
} else {
myAction.fromValue = QVariant();
}
- if(d->to.isValid())
+ if (d->to.isValid())
myAction.toValue = QVariant(d->to);
modified << action.property;
@@ -1681,13 +1681,13 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
}
- if(d->to.isValid() && target() && !objs.contains(target())) {
+ if (d->to.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->from.isValid())
+ if (d->from.isValid())
myAction.fromValue = QVariant(d->from);
myAction.toValue = QVariant(d->to);
@@ -1697,7 +1697,7 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->na->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1755,7 +1755,7 @@ QmlSequentialAnimation::~QmlSequentialAnimation()
void QmlSequentialAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlAnimationGroup);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1778,7 +1778,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
int inc = 1;
int from = 0;
- if(direction == Backward) {
+ if (direction == Backward) {
inc = -1;
from = d->animations.count() - 1;
}
@@ -1787,7 +1787,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
for (int i = d->ag->animationCount()-1; i >= 0; --i)
d->ag->takeAnimationAt(i);
- for(int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
+ for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
d->animations.at(ii)->transition(actions, modified, direction);
d->ag->addAnimation(d->animations.at(ii)->qtAnimation());
}
@@ -1846,7 +1846,7 @@ QmlParallelAnimation::~QmlParallelAnimation()
void QmlParallelAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlAnimationGroup);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1867,7 +1867,7 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
{
Q_D(QmlAnimationGroup);
- for(int ii = 0; ii < d->animations.count(); ++ii) {
+ for (int ii = 0; ii < d->animations.count(); ++ii) {
d->animations.at(ii)->transition(actions, modified, direction);
}
}
@@ -1976,13 +1976,13 @@ int QmlVariantAnimation::duration() const
void QmlVariantAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlVariantAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlVariantAnimation);
- if(d->va->duration() == duration)
+ if (d->va->duration() == duration)
return;
d->va->setDuration(duration);
emit durationChanged(duration);
@@ -2006,7 +2006,7 @@ QVariant QmlVariantAnimation::from() const
void QmlVariantAnimation::setFrom(const QVariant &f)
{
Q_D(QmlVariantAnimation);
- if(!d->from.isNull && f == d->from)
+ if (!d->from.isNull && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -2030,7 +2030,7 @@ QVariant QmlVariantAnimation::to() const
void QmlVariantAnimation::setTo(const QVariant &t)
{
Q_D(QmlVariantAnimation);
- if(!d->to.isNull && t == d->to)
+ if (!d->to.isNull && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -2059,7 +2059,7 @@ QString QmlVariantAnimation::easing() const
void QmlVariantAnimation::setEasing(const QString &e)
{
Q_D(QmlVariantAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -2090,7 +2090,7 @@ QString QmlVariantAnimation::properties() const
void QmlVariantAnimation::setProperties(const QString &prop)
{
Q_D(QmlVariantAnimation);
- if(d->properties == prop)
+ if (d->properties == prop)
return;
d->properties = prop;
@@ -2121,8 +2121,8 @@ QList<QObject *> *QmlVariantAnimation::exclude()
void QmlVariantAnimationPrivate::valueChanged(qreal r)
{
- if(!fromSourced) {
- if(from.isNull) {
+ if (!fromSourced) {
+ if (from.isNull) {
fromValue = property.read();
} else {
fromValue = from;
@@ -2130,7 +2130,7 @@ void QmlVariantAnimationPrivate::valueChanged(qreal r)
fromSourced = true;
}
- if(r == 1.) {
+ if (r == 1.) {
property.write(to.value);
} else {
QVariant val = interpolateVariant(fromValue, to.value, r);
@@ -2147,7 +2147,7 @@ QAbstractAnimation *QmlVariantAnimation::qtAnimation()
void QmlVariantAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlVariantAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -2174,15 +2174,15 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
- if(v == 1.)
+ if (v == 1.)
action.property.write(action.toValue);
else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- /*if(action.fromValue.isNull())
+ /*if (action.fromValue.isNull())
action.fromValue = QVariant(0.);*/ //XXX can we give a default value for any type?
}
QVariant val = QmlVariantAnimationPrivate::interpolateVariant(action.fromValue, action.toValue, v);
@@ -2193,29 +2193,29 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->from.isValid())
+ if (d->from.isValid())
myAction.fromValue = QVariant(d->from);
- if(d->to.isValid())
+ if (d->to.isValid())
myAction.toValue = QVariant(d->to);
d->convertVariant(myAction.fromValue, (QVariant::Type)myAction.property.propertyType());
@@ -2228,13 +2228,13 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
- if(d->to.isValid() && target() && !objs.contains(target())) {
+ if (d->to.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->from.isValid()) {
+ if (d->from.isValid()) {
d->convertVariant(d->from.value, (QVariant::Type)myAction.property.propertyType());
myAction.fromValue = QVariant(d->from);
}
@@ -2247,7 +2247,7 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
diff --git a/src/declarative/util/qmlbehaviour.cpp b/src/declarative/util/qmlbehaviour.cpp
index 3fff06c..58e515f 100644
--- a/src/declarative/util/qmlbehaviour.cpp
+++ b/src/declarative/util/qmlbehaviour.cpp
@@ -182,12 +182,12 @@ bool QmlBehaviour::_ignore = false;
void QmlBehaviour::propertyValueChanged()
{
Q_D(QmlBehaviour);
- if(_ignore)
+ if (_ignore)
return;
QVariant newValue = d->property.read();
- if((!fromValue().isValid() || fromValue() == d->currentValue) &&
+ if ((!fromValue().isValid() || fromValue() == d->currentValue) &&
(!toValue().isValid() || toValue() == newValue)) {
//### does this clean up everything needed?
@@ -208,11 +208,11 @@ void QmlBehaviour::propertyValueChanged()
d->property.write(d->currentValue);
QList<QmlMetaProperty> after;
- for(int ii = 0; ii < d->operations.count(); ++ii) {
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
}
d->group->start();
- if(!after.contains(d->property))
+ if (!after.contains(d->property))
d->property.write(newValue);
_ignore = false;
}
@@ -231,7 +231,7 @@ void QmlBehaviour::setTarget(const QmlMetaProperty &property)
void QmlBehaviour::classBegin()
{
Q_D(QmlBehaviour);
- if(!d->context) {
+ if (!d->context) {
d->context = new QmlContext(qmlContext(this), this);
d->context->addDefaultObject(d->valueData);
}
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp
index 4451ca2..3b51c6a 100644
--- a/src/declarative/util/qmlbind.cpp
+++ b/src/declarative/util/qmlbind.cpp
@@ -193,7 +193,7 @@ void QmlBind::setValue(const QVariant &v)
void QmlBind::eval()
{
Q_D(QmlBind);
- if(!d->obj || d->value.isNull || !d->when)
+ if (!d->obj || d->value.isNull || !d->when)
return;
QmlMetaProperty prop(d->obj, d->prop);
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
index 1d3b368..78f8c23 100644
--- a/src/declarative/util/qmlconnection.cpp
+++ b/src/declarative/util/qmlconnection.cpp
@@ -173,12 +173,12 @@ void QmlConnection::connectIfValid()
QObject *sender = d->signalSender ? d->signalSender : parent();
const QMetaObject *mo = sender->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
QString methodName = QLatin1String(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
- if(methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
+ if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
sigIdx = ii;
break;
}
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 9387bbc..da54b6e 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -64,20 +64,20 @@ void QmlListAccessor::setList(const QVariant &v)
{
d = v;
- if(!d.isValid()) {
+ if (!d.isValid()) {
type = Invalid;
- } else if(d.type() == QVariant::StringList) {
+ } else if (d.type() == QVariant::StringList) {
type = StringList;
- } else if(d.type() != QVariant::UserType) {
+ } else if (d.type() != QVariant::UserType) {
type = Instance;
- } else if(QmlMetaType::isObject(d.userType())) {
+ } else if (QmlMetaType::isObject(d.userType())) {
QObject *data = 0;
data = *(QObject **)v.constData();
d = QVariant::fromValue(data);
type = Instance;
- } else if(QmlMetaType::isQmlList(d.userType())) {
+ } else if (QmlMetaType::isQmlList(d.userType())) {
type = QmlList;
- } else if(QmlMetaType::isList(d.userType())) {
+ } else if (QmlMetaType::isList(d.userType())) {
type = QList;
} else {
type = Invalid;
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 24f2d5c..78d0360 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -70,7 +70,7 @@ public:
{
type = QmlListModel::Invalid;
model = QVariant();
- if(listModelInterface)
+ if (listModelInterface)
listModelInterface->disconnect(q);
listModelInterface = 0;
singleObject = 0;
@@ -80,11 +80,11 @@ public:
void updateRoleCache()
{
- if(roleCacheValid)
+ if (roleCacheValid)
return;
roleCacheValid = true;
- if(type == QmlListModel::SingleObject)
+ if (type == QmlListModel::SingleObject)
roleCache = QmlMetaProperty::properties(singleObject);
}
@@ -164,7 +164,7 @@ bool QmlListModel::setModel(const QVariant &model)
d->clear();
QListModelInterface *iface = qvariant_cast<QListModelInterface *>(model);
- if(iface) {
+ if (iface) {
QObject::connect(iface, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
QObject::connect(iface, SIGNAL(itemsRemoved(int,int)),
@@ -180,14 +180,14 @@ bool QmlListModel::setModel(const QVariant &model)
}
QObject *object = qvariant_cast<QObject *>(model);
- if(object) {
+ if (object) {
d->singleObject = object;
d->type = SingleObject;
d->model = model;
return true;
}
- if(QmlMetaType::isList(model)) {
+ if (QmlMetaType::isList(model)) {
d->type = SimpleList;
d->model = model;
return true;
@@ -214,7 +214,7 @@ QList<int> QmlListModel::roles() const
case SingleObject:
{
QList<int> rv;
- for(int ii = 0; ii < d->roleCache.count(); ++ii)
+ for (int ii = 0; ii < d->roleCache.count(); ++ii)
rv << ii;
return rv;
}
@@ -230,14 +230,14 @@ QString QmlListModel::toString(int role) const
case Invalid:
return QString();
case SimpleList:
- if(role == DATA_ROLE_ID)
+ if (role == DATA_ROLE_ID)
return QLatin1String(DATA_ROLE_NAME);
else
return QString();
case ListInterface:
return d->listModelInterface->toString(role);
case SingleObject:
- if(role >= d->roleCache.count())
+ if (role >= d->roleCache.count())
return QString();
else
return d->roleCache.at(role);
@@ -272,14 +272,14 @@ QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
case Invalid:
break;
case SimpleList:
- if(roles.contains(DATA_ROLE_ID))
+ if (roles.contains(DATA_ROLE_ID))
rv.insert(DATA_ROLE_ID, QmlMetaType::listAt(d->model, index));
break;
case ListInterface:
return d->listModelInterface->data(index, roles);
case SingleObject:
{
- for(int ii = 0; ii < roles.count(); ++ii) {
+ for (int ii = 0; ii < roles.count(); ++ii) {
QmlMetaProperty prop(d->singleObject, toString(roles.at(ii)));
rv.insert(roles.at(ii), prop.read());
}
@@ -344,7 +344,7 @@ struct ModelNode
QHash<QString, ModelNode *> properties;
ListModel *model() {
- if(!modelCache) {
+ if (!modelCache) {
modelCache = new ListModel;
modelCache->_root = this;
}
@@ -352,7 +352,7 @@ struct ModelNode
}
ModelObject *object() {
- if(!objectCache) {
+ if (!objectCache) {
objectCache = new ModelObject(this);
QHash<QString, ModelNode *>::iterator it;
for (it = properties.begin(); it != properties.end(); ++it) {
@@ -382,12 +382,12 @@ ListModel::ListModel(QObject *parent)
void ListModel::checkRoles() const
{
- if(_rolesOk)
+ if (_rolesOk)
return;
- for(int ii = 0; ii < _root->values.count(); ++ii) {
+ for (int ii = 0; ii < _root->values.count(); ++ii) {
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(ii));
- if(node) {
+ if (node) {
foreach(QString role, node->properties.keys())
addRole(role);
}
@@ -398,7 +398,7 @@ void ListModel::checkRoles() const
void ListModel::addRole(const QString &role) const
{
- if(!roleStrings.contains(role))
+ if (!roleStrings.contains(role))
roleStrings << role;
}
@@ -406,7 +406,7 @@ QList<int> ListModel::roles() const
{
checkRoles();
QList<int> rv;
- for(int ii = 0; ii < roleStrings.count(); ++ii)
+ for (int ii = 0; ii < roleStrings.count(); ++ii)
rv << ii;
return rv;
}
@@ -414,7 +414,7 @@ QList<int> ListModel::roles() const
QString ListModel::toString(int role) const
{
checkRoles();
- if(role < roleStrings.count())
+ if (role < roleStrings.count())
return roleStrings.at(role);
else
return QString();
@@ -424,30 +424,30 @@ QVariant ListModel::valueForNode(ModelNode *node) const
{
QObject *rv = 0;
- if(!node->properties.isEmpty()) {
+ if (!node->properties.isEmpty()) {
// Object
rv = node->object();
- } else if(node->values.count() == 0) {
+ } else if (node->values.count() == 0) {
// Invalid
return QVariant();
- } else if(node->values.count() == 1) {
+ } else if (node->values.count() == 1) {
// Value
QVariant &var = node->values[0];
ModelNode *valueNode = qvariant_cast<ModelNode *>(var);
- if(valueNode) {
- if(!valueNode->properties.isEmpty())
+ if (valueNode) {
+ if (!valueNode->properties.isEmpty())
rv = valueNode->object();
else
rv = valueNode->model();
} else {
return var;
}
- } else if(node->values.count() > 1) {
+ } else if (node->values.count() > 1) {
// List
rv = node->model();
}
- if(rv)
+ if (rv)
return QVariant::fromValue(rv);
else
return QVariant();
@@ -457,19 +457,19 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
{
checkRoles();
QHash<int, QVariant> rv;
- if(index >= count())
+ if (index >= count())
return rv;
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
- if(!node)
+ if (!node)
return rv;
- for(int ii = 0; ii < roles.count(); ++ii) {
+ for (int ii = 0; ii < roles.count(); ++ii) {
const QString &roleString = roleStrings.at(roles.at(ii));
QHash<QString, ModelNode *>::ConstIterator iter =
node->properties.find(roleString);
- if(iter != node->properties.end()) {
+ if (iter != node->properties.end()) {
ModelNode *row = *iter;
rv.insert(roles.at(ii), valueForNode(row));
}
@@ -480,7 +480,7 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
int ListModel::count() const
{
- if(!_root) return 0;
+ if (!_root) return 0;
return _root->values.count();
}
@@ -503,9 +503,9 @@ static void dump(ModelNode *node, int ind)
QByteArray indentBa(ind * 4, ' ');
const char *indent = indentBa.constData();
- for(int ii = 0; ii < node->values.count(); ++ii) {
+ for (int ii = 0; ii < node->values.count(); ++ii) {
ModelNode *subNode = qvariant_cast<ModelNode *>(node->values.at(ii));
- if(subNode) {
+ if (subNode) {
qWarning().nospace() << indent << "Sub-node " << ii << ": class " << subNode->className;
dump(subNode, ind + 1);
} else {
@@ -513,7 +513,7 @@ static void dump(ModelNode *node, int ind)
}
}
- for(QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
+ for (QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
qWarning().nospace() << indent << "Property " << iter.key() << ":";
dump(iter.value(), ind + 1);
}
@@ -527,11 +527,11 @@ ModelNode::ModelNode()
ModelNode::~ModelNode()
{
qDeleteAll(properties);
- for(int ii = 0; ii < values.count(); ++ii) {
+ for (int ii = 0; ii < values.count(); ++ii) {
ModelNode *node = qvariant_cast<ModelNode *>(values.at(ii));
- if(node) { delete node; node = 0; }
+ if (node) { delete node; node = 0; }
}
- if(modelCache) { delete modelCache; modelCache = 0; }
+ if (modelCache) { delete modelCache; modelCache = 0; }
}
struct ListModelData
@@ -650,7 +650,7 @@ QByteArray ListModelParser::compile(QXmlStreamReader& reader, bool *ok)
lmd->dataOffset = sizeof(ListModelData) +
instr.count() * sizeof(ListInstruction);
lmd->instrCount = instr.count();
- for(int ii = 0; ii < instr.count(); ++ii)
+ for (int ii = 0; ii < instr.count(); ++ii)
lmd->instructions()[ii] = instr.at(ii);
::memcpy(rv.data() + lmd->dataOffset, data.constData(), data.count());
@@ -668,7 +668,7 @@ QVariant ListModelParser::create(const QByteArray &d)
const ListModelData *lmd = (const ListModelData *)d.constData();
const char *data = ((const char *)lmd) + lmd->dataOffset;
- for(int ii = 0; ii < lmd->instrCount; ++ii) {
+ for (int ii = 0; ii < lmd->instrCount; ++ii) {
const ListInstruction &instr = lmd->instructions()[ii];
switch(instr.type) {
diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp
index 09d71bd..87d8f4d 100644
--- a/src/declarative/util/qmlopenmetaobject.cpp
+++ b/src/declarative/util/qmlopenmetaobject.cpp
@@ -51,7 +51,7 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
mob.setFlags(QMetaObjectBuilder::DynamicMetaObject);
QObjectPrivate *op = QObjectPrivate::get(obj);
- if(op->metaObject)
+ if (op->metaObject)
mob.setSuperClass(op->metaObject);
mem = mob.toMetaObject();
@@ -63,21 +63,21 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
QmlOpenMetaObject::~QmlOpenMetaObject()
{
- if(parent)
+ if (parent)
delete parent;
qFree(mem);
}
int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
+ if (( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
&& id >= _propertyOffset) {
int propId = id - _propertyOffset;
- if(c == QMetaObject::ReadProperty) {
+ if (c == QMetaObject::ReadProperty) {
propertyRead(propId);
*reinterpret_cast<QVariant *>(a[0]) = data[propId];
- } else if(c == QMetaObject::WriteProperty) {
- if(data[propId] != *reinterpret_cast<QVariant *>(a[0])) {
+ } else if (c == QMetaObject::WriteProperty) {
+ if (data[propId] != *reinterpret_cast<QVariant *>(a[0])) {
propertyWrite(propId);
data[propId] = *reinterpret_cast<QVariant *>(a[0]);
activate(_object, _signalOffset + propId, 0);
@@ -85,7 +85,7 @@ int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
return -1;
} else {
- if(parent)
+ if (parent)
return parent->metaCall(c, id, a);
else
return _object->qt_metacall(c, id, a);
@@ -108,7 +108,7 @@ void QmlOpenMetaObject::setValue(int id, const QVariant &value)
QVariant QmlOpenMetaObject::value(const QByteArray &name) const
{
QHash<QByteArray, int>::ConstIterator iter = names.find(name);
- if(iter == names.end())
+ if (iter == names.end())
return QVariant();
return data.at(*iter);
@@ -119,13 +119,13 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
QHash<QByteArray, int>::ConstIterator iter = names.find(name);
int id = -1;
- if(iter == names.end()) {
+ if (iter == names.end()) {
id = doCreateProperty(name.constData()) - _propertyOffset;
} else {
id = *iter;
}
- if(data[id] == val)
+ if (data[id] == val)
return;
data[id] = val;
@@ -134,7 +134,7 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
int QmlOpenMetaObject::createProperty(const char *name, const char *)
{
- if(autoCreate)
+ if (autoCreate)
return doCreateProperty(name);
else
return -1;
diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp
index 264d186..aa7ed38 100644
--- a/src/declarative/util/qmlpackage.cpp
+++ b/src/declarative/util/qmlpackage.cpp
@@ -109,10 +109,10 @@ QmlList<QObject *> *QmlPackage::data()
bool QmlPackage::hasPart(const QString &name)
{
Q_D(QmlPackage);
- for(int ii = 0; ii < d->dataList.count(); ++ii) {
+ for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
- if(a && a->name() == name)
+ if (a && a->name() == name)
return true;
}
return false;
@@ -121,17 +121,17 @@ bool QmlPackage::hasPart(const QString &name)
QObject *QmlPackage::part(const QString &name)
{
Q_D(QmlPackage);
- if(name.isEmpty() && !d->dataList.isEmpty())
+ if (name.isEmpty() && !d->dataList.isEmpty())
return d->dataList.at(0);
- for(int ii = 0; ii < d->dataList.count(); ++ii) {
+ for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
- if(a && a->name() == name)
+ if (a && a->name() == name)
return obj;
}
- if(name == QLatin1String("default") && !d->dataList.isEmpty())
+ if (name == QLatin1String("default") && !d->dataList.isEmpty())
return d->dataList.at(0);
return 0;
diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp
index 73c8c07..fbaf56e 100644
--- a/src/declarative/util/qmlscript.cpp
+++ b/src/declarative/util/qmlscript.cpp
@@ -194,7 +194,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &f
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
- if(!exception.property(QLatin1String("fileName")).toString().isEmpty()){
+ if (!exception.property(QLatin1String("fileName")).toString().isEmpty()){
qWarning() << exception.property(QLatin1String("fileName")).toString()
<< scriptEngine->uncaughtExceptionLineNumber()
<< exception.toString();
diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp
index 61890b9..108f2b2 100644
--- a/src/declarative/util/qmlsetproperties.cpp
+++ b/src/declarative/util/qmlsetproperties.cpp
@@ -80,7 +80,7 @@ QmlSetPropertiesMetaObject::QmlSetPropertiesMetaObject(QObject *obj)
void QmlSetPropertiesMetaObject::propertyRead(int id)
{
- if(!value(id).isValid())
+ if (!value(id).isValid())
setValue(id, QVariant::fromValue((QObject *)new QmlSetPropertiesProxyObject(object())));
QmlOpenMetaObject::propertyRead(id);
@@ -88,10 +88,10 @@ void QmlSetPropertiesMetaObject::propertyRead(int id)
void QmlSetPropertiesMetaObject::propertyWrite(int id)
{
- if(value(id).userType() == qMetaTypeId<QObject *>()) {
+ if (value(id).userType() == qMetaTypeId<QObject *>()) {
QObject *val = qvariant_cast<QObject *>(value(id));
QmlSetPropertiesProxyObject *proxy = qobject_cast<QmlSetPropertiesProxyObject *>(val);
- if(proxy) {
+ if (proxy) {
setValue(id, QVariant());
delete proxy;
}
@@ -203,9 +203,9 @@ QmlSetProperties::doAction(QmlSetPropertiesMetaObject *metaObject,
QmlMetaProperty prop(object, QLatin1String(name));
- if(po) {
+ if (po) {
QObject *objVal = QmlMetaType::toQObject(prop.read());
- if(!objVal) {
+ if (!objVal) {
qmlInfo(this) << object->metaObject()->className()
<< "has no object property named" << name;
continue;
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 9b1b695..5850a97 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -170,7 +170,7 @@ void QmlState::setWhen(QmlBindableValue *when)
{
Q_D(QmlState);
d->when = when;
- if(d->group)
+ if (d->group)
d->group->updateAutoState();
}
@@ -238,10 +238,10 @@ QmlState &QmlState::operator<<(QmlStateOperation *op)
#if 0
static void dump(const QmlStateOperation::ActionList &list)
{
- if(!QString(getenv("STATE_DEBUG")).isEmpty())
+ if (!QString(getenv("STATE_DEBUG")).isEmpty())
return;
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
const Action &action = list.at(ii);
qWarning() << action.property.object << action.property.name << action.toValue;
}
@@ -260,9 +260,9 @@ void QmlStatePrivate::complete()
}
//////////////////////////////////////////////////////////
- for(int ii = 0; ii < reverting.count(); ++ii) {
- for(int jj = 0; jj < revertList.count(); ++jj) {
- if(revertList.at(jj).property == reverting.at(ii)) {
+ for (int ii = 0; ii < reverting.count(); ++ii) {
+ for (int jj = 0; jj < revertList.count(); ++jj) {
+ if (revertList.at(jj).property == reverting.at(ii)) {
revertList.removeAt(jj);
break;
}
@@ -270,7 +270,7 @@ void QmlStatePrivate::complete()
}
reverting.clear();
- for(int ii = 0; ii < completeList.count(); ++ii) {
+ for (int ii = 0; ii < completeList.count(); ++ii) {
const QmlMetaProperty &prop = completeList.at(ii).property;
prop.write(completeList.at(ii).value);
}
@@ -283,15 +283,15 @@ void QmlStatePrivate::complete()
QmlStateOperation::ActionList QmlStatePrivate::generateActionList(QmlStateGroup *group) const
{
QmlStateOperation::ActionList applyList;
- if(inState)
+ if (inState)
return applyList;
inState = true;
- if(!extends.isEmpty()) {
+ if (!extends.isEmpty()) {
QList<QmlState *> states = group->states();
- for(int ii = 0; ii < states.count(); ++ii)
- if(states.at(ii)->name() == extends)
+ for (int ii = 0; ii < states.count(); ++ii)
+ if (states.at(ii)->name() == extends)
applyList = static_cast<QmlStatePrivate*>(states.at(ii)->d_ptr)->generateActionList(group);
}
@@ -328,41 +328,41 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
Q_D(QmlState);
cancel();
- if(revert)
+ if (revert)
revert->cancel();
d->revertList.clear();
d->reverting.clear();
d->bindingsList.clear();
- if(revert)
+ if (revert)
d->revertList = static_cast<QmlStatePrivate*>(revert->d_ptr)->revertList;
QmlStateOperation::RevertActionList additionalReverts;
QmlStateOperation::ActionList applyList = d->generateActionList(group);
- for(int ii = 0; ii < applyList.count(); ++ii) {
+ for (int ii = 0; ii < applyList.count(); ++ii) {
const Action &action = applyList.at(ii);
- if(action.event)
+ if (action.event)
continue;
bool found = false;
- for(int jj = 0; !found && jj < d->revertList.count(); ++jj) {
- if(d->revertList.at(jj).property == action.property)
+ for (int jj = 0; !found && jj < d->revertList.count(); ++jj) {
+ if (d->revertList.at(jj).property == action.property)
found = true;
}
- if(!found) {
+ if (!found) {
RevertAction r(action);
additionalReverts << r;
}
}
- for(int ii = 0; ii < d->revertList.count(); ++ii) {
+ for (int ii = 0; ii < d->revertList.count(); ++ii) {
bool found = false;
- for(int jj = 0; !found && jj < applyList.count(); ++jj) {
+ for (int jj = 0; !found && jj < applyList.count(); ++jj) {
const Action &action = applyList.at(jj);
- if(action.property == d->revertList.at(ii).property)
+ if (action.property == d->revertList.at(ii).property)
found = true;
}
- if(!found) {
+ if (!found) {
QVariant cur = d->revertList.at(ii).property.read();
Action a;
a.property = d->revertList.at(ii).property;
@@ -384,7 +384,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
//### 4 foreach loops!
////////////////////////////////////////////////////////////////////
foreach(const Action &action, applyList) {
- if(stateChangeDebug())
+ if (stateChangeDebug())
qWarning() << " Action:" << action.property.object() << action.property.name() << action.toValue;
if (action.bv && !action.toBinding.isEmpty()) {
@@ -397,14 +397,14 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
foreach(const Action &action, applyList) {
if (action.bv && !action.toBinding.isEmpty()) {
action.bv->setExpression(action.toBinding);
- } else if(!action.event) {
+ } else if (!action.event) {
action.property.write(action.toValue);
}
}
for (int ii = 0; ii < applyList.size(); ++ii) {
Action *action = &applyList[ii];
- if(action->event)
+ if (action->event)
continue;
const QmlMetaProperty &prop = action->property;
@@ -414,7 +414,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
foreach(const Action &action, applyList) {
- if(action.event)
+ if (action.event)
continue;
if (action.bv && !action.toBinding.isEmpty())
@@ -427,23 +427,23 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
QmlStateOperation::ActionList modList = applyList;
QList<QmlMetaProperty> touched;
d->completeList.clear();
- if(trans) {
+ if (trans) {
d->transition = trans;
trans->prepare(modList, touched, this);
- for(int ii = 0; ii < modList.count(); ++ii) {
+ for (int ii = 0; ii < modList.count(); ++ii) {
const Action &action = modList.at(ii);
- if(action.event) {
- if(action.actionDone) {
+ if (action.event) {
+ if (action.actionDone) {
modList.removeAt(ii);
--ii;
}
} else {
- if(action.toValue != action.fromValue) {
+ if (action.toValue != action.fromValue) {
d->completeList << RevertAction(action, false);
}
- if(touched.contains(action.property)) {
+ if (touched.contains(action.property)) {
modList.removeAt(ii);
--ii;
}
@@ -452,7 +452,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
foreach(const Action &action, modList) {
- if(action.event)
+ if (action.event)
action.event->execute();
else
action.property.write(action.toValue);
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index 36fea4e..cabef63 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -68,7 +68,7 @@ public:
:group(g) {}
void append(QmlState *s) {
QmlConcreteList<QmlState *>::append(s);
- if(s) s->setStateGroup(group);
+ if (s) s->setStateGroup(group);
}
private:
QmlStateGroup *group;
@@ -121,7 +121,7 @@ QString QmlStateGroup::state() const
void QmlStateGroup::setState(const QString &state)
{
Q_D(QmlStateGroup);
- if(d->currentState == state)
+ if (d->currentState == state)
return;
d->setCurrentStateInternal(state);
@@ -152,27 +152,27 @@ void QmlStateGroup::updateAutoState()
void QmlStateGroupPrivate::updateAutoState()
{
Q_Q(QmlStateGroup);
- if(!classComplete)
+ if (!classComplete)
return;
bool revert = false;
- for(int ii = 0; ii < states.count(); ++ii) {
+ for (int ii = 0; ii < states.count(); ++ii) {
QmlState *state = states.at(ii);
- if(state->isWhenKnown()) {
- if(!state->name().isEmpty()) {
- if(state->when() && state->when()->value().toBool()) {
- if(stateChangeDebug())
+ if (state->isWhenKnown()) {
+ if (!state->name().isEmpty()) {
+ if (state->when() && state->when()->value().toBool()) {
+ if (stateChangeDebug())
qWarning() << "Setting auto state due to:"
<< state->when()->expression();
q->setState(state->name());
return;
- } else if(state->name() == currentState) {
+ } else if (state->name() == currentState) {
revert = true;
}
}
}
}
- if(revert)
+ if (revert)
q->setState(QString());
}
@@ -183,11 +183,11 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
bool reversed = false;
bool done = false;
- for(int ii = 0; !done && ii < transitions.count(); ++ii) {
+ for (int ii = 0; !done && ii < transitions.count(); ++ii) {
QmlTransition *t = transitions.at(ii);
- for(int ii = 0; ii < 2; ++ii)
+ for (int ii = 0; ii < 2; ++ii)
{
- if(ii && (!t->reversible() ||
+ if (ii && (!t->reversible() ||
(t->fromState() == QLatin1String("*") &&
t->toState() == QLatin1String("*"))))
break;
@@ -196,40 +196,40 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
fromState = t->fromState().split(QLatin1Char(','));
toState = t->toState().split(QLatin1Char(','));
- if(ii == 1)
+ if (ii == 1)
qSwap(fromState, toState);
int tScore = 0;
- if(fromState.contains(from))
+ if (fromState.contains(from))
tScore += 2;
- else if(fromState.contains(QLatin1String("*")))
+ else if (fromState.contains(QLatin1String("*")))
tScore += 1;
else
continue;
- if(toState.contains(to))
+ if (toState.contains(to))
tScore += 2;
- else if(toState.contains(QLatin1String("*")))
+ else if (toState.contains(QLatin1String("*")))
tScore += 1;
else
continue;
- if(ii == 1)
+ if (ii == 1)
reversed = true;
else
reversed = false;
- if(tScore == 4) {
+ if (tScore == 4) {
highest = t;
done = true;
break;
- } else if(tScore > score) {
+ } else if (tScore > score) {
score = tScore;
highest = t;
}
}
}
- if(highest)
+ if (highest)
highest->setReversed(reversed);
return highest;
@@ -239,21 +239,21 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
bool ignoreTrans)
{
Q_Q(QmlStateGroup);
- if(!componentComplete)
+ if (!componentComplete)
return;
QmlTransition *transition = (ignoreTrans || ignoreTrans) ? 0 : findTransition(currentState, state);
- if(stateChangeDebug()) {
+ if (stateChangeDebug()) {
qWarning() << this << "Changing state. From" << currentState << ". To" << state;
- if(transition)
+ if (transition)
qWarning() << " using transition" << transition->fromState()
<< transition->toState();
}
QmlState *oldState = 0;
- if(!currentState.isEmpty()) {
- for(int ii = 0; ii < states.count(); ++ii) {
- if(states.at(ii)->name() == currentState) {
+ if (!currentState.isEmpty()) {
+ for (int ii = 0; ii < states.count(); ++ii) {
+ if (states.at(ii)->name() == currentState) {
oldState = states.at(ii);
break;
}
@@ -263,17 +263,17 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
currentState = state;
QmlState *newState = 0;
- for(int ii = 0; ii < states.count(); ++ii) {
- if(states.at(ii)->name() == currentState) {
+ for (int ii = 0; ii < states.count(); ++ii) {
+ if (states.at(ii)->name() == currentState) {
newState = states.at(ii);
break;
}
}
- if(oldState == 0 || newState == 0) {
- if(!nullState) { nullState = new QmlState(q); }
- if(!oldState) oldState = nullState;
- if(!newState) newState = nullState;
+ if (oldState == 0 || newState == 0) {
+ if (!nullState) { nullState = new QmlState(q); }
+ if (!oldState) oldState = nullState;
+ if (!newState) newState = nullState;
}
newState->apply(q, transition, oldState);
@@ -284,7 +284,7 @@ void QmlStateGroup::componentComplete()
Q_D(QmlStateGroup);
d->updateAutoState();
d->componentComplete = true;
- if(!d->currentState.isEmpty()) {
+ if (!d->currentState.isEmpty()) {
QString cs = d->currentState;
d->currentState = QString();
d->setCurrentStateInternal(cs, true);
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index c70977a..8a10ca3 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -109,7 +109,7 @@ void QmlParentChange::setParent(QObject *parent)
QmlStateOperation::ActionList QmlParentChange::actions()
{
Q_D(QmlParentChange);
- if(!d->target || !d->parent)
+ if (!d->target || !d->parent)
return ActionList();
QString propName(QLatin1String("moveToParent"));
@@ -118,7 +118,7 @@ QmlStateOperation::ActionList QmlParentChange::actions()
qmlInfo(this) << d->target->metaObject()->className()
<< "has no property named" << propName;
return ActionList();
- }else if(!prop.isWritable()){
+ }else if (!prop.isWritable()){
qmlInfo(this) << d->target->metaObject()->className() << propName
<< "is not a writable property and cannot be set.";
return ActionList();
@@ -187,7 +187,7 @@ void QmlRunScript::setName(const QString &n)
void QmlRunScript::execute()
{
Q_D(QmlRunScript);
- if(!d->script.isEmpty()) {
+ if (!d->script.isEmpty()) {
QmlExpression expr(qmlContext(this), d->script, this);
expr.setTrackChange(false);
expr.value();
@@ -354,7 +354,7 @@ void QmlSetProperty::setBinding(const QString &binding)
QmlSetProperty::ActionList QmlSetProperty::actions()
{
Q_D(QmlSetProperty);
- if(!d->obj)
+ if (!d->obj)
return ActionList();
QObject *obj = d->obj;
@@ -362,10 +362,10 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
if (d->prop.contains(QLatin1Char('.'))) { //handle dot properties
QStringList str = d->prop.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count()-1; ++ii) {
+ for (int ii = 0; ii < str.count()-1; ++ii) {
const QString &s = str.at(ii);
QmlMetaProperty prop(obj, s);
- if(!prop.isValid()) {
+ if (!prop.isValid()) {
qmlInfo(this) << obj->metaObject()->className()
<< "has no property named" << s;
return ActionList();
@@ -386,7 +386,7 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
qmlInfo(this) << obj->metaObject()->className()
<< "has no property named" << propName;
return ActionList();
- }else if(!prop.isWritable()){
+ }else if (!prop.isWritable()){
qmlInfo(this) << obj->metaObject()->className() << propName
<< "is not a writable property and cannot be set.";
return ActionList();
@@ -399,7 +399,7 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
a.toValue = d->value;
if (!d->binding.isEmpty()) {
QmlBindableValue *bv = prop.binding();
- if(bv) {
+ if (bv) {
a.fromBinding = bv->expression();
a.bv = bv;
}
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 181fdb9..a515f58 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -165,12 +165,12 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
{
Q_D(QmlTransition);
- if(d->reversed) {
- for(int ii = d->operations.count() - 1; ii >= 0; --ii) {
+ if (d->reversed) {
+ for (int ii = d->operations.count() - 1; ii >= 0; --ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Backward);
}
} else {
- for(int ii = 0; ii < d->operations.count(); ++ii) {
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
}
}
diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp
index 52ccc0d..8065f9d 100644
--- a/src/declarative/util/qperformancelog.cpp
+++ b/src/declarative/util/qperformancelog.cpp
@@ -77,22 +77,22 @@ QPerformanceLog::LogData::LogData(const char *desc)
QPerformanceLog::LogMetric::LogMetric(LogData *l, int id, const char *desc)
{
- if(id < 0)
+ if (id < 0)
qFatal("QPerformanceLog: Invalid log id %d ('%s')", id, desc);
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::Iterator logIter = logData->logs.find(l);
- if(logIter == logData->logs.end())
+ if (logIter == logData->logs.end())
qFatal("QPerformanceLog: Unable to locate log for metric '%s'", desc);
QPerformanceLogData::Log &log = *logIter;
- if(log.descriptions.contains(id))
+ if (log.descriptions.contains(id))
qFatal("QPerformanceLog: Duplicate log metric %d ('%s')", id, desc);
log.descriptions.insert(id, desc);
- if(log.maxId < id) {
+ if (log.maxId < id) {
log.maxId = id;
- if(l->data) delete [] l->data;
+ if (l->data) delete [] l->data;
l->data = new unsigned int[2 * (log.maxId + 1)];
::memset(l->data, 0, 2 * (log.maxId + 1) * sizeof(unsigned int));
}
@@ -107,7 +107,7 @@ static void QPerformanceLog_displayData(const QPerformanceLog::LogData *l, const
{
qWarning() << pl->logDescription << "performance data";
unsigned int total = 0;
- for(QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin();
+ for (QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin();
iter != pl->descriptions.end();
++iter) {
@@ -126,7 +126,7 @@ void QPerformanceLog::displayData()
{
QPerformanceLogData *logData = performanceLogData();
- for(QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
+ for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
iter != logData->logs.end();
++iter) {
QPerformanceLog_displayData(iter.key(), &(*iter));
@@ -137,7 +137,7 @@ void QPerformanceLog::clear()
{
QPerformanceLogData *logData = performanceLogData();
- for(QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
+ for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
iter != logData->logs.end();
++iter) {
QPerformanceLog_clear(iter.key(), &(*iter));
@@ -148,7 +148,7 @@ void QPerformanceLog::displayData(LogData *l)
{
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l);
- if(iter == logData->logs.end())
+ if (iter == logData->logs.end())
qFatal("QPerformanceLog: Internal corruption - unable to locate log");
QPerformanceLog_displayData(iter.key(), &(*iter));
@@ -158,7 +158,7 @@ void QPerformanceLog::clear(LogData *l)
{
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l);
- if(iter == logData->logs.end())
+ if (iter == logData->logs.end())
qFatal("QPerformanceLog: Internal corruption - unable to locate log");
QPerformanceLog_clear(iter.key(), &(*iter));
diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
index 8e0081b..d6c4ac2 100644
--- a/src/declarative/widgets/graphicslayouts.cpp
+++ b/src/declarative/widgets/graphicslayouts.cpp
@@ -119,7 +119,7 @@ void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutIte
insertItem(index, item);
//connect attached properties
- if(QObject *obj = attachedProperties.value(item)) {
+ if (QObject *obj = attachedProperties.value(item)) {
setStretchFactor(item, static_cast<LinearLayoutAttached *>(obj)->stretchFactor());
setAlignment(item, static_cast<LinearLayoutAttached *>(obj)->alignment());
QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
@@ -261,7 +261,7 @@ QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
{
//use attached properties
- if(QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
+ if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
int row = static_cast<GridLayoutAttached *>(obj)->row();
int column = static_cast<GridLayoutAttached *>(obj)->column();
int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
@@ -277,7 +277,7 @@ void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
{
//use attached properties
- if(QObject *obj = attachedProperties.value(item)) {
+ if (QObject *obj = attachedProperties.value(item)) {
int row = static_cast<GridLayoutAttached *>(obj)->row();
int column = static_cast<GridLayoutAttached *>(obj)->column();
int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp
index 1d0e638..b808807 100644
--- a/src/declarative/widgets/graphicswidgets.cpp
+++ b/src/declarative/widgets/graphicswidgets.cpp
@@ -84,13 +84,13 @@ private:
virtual void clear()
{
for (int i = 0; i < count(); ++i)
- if(QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
+ if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
static_cast<QGraphicsScene *>(q)->removeItem(w);
QmlConcreteList<QObject *>::clear();
}
virtual void removeAt(int i)
{
- if(QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
+ if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
static_cast<QGraphicsScene *>(q)->removeItem(w);
QmlConcreteList<QObject *>::removeAt(i);
}
@@ -99,7 +99,7 @@ private:
QmlConcreteList<QObject *>::insert(i, o);
//XXX are there any cases when insertion should be different from appension?
- if(QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(o))
+ if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(o))
static_cast<QGraphicsScene *>(q)->addItem(w);
//else if (QWidget *w = qobject_cast<QWidget *>(o))
// static_cast<QGraphicsScene *>(q)->addWidget(w);