1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 09:23:54 +00:00
openmw/apps/opencs/model/world/infotableproxymodel.hpp

48 lines
1.3 KiB
C++
Raw Normal View History

#ifndef CSM_WORLD_INFOTABLEPROXYMODEL_HPP
#define CSM_WORLD_INFOTABLEPROXYMODEL_HPP
#include <QHash>
#include "columns.hpp"
2022-09-22 18:26:05 +00:00
#include "idtableproxymodel.hpp"
#include "universalid.hpp"
2022-10-19 17:02:00 +00:00
class QAbstractItemModel;
class QModelIndex;
class QObject;
namespace CSMWorld
{
class InfoTableProxyModel : public IdTableProxyModel
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
2022-09-22 18:26:05 +00:00
UniversalId::Type mType;
Columns::ColumnId mInfoColumnId;
///< Contains ID for Topic or Journal ID
int mInfoColumnIndex;
int mLastAddedSourceRow;
2022-09-22 18:26:05 +00:00
mutable QHash<QString, int> mFirstRowCache;
2022-09-22 18:26:05 +00:00
int getFirstInfoRow(int currentRow) const;
///< Finds the first row with the same topic (journal entry) as in \a currentRow
///< \a currentRow is a row of the source model.
2022-09-22 18:26:05 +00:00
public:
InfoTableProxyModel(UniversalId::Type type, QObject* parent = nullptr);
2022-09-22 18:26:05 +00:00
void setSourceModel(QAbstractItemModel* sourceModel) override;
2022-09-22 18:26:05 +00:00
protected:
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
2022-09-22 18:26:05 +00:00
protected slots:
void sourceRowsInserted(const QModelIndex& parent, int start, int end) override;
void sourceRowsRemoved(const QModelIndex& parent, int start, int end) override;
void sourceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) override;
};
}
#endif