File indexing completed on 2024-05-19 04:28:59

0001 /*
0002  *  SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_MODEL_INDEX_CONVERTER_SHOW_ALL_H
0008 #define __KIS_MODEL_INDEX_CONVERTER_SHOW_ALL_H
0009 
0010 #include "kis_model_index_converter_base.h"
0011 
0012 class KisDummiesFacadeBase;
0013 class KisNodeModel;
0014 
0015 
0016 /**
0017  * The class for converting to/from QModelIndex and KisNodeDummy when
0018  * the root node is *shown* (ShowRootLayer == *true*). The selection
0019  * masks owned by the root layer are shown as well.
0020  */
0021 
0022 class KRITAUI_EXPORT KisModelIndexConverterShowAll : public KisModelIndexConverterBase
0023 {
0024 public:
0025     KisModelIndexConverterShowAll(KisDummiesFacadeBase *dummiesFacade,
0026                            KisNodeModel *model);
0027 
0028     KisNodeDummy* dummyFromRow(int row, QModelIndex parent) override;
0029     KisNodeDummy* dummyFromIndex(QModelIndex index) override;
0030 
0031     QModelIndex indexFromDummy(KisNodeDummy *dummy) override;
0032     bool indexFromAddedDummy(KisNodeDummy *parentDummy, int index,
0033                              const QString &newNodeMetaObjectType,
0034                              QModelIndex &parentIndex, int &row) override;
0035 
0036     int rowCount(QModelIndex parent) override;
0037 
0038 private:
0039     KisDummiesFacadeBase *m_dummiesFacade;
0040     KisNodeModel *m_model;
0041 };
0042 
0043 #endif /* __KIS_MODEL_INDEX_CONVERTER_SHOW_ALL_H */