aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickstackview_p.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-11 18:24:18 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-12 12:44:07 +0000
commit244cc6eec931f0b46e3d2b8ea32f03b32cb1023e (patch)
treebd590e8e4b98e82ba6b820d8543b486f4082fb4c /src/templates/qquickstackview_p.cpp
parent8d5a8ee53d089cea7543040ecb11d165ab34c506 (diff)
Templates: follow the Qt coding style
Return early to keep the indentation low. This style was already used in many areas, so now the same style is consistently used everywhere. Change-Id: Ibc7c05147fdcf226ad1cbdd26cd70e1da89108af Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickstackview_p.cpp')
-rw-r--r--src/templates/qquickstackview_p.cpp63
1 files changed, 34 insertions, 29 deletions
diff --git a/src/templates/qquickstackview_p.cpp b/src/templates/qquickstackview_p.cpp
index 5d967a0e..63cc1800 100644
--- a/src/templates/qquickstackview_p.cpp
+++ b/src/templates/qquickstackview_p.cpp
@@ -187,32 +187,35 @@ void QQuickStackElement::initialize()
void QQuickStackElement::setIndex(int value)
{
- if (index != value) {
- index = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->indexChanged();
- }
+ if (index == value)
+ return;
+
+ index = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->indexChanged();
}
void QQuickStackElement::setView(QQuickStackView *value)
{
- if (view != value) {
- view = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->viewChanged();
- }
+ if (view == value)
+ return;
+
+ view = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->viewChanged();
}
void QQuickStackElement::setStatus(QQuickStackView::Status value)
{
- if (status != value) {
- status = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->statusChanged();
- }
+ if (status == value)
+ return;
+
+ status = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->statusChanged();
}
void QQuickStackElement::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget)
@@ -251,12 +254,13 @@ QQuickStackViewPrivate::QQuickStackViewPrivate() : busy(false), currentItem(null
void QQuickStackViewPrivate::setCurrentItem(QQuickItem *item)
{
Q_Q(QQuickStackView);
- if (currentItem != item) {
- currentItem = item;
- if (item)
- item->setVisible(true);
- emit q->currentItemChanged();
- }
+ if (currentItem == item)
+ return;
+
+ currentItem = item;
+ if (item)
+ item->setVisible(true);
+ emit q->currentItemChanged();
}
static bool initProperties(QQuickStackElement *element, const QV4::Value &props, QQmlV4Function *args)
@@ -528,11 +532,12 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
void QQuickStackViewPrivate::setBusy(bool b)
{
Q_Q(QQuickStackView);
- if (busy != b) {
- busy = b;
- q->setFiltersChildMouseEvents(busy);
- emit q->busyChanged();
- }
+ if (busy == b)
+ return;
+
+ busy = b;
+ q->setFiltersChildMouseEvents(busy);
+ emit q->busyChanged();
}
QT_END_NAMESPACE