2015-06-17 19:47:39 +00:00
|
|
|
#ifndef CSM_WORLD_INFOTABLEPROXYMODEL_HPP
|
|
|
|
#define CSM_WORLD_INFOTABLEPROXYMODEL_HPP
|
|
|
|
|
2015-06-17 20:46:51 +00:00
|
|
|
#include <QHash>
|
|
|
|
|
2015-06-17 19:47:39 +00:00
|
|
|
#include "idtableproxymodel.hpp"
|
2015-06-25 17:08:42 +00:00
|
|
|
#include "columns.hpp"
|
2015-06-17 19:47:39 +00:00
|
|
|
#include "universalid.hpp"
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class IdTableBase;
|
|
|
|
|
|
|
|
class InfoTableProxyModel : public IdTableProxyModel
|
|
|
|
{
|
2015-06-17 20:46:51 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2015-06-17 19:47:39 +00:00
|
|
|
UniversalId::Type mType;
|
2015-06-25 17:08:42 +00:00
|
|
|
Columns::ColumnId mInfoColumnId;
|
|
|
|
///< Contains ID for Topic or Journal ID
|
2015-07-26 17:07:36 +00:00
|
|
|
int mInfoColumnIndex;
|
|
|
|
int mLastAddedSourceRow;
|
2015-06-17 19:47:39 +00:00
|
|
|
|
2015-06-17 20:46:51 +00:00
|
|
|
mutable QHash<QString, int> mFirstRowCache;
|
|
|
|
|
2015-06-17 19:47:39 +00:00
|
|
|
int getFirstInfoRow(int currentRow) const;
|
|
|
|
///< Finds the first row with the same topic (journal entry) as in \a currentRow
|
2015-07-26 17:07:36 +00:00
|
|
|
///< \a currentRow is a row of the source model.
|
2015-06-17 19:47:39 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
InfoTableProxyModel(UniversalId::Type type, QObject *parent = 0);
|
|
|
|
|
2015-07-26 17:07:36 +00:00
|
|
|
virtual void setSourceModel(QAbstractItemModel *sourceModel);
|
2015-06-17 19:47:39 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
2015-06-17 20:46:51 +00:00
|
|
|
|
2015-07-26 17:07:36 +00:00
|
|
|
protected slots:
|
|
|
|
virtual void sourceRowsInserted(const QModelIndex &parent, int start, int end);
|
|
|
|
virtual void sourceRowsRemoved(const QModelIndex &parent, int start, int end);
|
|
|
|
virtual void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
2015-06-17 19:47:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|