X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fcbf79f9aef26dc7d423e58d1b5cdaf1b8af3be2..b65576a131eb59eaab4d33af830bdb2d2f9fde9f:/src/kitemviews/kitemmodelbase.h diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index a7773ee3b..a6ba3f7c4 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -1,8 +1,7 @@ /*************************************************************************** * Copyright (C) 2011 by Peter Penz * * * - * Based on the Itemviews NG project from Trolltech Labs: * - * http://qt.gitorious.org/qt-labs/itemviews-ng * + * Based on the Itemviews NG project from Trolltech Labs * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -24,13 +23,12 @@ #define KITEMMODELBASE_H #include "dolphin_export.h" +#include "kitemviews/kitemrange.h" +#include "kitemviews/kitemset.h" -#include -#include - -#include #include #include +#include #include class QMimeData; @@ -55,9 +53,9 @@ class DOLPHIN_EXPORT KItemModelBase : public QObject Q_OBJECT public: - KItemModelBase(QObject* parent = 0); - explicit KItemModelBase(const QByteArray& sortRole, QObject* parent = 0); - virtual ~KItemModelBase(); + explicit KItemModelBase(QObject* parent = nullptr); + explicit KItemModelBase(const QByteArray& sortRole, QObject* parent = nullptr); + ~KItemModelBase() override; /** @return The number of items. */ virtual int count() const = 0; @@ -86,8 +84,9 @@ public: * Sets the sort-role to \a role. The method KItemModelBase::onSortRoleChanged() will be * called so that model-implementations can react on the sort-role change. Afterwards the * signal sortRoleChanged() will be emitted. + * The implementation should resort only if \a resortItems is true. */ - void setSortRole(const QByteArray& role); + void setSortRole(const QByteArray& role, bool resortItems = true); QByteArray sortRole() const; /** @@ -267,8 +266,9 @@ protected: * Usually the most efficient way is to emit a * itemsRemoved() signal for all items, reorder the items internally and to emit a * itemsInserted() signal afterwards. + * The implementation should resort only if \a resortItems is true. */ - virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous); + virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous, bool resortItems = true); /** * Is invoked if the sort order has been changed by KItemModelBase::setSortOrder(). Allows