QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ObjectListModelBase Class Referenceabstract

#include <ObjectListModelBase.h>

+ Inheritance diagram for ObjectListModelBase:
+ Collaboration diagram for ObjectListModelBase:

Public Member Functions

 ObjectListModelBase (QObject *parent=nullptr)
 
 ~ObjectListModelBase () override
 
virtual void clearAndDeleteContents ()=0
 Clears the list and calls deleteLater on each entry.
 
virtual QObject * removeOne (const QObject *object)=0
 
virtual bool contains (const QObject *object)=0
 
QModelIndex index (int row, int column=0, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
bool hasChildren (const QModelIndex &parent=QModelIndex()) const override
 
- Public Member Functions inherited from ObjectItemModelBase
 ObjectItemModelBase (QObject *parent=nullptr)
 
 ~ObjectItemModelBase () override
 
int count READ count NOTIFY countChanged (bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) bool dirty() const
 
void beginResetModel ()
 Depth-counted beginResetModel — only the outermost call has effect.
 
void endResetModel ()
 Depth-counted endResetModel — only the outermost call has effect.
 
virtual int count () const =0
 
virtual bool isEmpty () const
 
virtual void setDirty (bool dirty)=0
 
virtual void clear ()=0
 

Protected Member Functions

int rowCount (const QModelIndex &parent=QModelIndex()) const override=0
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override=0
 
bool insertRows (int position, int rows, const QModelIndex &index=QModelIndex()) override=0
 
bool removeRows (int position, int rows, const QModelIndex &index=QModelIndex()) override=0
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override=0
 
- Protected Member Functions inherited from ObjectItemModelBase
QHash< int, QByteArray > roleNames () const override
 
void _signalCountChangedIfNotNested ()
 

Protected Attributes

bool _skipDirtyFirstItem = false
 
- Protected Attributes inherited from ObjectItemModelBase
bool _dirty = false
 
uint _resetModelNestingCount = 0
 

Additional Inherited Members

- Signals inherited from ObjectItemModelBase
void countChanged (int count)
 
void dirtyChanged (bool dirty)
 
- Protected Slots inherited from ObjectItemModelBase
void _childDirtyChanged (bool dirty)
 
- Static Protected Attributes inherited from ObjectItemModelBase
static constexpr int ObjectRole = Qt::UserRole
 
static constexpr int TextRole = Qt::UserRole + 1
 

Detailed Description

Base class for flat QObject* list models. Inherits common dirty/reset/role handling from ObjectItemModelBase and adds flat-list index()/parent() overrides.

Definition at line 19 of file ObjectListModelBase.h.

Constructor & Destructor Documentation

◆ ObjectListModelBase()

ObjectListModelBase::ObjectListModelBase ( QObject *  parent = nullptr)

Definition at line 15 of file ObjectListModelBase.cc.

◆ ~ObjectListModelBase()

ObjectListModelBase::~ObjectListModelBase ( )
override

Definition at line 20 of file ObjectListModelBase.cc.

Member Function Documentation

◆ clearAndDeleteContents()

virtual void ObjectListModelBase::clearAndDeleteContents ( )
pure virtual

Clears the list and calls deleteLater on each entry.

Implemented in QmlObjectListModel.

◆ columnCount()

int ObjectListModelBase::columnCount ( const QModelIndex parent = QModelIndex()) const
override

Definition at line 40 of file ObjectListModelBase.cc.

References index(), and parent().

◆ contains()

virtual bool ObjectListModelBase::contains ( const QObject *  object)
pure virtual

Implemented in QmlObjectListModel.

◆ data()

QVariant ObjectListModelBase::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const
overrideprotectedpure virtual

Implemented in QmlObjectListModel.

◆ hasChildren()

bool ObjectListModelBase::hasChildren ( const QModelIndex parent = QModelIndex()) const
override

Definition at line 46 of file ObjectListModelBase.cc.

References parent(), and rowCount().

◆ index()

◆ insertRows()

bool ObjectListModelBase::insertRows ( int  position,
int  rows,
const QModelIndex index = QModelIndex() 
)
overrideprotectedpure virtual

Implemented in QmlObjectListModel.

◆ parent()

QModelIndex ObjectListModelBase::parent ( const QModelIndex child) const
override

◆ removeOne()

virtual QObject * ObjectListModelBase::removeOne ( const QObject *  object)
pure virtual

Implemented in QmlObjectListModel.

◆ removeRows()

bool ObjectListModelBase::removeRows ( int  position,
int  rows,
const QModelIndex index = QModelIndex() 
)
overrideprotectedpure virtual

Implemented in QmlObjectListModel.

◆ rowCount()

int ObjectListModelBase::rowCount ( const QModelIndex parent = QModelIndex()) const
overrideprotectedpure virtual

Implemented in QmlObjectListModel.

Referenced by hasChildren(), and index().

◆ setData()

bool ObjectListModelBase::setData ( const QModelIndex index,
const QVariant value,
int  role = Qt::EditRole 
)
overrideprotectedpure virtual

Implemented in QmlObjectListModel.

Member Data Documentation

◆ _skipDirtyFirstItem

bool ObjectListModelBase::_skipDirtyFirstItem = false
protected

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