summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-04-08 19:44:48 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-12 07:48:24 +0000
commite593891b151ee5feac9937fad351ede7dcbb4411 (patch)
tree7db5f66f7fb2eb69bd2e215d1c95b9ff1478770d /src
parentd0f64542c8e6ec272d3fa19cf25ffe7ac33a99bc (diff)
Add qHash(QSizePolicy)
Size policies can be compared for equality, so qHash should be overloaded, too. [ChangeLog][QtWidgets][QSizePolicy] Added qHash(QSizePolicy). Change-Id: Id219f47ac6cb236efdd73cad7b892c8efd034d5c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp9
-rw-r--r--src/widgets/kernel/qsizepolicy.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp
index 1476b4c5d7..3c28f5ccf7 100644
--- a/src/widgets/kernel/qsizepolicy.cpp
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -332,6 +332,15 @@ void QSizePolicy::setControlType(ControlType type)
*/
/*!
+ \fn uint qHash(QSizePolicy key, uint seed = 0)
+ \since 5.6
+ \relates QSizePolicy
+
+ Returns the hash value for \a key, using
+ \a seed to seed the calculation.
+*/
+
+/*!
\fn int QSizePolicy::horizontalStretch() const
Returns the horizontal stretch factor of the size policy.
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 6cd511f513..7c9a356973 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -40,6 +40,9 @@ QT_BEGIN_NAMESPACE
class QVariant;
+class QSizePolicy;
+
+Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
class Q_WIDGETS_EXPORT QSizePolicy
{
@@ -112,6 +115,9 @@ public:
bool operator==(const QSizePolicy& s) const { return data == s.data; }
bool operator!=(const QSizePolicy& s) const { return data != s.data; }
+
+ friend Q_DECL_CONST_FUNCTION uint qHash(QSizePolicy key, uint seed) Q_DECL_NOTHROW { return qHash(key.data, seed); }
+
operator QVariant() const;
int horizontalStretch() const { return static_cast<int>(bits.horStretch); }