summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-11 13:55:43 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-12 11:09:16 +0000
commit99bda08cb1ea14a29deefe9dabe276c38648c899 (patch)
treec40f0ea9a64c4e9c977373d828b96d4fe9cb99c6
parentc34cf6131221dac2ea8745a5c93b57c13dd8533c (diff)
downloadqtmultimedia-99bda08cb1ea14a29deefe9dabe276c38648c899.tar.gz
QCameraViewFinderSettings: make op== non-member
...and inline op!=. Mark them as nothrow. More idiomatic C++ (symmetry between lhs and rhs). Change-Id: I65ecbef961383897e4e17325ad62d45e1772fbb0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/multimedia/camera/qcameraviewfindersettings.cpp31
-rw-r--r--src/multimedia/camera/qcameraviewfindersettings.h7
2 files changed, 22 insertions, 16 deletions
diff --git a/src/multimedia/camera/qcameraviewfindersettings.cpp b/src/multimedia/camera/qcameraviewfindersettings.cpp
index a6290cfb7..059c93f6a 100644
--- a/src/multimedia/camera/qcameraviewfindersettings.cpp
+++ b/src/multimedia/camera/qcameraviewfindersettings.cpp
@@ -136,32 +136,35 @@ QCameraViewfinderSettings &QCameraViewfinderSettings::operator=(const QCameraVie
}
/*!
- Determines if \a other is of equal value to a viewfinder settings object.
+ \relates QCameraViewfinderSettings
+ \since 5.5
+
+ Determines if \a lhs is of equal value to \a rhs.
Returns true if the settings objects are of equal value, and false if they
are not of equal value.
*/
-bool QCameraViewfinderSettings::operator==(const QCameraViewfinderSettings &other) const
+bool operator==(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW
{
- return (d == other.d) ||
- (d->isNull == other.d->isNull &&
- d->resolution == other.d->resolution &&
- qFuzzyCompare(d->minimumFrameRate, other.d->minimumFrameRate) &&
- qFuzzyCompare(d->maximumFrameRate, other.d->maximumFrameRate) &&
- d->pixelFormat == other.d->pixelFormat &&
- d->pixelAspectRatio == other.d->pixelAspectRatio);
+ return (lhs.d == rhs.d) ||
+ (lhs.d->isNull == rhs.d->isNull &&
+ lhs.d->resolution == rhs.d->resolution &&
+ qFuzzyCompare(lhs.d->minimumFrameRate, rhs.d->minimumFrameRate) &&
+ qFuzzyCompare(lhs.d->maximumFrameRate, rhs.d->maximumFrameRate) &&
+ lhs.d->pixelFormat == rhs.d->pixelFormat &&
+ lhs.d->pixelAspectRatio == rhs.d->pixelAspectRatio);
}
/*!
- Determines if \a other is of equal value to a viewfinder settings object.
+ \fn bool operator!=(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs)
+ \relates QCameraViewfinderSettings
+ \since 5.5
+
+ Determines if \a lhs is of equal value to \a rhs.
Returns true if the settings objects are not of equal value, and false if
they are of equal value.
*/
-bool QCameraViewfinderSettings::operator!=(const QCameraViewfinderSettings &other) const
-{
- return !(*this == other);
-}
/*!
Identifies if a viewfinder settings object is uninitalized.
diff --git a/src/multimedia/camera/qcameraviewfindersettings.h b/src/multimedia/camera/qcameraviewfindersettings.h
index db9d3d8eb..dcdf025fc 100644
--- a/src/multimedia/camera/qcameraviewfindersettings.h
+++ b/src/multimedia/camera/qcameraviewfindersettings.h
@@ -52,9 +52,8 @@ public:
~QCameraViewfinderSettings();
QCameraViewfinderSettings& operator=(const QCameraViewfinderSettings &other);
- bool operator==(const QCameraViewfinderSettings &other) const;
- bool operator!=(const QCameraViewfinderSettings &other) const;
+ friend Q_MULTIMEDIA_EXPORT bool operator==(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW;
bool isNull() const;
QSize resolution() const;
@@ -80,6 +79,10 @@ private:
QSharedDataPointer<QCameraViewfinderSettingsPrivate> d;
};
+inline bool operator!=(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW
+{ return !operator==(lhs, rhs); }
+
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QCameraViewfinderSettings)