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>
This commit is contained in:
Marc Mutz 2015-07-20 01:28:47 +02:00
parent 02affdb891
commit 562c01d04e

View File

@ -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;