diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2016-05-18 15:41:24 +0200 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-06-14 17:23:38 +0000 |
commit | 58566686fcfceee1caeab88d0531816f4df49192 (patch) | |
tree | cfc322f296b7c1f6066cdb0e2760889132b5aa55 /src/corelib/tools/qsize.h | |
parent | 197471beacf5589802cb91f1ceba59ed99cbb511 (diff) |
darwin: Add Foundation conversion functions for QSize/QSizeF
The fromCGPoint function was left out for QSize, as the foundation type is
using CGFloats internally. Clients should use an explicit QSizeF::toSize()
when potentially throwing away precision.
Change-Id: I12d43ae0881f09ad8d79f2caaa000c3983f4ef30
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/corelib/tools/qsize.h')
-rw-r--r-- | src/corelib/tools/qsize.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h index 5d40c4079a..74698224f2 100644 --- a/src/corelib/tools/qsize.h +++ b/src/corelib/tools/qsize.h @@ -42,6 +42,10 @@ #include <QtCore/qnamespace.h> +#if defined(Q_OS_DARWIN) +struct CGSize; +#endif + QT_BEGIN_NAMESPACE @@ -86,6 +90,10 @@ public: friend inline Q_DECL_CONSTEXPR const QSize operator*(qreal, const QSize &) Q_DECL_NOTHROW; friend inline const QSize operator/(const QSize &, qreal); +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; +#endif + private: int wd; int ht; @@ -248,6 +256,11 @@ public: Q_DECL_CONSTEXPR inline QSize toSize() const Q_DECL_NOTHROW; +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW Q_REQUIRED_RESULT; + CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; +#endif + private: qreal wd; qreal ht; |