diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-10-11 22:48:29 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-10-12 09:07:54 +0200 |
commit | 9a772306854bf0ca2f0c16699744136530656f43 (patch) | |
tree | 579fddf949e8371a6a546c08161c6b62f05d5840 /src/widgets/itemviews | |
parent | 9684764bda49b7dee07ff6cd1d919ccee5631153 (diff) |
QTableWidgetSelectionRange: Make it possible to compare for equality
Add operators as hidden friends, add test case to make sure that
basic value-type operations are possible with this type.
Task-number: QTBUG-255
Change-Id: I7fbf453aa16084c0b2a0079487cacb4e092ff664
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qtablewidget.cpp | 14 | ||||
-rw-r--r-- | src/widgets/itemviews/qtablewidget.h | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 5072cc9240..5c3d3385da 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -919,6 +919,20 @@ Qt::DropActions QTableModel::supportedDropActions() const */ /*! + \fn bool QTableWidgetSelectionRange::operator==(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs) + \since 6.3 + + Returns true if \a lhs and \a rhs are equal, otherwise returns false. +*/ + +/*! + \fn bool QTableWidgetSelectionRange::operator!=(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs) + \since 6.3 + + Returns true if \a lhs and \a rhs are not equal, otherwise returns false. +*/ + +/*! \fn int QTableWidgetSelectionRange::topRow() const Returns the top row of the range. diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 8f3a36daf1..3978bc23d6 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -57,6 +57,14 @@ public: : m_top(top), m_left(left), m_bottom(bottom), m_right(right) {} + friend inline bool operator==(const QTableWidgetSelectionRange &lhs, + const QTableWidgetSelectionRange &rhs) + { return lhs.m_top == rhs.m_top && lhs.m_left == rhs.m_left + && lhs.m_bottom == rhs.m_bottom && lhs.m_right == rhs.m_right; }; + friend inline bool operator!=(const QTableWidgetSelectionRange &lhs, + const QTableWidgetSelectionRange &rhs) + { return !(lhs == rhs); } + inline int topRow() const { return m_top; } inline int bottomRow() const { return m_bottom; } inline int leftColumn() const { return m_left; } |