diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-12 14:14:02 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-14 15:52:58 +0200 |
commit | 6f0df02d002356625f10683ef84da7685d92a2c4 (patch) | |
tree | 46713209af459ebda534c3404f48c5f5c80ba3f8 /src/widgets/itemviews | |
parent | 44cce1a2ea9dadd8b2de93f40de34269dda703c0 (diff) |
Replace Qt CONSTEXPR defines with constexpr
Both normal and relaxed constexpr are required by our new minimum of
C++17.
Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qlistview_p.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 07f4ae4a90..cb41c87043 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -68,28 +68,28 @@ class QListViewItem friend class QListModeViewBase; friend class QIconModeViewBase; public: - Q_DECL_CONSTEXPR QListViewItem() + constexpr QListViewItem() : x(-1), y(-1), w(0), h(0), indexHint(-1), visited(0xffff) {} - Q_DECL_CONSTEXPR QListViewItem(QRect r, int i) + constexpr QListViewItem(QRect r, int i) : x(r.x()), y(r.y()), w(qMin(r.width(), SHRT_MAX)), h(qMin(r.height(), SHRT_MAX)), indexHint(i), visited(0xffff) {} - Q_DECL_CONSTEXPR bool operator==(const QListViewItem &other) const { + constexpr bool operator==(const QListViewItem &other) const { return (x == other.x && y == other.y && w == other.w && h == other.h && indexHint == other.indexHint); } - Q_DECL_CONSTEXPR bool operator!=(const QListViewItem &other) const + constexpr bool operator!=(const QListViewItem &other) const { return !(*this == other); } - Q_DECL_CONSTEXPR bool isValid() const + constexpr bool isValid() const { return rect().isValid() && (indexHint > -1); } - Q_DECL_RELAXED_CONSTEXPR void invalidate() + constexpr void invalidate() { x = -1; y = -1; w = 0; h = 0; } - Q_DECL_RELAXED_CONSTEXPR void resize(QSize size) + constexpr void resize(QSize size) { w = qMin(size.width(), SHRT_MAX); h = qMin(size.height(), SHRT_MAX); } - Q_DECL_RELAXED_CONSTEXPR void move(QPoint position) + constexpr void move(QPoint position) { x = position.x(); y = position.y(); } - Q_DECL_CONSTEXPR int width() const { return w; } - Q_DECL_CONSTEXPR int height() const { return h; } + constexpr int width() const { return w; } + constexpr int height() const { return h; } private: - Q_DECL_CONSTEXPR QRect rect() const + constexpr QRect rect() const { return QRect(x, y, w, h); } int x, y; short w, h; |