18#ifndef QGSLAYOUTMODEL_H
19#define QGSLAYOUTMODEL_H
25#include <QAbstractItemModel>
27#include <QSortFilterProxyModel>
72 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
73 QModelIndex parent(
const QModelIndex &index )
const override;
74 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
75 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
76 QVariant data(
const QModelIndex &index,
int role )
const override;
77 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
78 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
79 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
80 Qt::DropActions supportedDropActions()
const override;
81 QStringList mimeTypes()
const override;
82 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
83 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
84 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
97 int zOrderListSize()
const;
187 QList<QgsLayoutItem *> &zOrderList();
203 void setItemRestored( QgsComposerItem *item );
245 QgsLayoutItem *itemFromIndex(
const QModelIndex &index )
const;
251 QModelIndex indexForItem(
QgsLayoutItem *item,
int column = 0 );
261 void setSelected(
const QModelIndex &index );
268 QList<QgsLayoutItem *> mItemZList;
271 QList<QgsLayoutItem *> mItemsInScene;
285 void refreshItemsInScene();
292 void rebuildSceneItemList();
334 void setExceptedItemList(
const QList< QgsLayoutItem * > &items );
351 QgsLayoutItem *itemFromSourceIndex(
const QModelIndex &sourceIndex )
const;
364 void setAllowEmptyItem(
bool allowEmpty );
371 bool allowEmptyItem()
const;
394 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
395 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
400 QList< QgsLayoutItem * > mExceptedList;
401 bool mAllowEmpty =
false;
@ LayoutItem
Base class for items.
Base class for graphical items within a QgsLayout.
A model for items attached to a layout.
friend class TestQgsLayoutGui
friend class TestQgsLayoutModel
QgsLayoutModel(QgsLayout *layout, QObject *parent=nullptr)
Constructor for a QgsLayoutModel attached to the specified layout.
Columns
Columns returned by the model.
@ Visibility
Item visibility checkbox.
@ LockStatus
Item lock status checkbox.
QgsLayoutModel * sourceLayerModel() const
Returns the QgsLayoutModel used in this proxy model.
QgsLayoutProxyModel(QgsLayout *layout, QObject *parent=nullptr)
Constructor for QgsLayoutProxyModelm, attached to the specified layout.
QgsLayout * layout()
Returns the associated layout.
QgsLayoutItemRegistry::ItemType filterType() const
Returns the current item type filter, or QgsLayoutItemRegistry::LayoutItem if no item type filter is ...
QList< QgsLayoutItem * > exceptedItemList() const
Returns the list of specific items excluded from the model.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.