20 #ifndef __PALETTEMODEL_H__ 21 #define __PALETTEMODEL_H__ 91 PaletteCellRole = Qt::UserRole,
107 bool _treeChanged =
false;
108 bool _treeChangedSignalBlocked =
false;
110 std::vector<std::unique_ptr<PalettePanel>>&
palettes() {
return _paletteTree->palettes; }
111 const std::vector<std::unique_ptr<PalettePanel>>&
palettes()
const {
return _paletteTree->palettes; }
113 PalettePanel* iptrToPalettePanel(
void* iptr,
int* idx =
nullptr);
117 void onDataChanged(
const QModelIndex& topLeft,
const QModelIndex& bottomRight,
const QVector<int>& roles);
120 void itemDataChanged(
const QModelIndex& idx);
121 void setTreeChanged();
128 explicit PaletteTreeModel(std::unique_ptr<PaletteTree> tree, QObject* parent =
nullptr);
132 bool blockTreeChanged(
bool block);
134 void setPaletteTree(std::unique_ptr<PaletteTree> tree);
139 QModelIndex index(
int row,
int column,
const QModelIndex& parent = QModelIndex())
const override;
140 QModelIndex parent(
const QModelIndex& index)
const override;
142 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
143 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
144 QVariant data(
const QModelIndex& index,
int role)
const override;
145 bool setData(
const QModelIndex& index,
const QVariant& value,
int role)
override;
148 QHash<int, QByteArray> roleNames()
const override;
150 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
151 Qt::DropActions supportedDropActions()
const override;
153 QMimeData* mimeData(
const QModelIndexList& indexes)
const override;
154 QStringList mimeTypes()
const override;
156 bool canDropMimeData(
const QMimeData* data, Qt::DropAction action,
int row,
int column,
const QModelIndex& parent)
const;
157 bool dropMimeData(
const QMimeData* data, Qt::DropAction action,
int row,
int column,
const QModelIndex& parent);
159 QModelIndexList match(
const QModelIndex& start,
int role,
const QVariant& value,
int hits, Qt::MatchFlags flags)
const override;
160 QModelIndex findPaletteCell(
const PaletteCell& cell,
const QModelIndex& parent)
const;
163 bool moveRows(
const QModelIndex& sourceParent,
int sourceRow,
int count,
const QModelIndex& destinationParent,
int destinationChild)
override;
164 bool removeRows(
int row,
int count,
const QModelIndex& parent = QModelIndex())
override;
165 bool insertRows(
int row,
int count,
const QModelIndex& parent = QModelIndex())
override;
167 const PalettePanel* findPalettePanel(
const QModelIndex&)
const;
168 PalettePanel* findPalettePanel(
const QModelIndex& index);
171 bool insertPalettePanel(std::unique_ptr<PalettePanel> pp,
int row,
const QModelIndex& parent = QModelIndex());
186 bool filterAcceptsRow(
int sourceRow,
const QModelIndex& sourceParent)
const override;
205 bool filterAcceptsRow(
int sourceRow,
const QModelIndex& sourceParent)
const override;
PaletteCellFilterProxyModel(QObject *parent=nullptr)
Definition: palettemodel.h:203
bool visible
Definition: palettetree.h:50
Definition: palettemodel.h:93
PaletteCellFilter * cellFilter
Definition: palettemodel.h:184
const std::vector< std::unique_ptr< PalettePanel > > & palettes() const
Definition: palettemodel.h:111
std::vector< std::unique_ptr< PalettePanel > > & palettes()
Definition: palettemodel.h:110
virtual bool acceptCell(const PaletteCell &) const =0
std::shared_ptr< const PaletteCell > PaletteCellConstPtr
Definition: palettetree.h:30
bool acceptedValue
Definition: palettemodel.h:59
Definition: palettetree.h:95
Definition: palettemodel.h:99
const PaletteTree * paletteTree() const
Definition: palettemodel.h:135
Definition: palettemodel.h:181
PaletteTreeModel(PaletteTree *tree, QObject *parent=nullptr)
Definition: palettemodel.h:129
Interface for filtering elements in a palette.
Definition: palettemodel.h:34
const PalettePanel * iptrToPalettePanel(void *iptr, int *idx=nullptr) const
Definition: palettemodel.h:114
CustomizedCellFilter(bool acceptedVal, QObject *parent=nullptr)
Definition: palettemodel.h:78
std::unique_ptr< PaletteTree > _paletteTree
Definition: palettemodel.h:103
Definition: palettemodel.h:98
Definition: palettemodel.h:94
Definition: palettemodel_list.h:31
Definition: palettemodel.h:100
Definition: palettemodel.h:92
PaletteCellFilter * chainedFilter
Definition: palettemodel.h:37
Definition: palettemodel.h:58
Definition: palettemodel.h:86
void addChainedFilter(PaletteCellFilter *)
Ownership over the added filter is passed to this filter.
Definition: palettemodel.cpp:903
VisibilityCellFilter(bool acceptedVal, QObject *parent=nullptr)
Definition: palettemodel.h:64
Definition: aeolus.cpp:26
bool custom
Definition: palettetree.h:51
Definition: palettemodel.h:72
PaletteCellFilter(QObject *parent=nullptr)
Definition: palettemodel.h:46
Definition: palettemodel.h:200
Definition: palettemodel.h:96
bool filterAcceptsColumn(int, const QModelIndex &) const override
Definition: palettemodel.h:187
bool acceptedValue
Definition: palettemodel.h:73
bool acceptCell(const PaletteCell &cell) const override
Definition: palettemodel.h:61
void connectToModel(const QAbstractItemModel *)
Definition: palettemodel.cpp:933
bool accept(const PaletteCell &) const
Definition: palettemodel.cpp:918
bool paletteTreeChanged() const
Definition: palettemodel.h:137
void setTreeUnchanged()
Definition: palettemodel.h:122
std::shared_ptr< PaletteCell > PaletteCellPtr
Definition: palettetree.h:29
PaletteTreeModelRoles
Definition: palettemodel.h:90
Definition: palettemodel.h:95
void invalidateFilter()
Definition: palettemodel.h:190
Definition: palettemodel.h:97
bool acceptCell(const PaletteCell &cell) const override
Definition: palettemodel.h:75
Definition: palettetree.h:222