aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-12 14:25:02 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-20 16:08:39 +0000
commitf867450b0b9aba7aa7eb7e344d24229ffed39794 (patch)
treee382dcddec79d0682c6be9b4ee89937dee0ec9c0 /src
parent23b820d018adeb5b07704e3a1ef5ea23a90c8af7 (diff)
Universal: 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: I6db941be07b153c7448dd418256c792186f71e58 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring.cpp22
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip.cpp11
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp70
3 files changed, 56 insertions, 47 deletions
diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp
index 9b95341d..f69ad704 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp
@@ -191,11 +191,12 @@ int QQuickUniversalProgressRing::count() const
void QQuickUniversalProgressRing::setCount(int count)
{
- if (m_count != count) {
- m_count = count;
- update();
- emit countChanged();
- }
+ if (m_count == count)
+ return;
+
+ m_count = count;
+ update();
+ emit countChanged();
}
QColor QQuickUniversalProgressRing::color() const
@@ -205,11 +206,12 @@ QColor QQuickUniversalProgressRing::color() const
void QQuickUniversalProgressRing::setColor(const QColor &color)
{
- if (m_color != color) {
- m_color = color;
- update();
- emit colorChanged();
- }
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ update();
+ emit colorChanged();
}
QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
index c4fab7ae..c22af2b6 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
@@ -241,11 +241,12 @@ QColor QQuickUniversalProgressStrip::color() const
void QQuickUniversalProgressStrip::setColor(const QColor &color)
{
- if (m_color != color) {
- m_color = color;
- update();
- emit colorChanged();
- }
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ update();
+ emit colorChanged();
}
QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
index 49b2d9f7..17a214f4 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -154,22 +154,24 @@ QQuickUniversalStyle::Theme QQuickUniversalStyle::theme() const
void QQuickUniversalStyle::setTheme(Theme theme)
{
m_hasTheme = true;
- if (m_theme != theme) {
- m_theme = theme;
- propagateTheme();
- emit themeChanged();
- emit paletteChanged();
- }
+ if (m_theme == theme)
+ return;
+
+ m_theme = theme;
+ propagateTheme();
+ emit themeChanged();
+ emit paletteChanged();
}
void QQuickUniversalStyle::inheritTheme(Theme theme)
{
- if (!m_hasTheme && m_theme != theme) {
- m_theme = theme;
- propagateTheme();
- emit themeChanged();
- emit paletteChanged();
- }
+ if (m_hasTheme || m_theme == theme)
+ return;
+
+ m_theme = theme;
+ propagateTheme();
+ emit themeChanged();
+ emit paletteChanged();
}
void QQuickUniversalStyle::propagateTheme()
@@ -184,11 +186,12 @@ void QQuickUniversalStyle::propagateTheme()
void QQuickUniversalStyle::resetTheme()
{
- if (m_hasTheme) {
- m_hasTheme = false;
- QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritTheme(universal ? universal->theme() : DefaultTheme);
- }
+ if (!m_hasTheme)
+ return;
+
+ m_hasTheme = false;
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
+ inheritTheme(universal ? universal->theme() : DefaultTheme);
}
QVariant QQuickUniversalStyle::accent() const
@@ -221,20 +224,22 @@ void QQuickUniversalStyle::setAccent(const QVariant &var)
}
m_hasAccent = true;
- if (m_accent != accent) {
- m_accent = accent;
- propagateAccent();
- emit accentChanged();
- }
+ if (m_accent == accent)
+ return;
+
+ m_accent = accent;
+ propagateAccent();
+ emit accentChanged();
}
void QQuickUniversalStyle::inheritAccent(QRgb accent)
{
- if (!m_hasAccent && m_accent != accent) {
- m_accent = accent;
- propagateAccent();
- emit accentChanged();
- }
+ if (m_hasAccent || m_accent == accent)
+ return;
+
+ m_accent = accent;
+ propagateAccent();
+ emit accentChanged();
}
void QQuickUniversalStyle::propagateAccent()
@@ -249,11 +254,12 @@ void QQuickUniversalStyle::propagateAccent()
void QQuickUniversalStyle::resetAccent()
{
- if (m_hasAccent) {
- m_hasAccent = false;
- QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritAccent(universal ? universal->m_accent : DefaultAccent);
- }
+ if (!m_hasAccent)
+ return;
+
+ m_hasAccent = false;
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
+ inheritAccent(universal ? universal->m_accent : DefaultAccent);
}
QColor QQuickUniversalStyle::altHighColor() const