summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qitemselectionmodel.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-07-20 01:28:47 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-22 21:12:32 +0000
commit562c01d04e6b779c754cc9e7164d48e91b92a0d1 (patch)
tree394fe492b9b98dbc3b44fe9ffd8ca186a78b64f9 /src/corelib/itemmodels/qitemselectionmodel.h
parent02affdb8913c9b2633d918000e0b23bf5e3cf3ec (diff)
QItemSelectionRange: use ctor-init-list
Avoids default-constructing two QPersistentModelIndex instances just to copy-assign to them. Change-Id: I0f3e04e3d202f58905f74df44d37dba27911a927 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/corelib/itemmodels/qitemselectionmodel.h')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index e548a49b3d..4013beb539 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -48,12 +48,11 @@ class Q_CORE_EXPORT QItemSelectionRange
{
public:
- inline QItemSelectionRange() {}
+ inline QItemSelectionRange() : tl(), br() {}
inline QItemSelectionRange(const QItemSelectionRange &other)
: tl(other.tl), br(other.br) {}
- inline QItemSelectionRange(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- explicit inline QItemSelectionRange(const QModelIndex &index)
- { tl = index; br = tl; }
+ QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR) : tl(topL), br(bottomR) {}
+ explicit QItemSelectionRange(const QModelIndex &index) : tl(index), br(tl) {}
void swap(QItemSelectionRange &other) Q_DECL_NOTHROW
{
@@ -139,10 +138,6 @@ private:
};
Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_MOVABLE_TYPE);
-inline QItemSelectionRange::QItemSelectionRange(const QModelIndex &atopLeft,
- const QModelIndex &abottomRight)
-{ tl = atopLeft; br = abottomRight; }
-
class QItemSelection;
class QItemSelectionModelPrivate;