1#ifndef AbstractTableModel_H
2#define AbstractTableModel_H
14#include <QExplicitlySharedDataPointer>
16#include <QtConcurrent>
26template<
typename T >
class QList;
30 class AbstractTableDelegate;
31 class AbstractTreeModel;
34 class TableColumnList;
49 class LessThanFunctor;
63 virtual QList< AbstractTreeItem * >
getItems(
int,
int) = 0;
69 TableColumn const *, QString valueToSave)
const = 0;
116 QList< AbstractTreeItem * > newlySelectedItems,
128 void sortStatusUpdated();
133 QList< AbstractTreeItem * > doSort(QList< AbstractTreeItem * >);
135 void setSorting(
bool sorting);
141 QList< AbstractTreeItem * > * m_sortedItems;
144 QTimer *m_sortStatusPoller;
145 LessThanFunctor *m_lessThanFunctor;
147 bool m_sortingEnabled;
150 QFutureWatcher< QList< AbstractTreeItem * > > * m_sortingWatcher;
152 static const int SORT_UPDATE_FREQUENCY = 50;
156 class LessThanFunctorData;
163 class LessThanFunctor :
public std::function <bool(AbstractTreeItem *const &, AbstractTreeItem *const &)> {
166 LessThanFunctor(LessThanFunctor
const &);
169 int getCompareCount()
const;
176 LessThanFunctor &operator=(LessThanFunctor
const &);
181 QExplicitlySharedDataPointer<LessThanFunctorData> m_sharedData;
195 LessThanFunctorData();
196 LessThanFunctorData(LessThanFunctorData
const &);
197 ~LessThanFunctorData();
199 int getCompareCount()
const;
200 void incrementCompareCount();
202 void setInterrupted(
bool);
207 QAtomicInt m_compareCount;
208 QAtomicInt m_interruptFlag;
223 class SortingCanceledException :
public QException {
225 void raise()
const {
throw *
this; }
227 return new SortingCanceledException(*
this);
Base class for delegates which create, read, and save data in the tables.
Definition AbstractTableDelegate.h:33
Translates the tree model into a table model.
Definition AbstractTableModel.h:48
void filterProgressRangeChanged(int, int)
virtual const AbstractTableDelegate * getDelegate() const
Definition AbstractTableModel.cpp:162
virtual void updateSort()
Definition AbstractTableModel.cpp:201
virtual int getVisibleRowCount() const =0
void rebuildProgressRangeChanged(int, int)
virtual bool isFiltering() const
Definition AbstractTableModel.cpp:116
virtual bool sortingOn() const
Definition AbstractTableModel.cpp:147
virtual QList< AbstractTreeItem * > getSelectedItems()=0
virtual QList< AbstractTreeItem * > getItems(AbstractTreeItem *, AbstractTreeItem *)=0
virtual void rebuildSort()
Definition AbstractTableModel.cpp:419
virtual QString getWarningMessage(AbstractTreeItem const *, TableColumn const *, QString valueToSave) const =0
virtual void applyFilter()
Definition AbstractTableModel.cpp:167
AbstractTreeModel * getDataModel()
Definition AbstractTableModel.cpp:205
virtual void setSortLimit(int)
Definition AbstractTableModel.cpp:139
void userWarning(AbstractTableModel::Warning)
void sortProgressChanged(int)
virtual void setGlobalSelection(bool selected)=0
Warning
Definition AbstractTableModel.h:54
@ None
Definition AbstractTableModel.h:55
@ SortingDisabled
Definition AbstractTableModel.h:56
@ SortingTableSizeLimitReached
Definition AbstractTableModel.h:57
virtual ~AbstractTableModel()
Definition AbstractTableModel.cpp:78
virtual void sort()
Definition AbstractTableModel.cpp:172
virtual void reverseOrder(TableColumn *)
Definition AbstractTableModel.cpp:197
void filterProgressChanged(int)
virtual TableColumnList * createColumns()=0
virtual QList< AbstractTreeItem * > getSortedItems(int, int, AbstractTreeModel::InterestingItems)
Definition AbstractTableModel.cpp:215
virtual void setSortingEnabled(bool)
Definition AbstractTableModel.cpp:126
virtual QList< AbstractTreeItem * > getItems(int, int)=0
virtual TableColumnList * getColumns()
Definition AbstractTableModel.cpp:152
virtual int indexOfVisibleItem(AbstractTreeItem const *item) const =0
void sortProgressRangeChanged(int, int)
void treeSelectionChanged(QList< AbstractTreeItem * >)
void tableSelectionChanged(QList< AbstractTreeItem * >)
void handleTreeSelectionChanged(QList< AbstractTreeItem * > newlySelectedItems, AbstractTreeItem::InternalPointerType)
Definition AbstractTableModel.cpp:299
virtual bool isSorting() const
Definition AbstractTableModel.cpp:111
virtual int sortLimit() const
Definition AbstractTableModel.cpp:134
AbstractTableModel(AbstractTreeModel *, AbstractTableDelegate *)
Definition AbstractTableModel.cpp:33
virtual bool sortingIsEnabled() const
Definition AbstractTableModel.cpp:121
void filterCountsChanged(int visibleRows, int totalRows)
void rebuildProgressChanged(int)
Base class for an item in the tree.
Definition AbstractTreeItem.h:39
InternalPointerType
Definition AbstractTreeItem.h:44
Base class for tree models.
Definition AbstractTreeModel.h:48
InterestingItems
Definition AbstractTreeModel.h:52
A leaf item that is not ready for user interaction.
Definition BusyLeafItem.h:33
Definition TableColumn.h:26
Definition TableColumnList.h:30
This is free and unencumbered software released into the public domain.
Definition AbstractTableModel.h:24
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16