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

#include <ObjectItemModelBase.h>

+ Inheritance diagram for ObjectItemModelBase:
+ Collaboration diagram for ObjectItemModelBase:

Signals

void countChanged (int count)
 
void dirtyChanged (bool dirty)
 

Public Member Functions

 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 Slots

void _childDirtyChanged (bool dirty)
 

Protected Member Functions

QHash< int, QByteArray > roleNames () const override
 
void _signalCountChangedIfNotNested ()
 

Protected Attributes

bool _dirty = false
 
uint _resetModelNestingCount = 0
 

Static Protected Attributes

static constexpr int ObjectRole = Qt::UserRole
 
static constexpr int TextRole = Qt::UserRole + 1
 

Detailed Description

Common base for QObject*-based item models (flat lists and trees). Provides: dirty tracking, depth-counted begin/endResetModel, shared role constants, roleNames.

Definition at line 20 of file ObjectItemModelBase.h.

Constructor & Destructor Documentation

◆ ObjectItemModelBase()

ObjectItemModelBase::ObjectItemModelBase ( QObject *  parent = nullptr)
explicit

Definition at line 17 of file ObjectItemModelBase.cc.

◆ ~ObjectItemModelBase()

ObjectItemModelBase::~ObjectItemModelBase ( )
override

Definition at line 23 of file ObjectItemModelBase.cc.

References _resetModelNestingCount.

Member Function Documentation

◆ _childDirtyChanged

void ObjectItemModelBase::_childDirtyChanged ( bool  dirty)
protectedslot

Definition at line 38 of file ObjectItemModelBase.cc.

References _dirty, and dirtyChanged().

◆ _signalCountChangedIfNotNested()

◆ beginResetModel()

void ObjectItemModelBase::beginResetModel ( )

◆ clear()

virtual void ObjectItemModelBase::clear ( )
pure virtual

Implemented in QmlObjectTreeModel, and QmlObjectListModel.

◆ count()

virtual int ObjectItemModelBase::count ( ) const
pure virtual

◆ countChanged() [1/2]

int count READ count NOTIFY ObjectItemModelBase::countChanged ( bool dirty READ dirty WRITE setDirty NOTIFY  dirtyChanged) const
inline

◆ countChanged [2/2]

void ObjectItemModelBase::countChanged ( int  count)
signal

◆ dirtyChanged

void ObjectItemModelBase::dirtyChanged ( bool  dirty)
signal

◆ endResetModel()

void ObjectItemModelBase::endResetModel ( )

◆ isEmpty()

virtual bool ObjectItemModelBase::isEmpty ( ) const
inlinevirtual

Reimplemented in QmlObjectListModel.

Definition at line 40 of file ObjectItemModelBase.h.

◆ roleNames()

QHash< int, QByteArray > ObjectItemModelBase::roleNames ( ) const
overrideprotected

Definition at line 30 of file ObjectItemModelBase.cc.

References ObjectRole, and TextRole.

Referenced by QmlObjectTreeModel::roleNames().

◆ setDirty()

virtual void ObjectItemModelBase::setDirty ( bool  dirty)
pure virtual

Implemented in QmlObjectTreeModel, and QmlObjectListModel.

Member Data Documentation

◆ _dirty

bool ObjectItemModelBase::_dirty = false
protected

◆ _resetModelNestingCount

uint ObjectItemModelBase::_resetModelNestingCount = 0
protected

◆ ObjectRole

constexpr int ObjectItemModelBase::ObjectRole = Qt::UserRole
staticconstexprprotected

◆ TextRole

constexpr int ObjectItemModelBase::TextRole = Qt::UserRole + 1
staticconstexprprotected

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