QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
QgsLayoutModel Class Reference

A model for items attached to a layout. More...

#include <qgslayoutmodel.h>

Inheritance diagram for QgsLayoutModel:
Inheritance graph
[legend]

Public Types

enum  Columns { Visibility = 0 , LockStatus , ItemId }
 Columns returned by the model. More...
 

Public Member Functions

 QgsLayoutModel (QgsLayout *layout, QObject *parent=nullptr)
 Constructor for a QgsLayoutModel attached to the specified layout.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex indexForItem (QgsLayoutItem *item, int column=0)
 Returns the QModelIndex corresponding to a QgsLayoutItem item and column, if possible.
 
QgsLayoutItemitemFromIndex (const QModelIndex &index) const
 Returns the QgsLayoutItem corresponding to a QModelIndex index, if possible.
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
QModelIndex parent (const QModelIndex &index) const override
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
Qt::DropActions supportedDropActions () const override
 

Friends

class TestQgsLayoutGui
 
class TestQgsLayoutModel
 

Detailed Description

A model for items attached to a layout.

The model also maintains the z-order for the layout, and must be notified whenever item stacking changes.

Internally, QgsLayoutModel maintains two lists. One contains a complete list of all items for the layout, ordered by their position within the z-order stack.

The second list contains only items which are currently displayed in the layout's scene. It is used as a cache of the last known stacking order, so that the model can compare the current stacking of items in the layout to the last known state, and emit the corresponding signals as required.

Definition at line 51 of file qgslayoutmodel.h.

Member Enumeration Documentation

◆ Columns

Columns returned by the model.

Enumerator
Visibility 

Item visibility checkbox.

LockStatus 

Item lock status checkbox.

ItemId 

Item ID.

Definition at line 58 of file qgslayoutmodel.h.

Constructor & Destructor Documentation

◆ QgsLayoutModel()

QgsLayoutModel::QgsLayoutModel ( QgsLayout layout,
QObject *  parent = nullptr 
)
explicit

Constructor for a QgsLayoutModel attached to the specified layout.

Definition at line 33 of file qgslayoutmodel.cpp.

Member Function Documentation

◆ columnCount()

int QgsLayoutModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 120 of file qgslayoutmodel.cpp.

◆ data()

QVariant QgsLayoutModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 126 of file qgslayoutmodel.cpp.

◆ dropMimeData()

bool QgsLayoutModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
override

Definition at line 309 of file qgslayoutmodel.cpp.

◆ flags()

Qt::ItemFlags QgsLayoutModel::flags ( const QModelIndex &  index) const
override

Definition at line 874 of file qgslayoutmodel.cpp.

◆ headerData()

QVariant QgsLayoutModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Definition at line 231 of file qgslayoutmodel.cpp.

◆ index()

QModelIndex QgsLayoutModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Definition at line 52 of file qgslayoutmodel.cpp.

◆ indexForItem()

QModelIndex QgsLayoutModel::indexForItem ( QgsLayoutItem item,
int  column = 0 
)

Returns the QModelIndex corresponding to a QgsLayoutItem item and column, if possible.

See also
itemFromIndex()

Definition at line 902 of file qgslayoutmodel.cpp.

◆ itemFromIndex()

QgsLayoutItem * QgsLayoutModel::itemFromIndex ( const QModelIndex &  index) const

Returns the QgsLayoutItem corresponding to a QModelIndex index, if possible.

See also
indexForItem()

Definition at line 40 of file qgslayoutmodel.cpp.

◆ mimeData()

QMimeData * QgsLayoutModel::mimeData ( const QModelIndexList &  indexes) const
override

Definition at line 279 of file qgslayoutmodel.cpp.

◆ mimeTypes()

QStringList QgsLayoutModel::mimeTypes ( ) const
override

Definition at line 272 of file qgslayoutmodel.cpp.

◆ parent()

QModelIndex QgsLayoutModel::parent ( const QModelIndex &  index) const
override

Definition at line 91 of file qgslayoutmodel.cpp.

◆ removeRows()

bool QgsLayoutModel::removeRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
override

Definition at line 412 of file qgslayoutmodel.cpp.

◆ rowCount()

int QgsLayoutModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 99 of file qgslayoutmodel.cpp.

◆ setData()

bool QgsLayoutModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

Definition at line 197 of file qgslayoutmodel.cpp.

◆ supportedDropActions()

Qt::DropActions QgsLayoutModel::supportedDropActions ( ) const
override

Definition at line 267 of file qgslayoutmodel.cpp.

Friends And Related Symbol Documentation

◆ TestQgsLayoutGui

friend class TestQgsLayoutGui
friend

Definition at line 294 of file qgslayoutmodel.h.

◆ TestQgsLayoutModel

friend class TestQgsLayoutModel
friend

Definition at line 293 of file qgslayoutmodel.h.


The documentation for this class was generated from the following files: