Quark  0.1
QuadTreeModelBase Class Reference

A non-parameterized abstract base class for quad-tree models. More...

#include <QuadTreeModelBase.h++>

Inheritance diagram for QuadTreeModelBase:

Signals

void dataChanged ()
 Emitted when the model has changed in some significant way. More...
 
void itemAdded (const QPoint &location)
 Emitted when a new item has been added to the model. More...
 
void itemModified (const QPoint &location)
 Emitted when an item in the model has changed. More...
 
void itemRemoved (const QPoint &location)
 Emitted when an item has been removed from the model. More...
 

Public Member Functions

virtual ~QuadTreeModelBase ()
 Destructor. More...
 
QRect region () const
 Returns the region covered by this model. More...
 
uint itemCount () const
 Returns the number of items in the model. More...
 
bool isEmpty () const
 Tests if the model is empty. More...
 
bool setVisibleRegion (const QRect &visibleRegion)
 Sets the visible region for the model. More...
 
QRect visibleRegion () const
 Returns the current visible region. More...
 

Protected Member Functions

 QuadTreeModelBase (const QRect &region, uint maxItemsPerQuad=1)
 Constructs a QuadTreeModelBase with the given region and density. More...
 

Protected Attributes

uint _maxItemsPerQuad
 
QRect _region
 
QRect _visibleRegion
 
uint _itemCount
 

Detailed Description

A non-parameterized abstract base class for quad-tree models.

This class should not be subclassed directly.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ~QuadTreeModelBase()

virtual ~QuadTreeModelBase ( )
virtual

Destructor.

◆ QuadTreeModelBase()

QuadTreeModelBase ( const QRect &  region,
uint  maxItemsPerQuad = 1 
)
protected

Constructs a QuadTreeModelBase with the given region and density.

Member Function Documentation

◆ dataChanged

void dataChanged ( )
signal

Emitted when the model has changed in some significant way.

◆ isEmpty()

bool isEmpty ( ) const
inline

Tests if the model is empty.

◆ itemAdded

void itemAdded ( const QPoint &  location)
signal

Emitted when a new item has been added to the model.

Parameters
locationThe item's location.

◆ itemCount()

uint itemCount ( ) const
inline

Returns the number of items in the model.

◆ itemModified

void itemModified ( const QPoint &  location)
signal

Emitted when an item in the model has changed.

Parameters
locationThe item's location.

◆ itemRemoved

void itemRemoved ( const QPoint &  location)
signal

Emitted when an item has been removed from the model.

Parameters
locationThe item's location.

◆ region()

QRect region ( ) const
inline

Returns the region covered by this model.

◆ setVisibleRegion()

bool setVisibleRegion ( const QRect &  visibleRegion)

Sets the visible region for the model.

When a data item is added to, removed from, or changed in the model, the corresponding notification signal will only be emitted if that item's location was within the visible region.

Parameters
Thenew visible region.
Returns
true on success, or false if the specified region is neither empty nor contained within the model's region.

◆ visibleRegion()

QRect visibleRegion ( ) const
inline

Returns the current visible region.

Member Data Documentation

◆ _itemCount

uint _itemCount
protected

◆ _maxItemsPerQuad

uint _maxItemsPerQuad
protected

◆ _region

QRect _region
protected

◆ _visibleRegion

QRect _visibleRegion
protected

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