KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
TableHeader Class Reference

Descriptor for a single column or row header in a model/view. More...

#include <tableheader.h>

Classes

class  IntMap
 An int-keyed map of TableHeader objects with bulk-operation helpers. More...
 
class  List
 A list of TableHeader objects with name and type search helpers. More...
 

Public Member Functions

 TableHeader ()
 Default constructor — creates an invalid horizontal header.
 
 TableHeader (int type, Qt::Orientation orientation=Qt::Vertical)
 Construct a header with a type and optional orientation.
 
 TableHeader (int type, const QString &text, Qt::Orientation orientation=Qt::Vertical)
 Construct a header with a type, display text, and optional orientation.
 
int type () const
 Return the header type integer.
 
QString text () const
 Return the display text.
 
void setText (const QString &text)
 Set the display text.
 
Qt::Orientation orientation () const
 Return the header orientation.
 
QColor columnTextColor () const
 Return the text colour for cells in this column.
 
void setColumnTextColor (const QColor &value)
 Set the text colour for cells in this column.
 
bool isVisible () const
 Return whether this header (and its column) is visible.
 
void setVisible (bool value)
 Set header (and column) visibility.
 
EntityMetadata entityMetadata () const
 Return the EntityMetadata attached to this header.
 
EntityMetadata & entityMetadataRef ()
 Return a mutable reference to the attached EntityMetadata.
 
void setEntityMetadata (const EntityMetadata &value)
 Set the EntityMetadata attached to this header.
 
QVariant data (int role) const
 Return data stored in the attached metadata for the given role.
 
void setData (const QVariant &value, int role)
 Store a value in the attached metadata under the given role.
 
QUuid uuid () const
 Return the UUID stored in the attached metadata.
 
bool isValid () const
 Return whether this header has a non-zero type.
 

Static Public Member Functions

static QString typeToString (int type)
 Look up the string name for a header type integer.
 

Detailed Description

Descriptor for a single column or row header in a model/view.

TableHeader stores the header type (an application-defined integer), display text, orientation, optional text colour, and visibility flag. An EntityMetadata can also be attached for carrying additional role-keyed data.

Two container classes are provided:

Definition at line 29 of file tableheader.h.

Constructor & Destructor Documentation

◆ TableHeader() [1/3]

TableHeader::TableHeader ( )
inline

Default constructor — creates an invalid horizontal header.

Definition at line 33 of file tableheader.h.

◆ TableHeader() [2/3]

TableHeader::TableHeader ( int  type,
Qt::Orientation  orientation = Qt::Vertical 
)

Construct a header with a type and optional orientation.

Parameters
typeApplication-defined header type integer
orientationHeader orientation (default Qt::Vertical)

◆ TableHeader() [3/3]

TableHeader::TableHeader ( int  type,
const QString &  text,
Qt::Orientation  orientation = Qt::Vertical 
)

Construct a header with a type, display text, and optional orientation.

Parameters
typeApplication-defined header type integer
textDisplay text
orientationHeader orientation (default Qt::Vertical)

Member Function Documentation

◆ columnTextColor()

QColor TableHeader::columnTextColor ( ) const
inline

Return the text colour for cells in this column.

Returns
QColor for cell text, or invalid QColor if not set

Definition at line 78 of file tableheader.h.

◆ data()

QVariant TableHeader::data ( int  role) const
inline

Return data stored in the attached metadata for the given role.

Parameters
roleModel role key
Returns
Stored QVariant, or invalid QVariant if not set

Definition at line 121 of file tableheader.h.

◆ entityMetadata()

EntityMetadata TableHeader::entityMetadata ( ) const
inline

Return the EntityMetadata attached to this header.

Returns
Associated EntityMetadata

Definition at line 102 of file tableheader.h.

◆ entityMetadataRef()

EntityMetadata & TableHeader::entityMetadataRef ( )
inline

Return a mutable reference to the attached EntityMetadata.

Returns
Reference to the EntityMetadata

Definition at line 108 of file tableheader.h.

◆ isValid()

bool TableHeader::isValid ( ) const
inline

Return whether this header has a non-zero type.

Returns
true if type != 0

Definition at line 140 of file tableheader.h.

◆ isVisible()

bool TableHeader::isVisible ( ) const
inline

Return whether this header (and its column) is visible.

Returns
true if visible

Definition at line 90 of file tableheader.h.

◆ orientation()

Qt::Orientation TableHeader::orientation ( ) const
inline

Return the header orientation.

Returns
Qt::Horizontal or Qt::Vertical

Definition at line 72 of file tableheader.h.

◆ setColumnTextColor()

void TableHeader::setColumnTextColor ( const QColor &  value)
inline

Set the text colour for cells in this column.

Parameters
valueNew text colour

Definition at line 84 of file tableheader.h.

Referenced by TableHeader::IntMap::setTextColorForType().

◆ setData()

void TableHeader::setData ( const QVariant &  value,
int  role 
)
inline

Store a value in the attached metadata under the given role.

Parameters
valueValue to store
roleModel role key

Definition at line 128 of file tableheader.h.

◆ setEntityMetadata()

void TableHeader::setEntityMetadata ( const EntityMetadata &  value)
inline

Set the EntityMetadata attached to this header.

Parameters
valueMetadata to associate

Definition at line 114 of file tableheader.h.

Referenced by TableHeader::IntMap::setEntityMetadataForType().

◆ setText()

void TableHeader::setText ( const QString &  text)
inline

Set the display text.

Parameters
textNew header label string

Definition at line 66 of file tableheader.h.

◆ setVisible()

void TableHeader::setVisible ( bool  value)
inline

Set header (and column) visibility.

Parameters
valuetrue to show, false to hide

Definition at line 96 of file tableheader.h.

◆ text()

QString TableHeader::text ( ) const
inline

Return the display text.

Returns
Header label string

Definition at line 60 of file tableheader.h.

Referenced by TableHeader::List::findByName().

◆ type()

int TableHeader::type ( ) const
inline

Return the header type integer.

Returns
Application-defined type value

Definition at line 54 of file tableheader.h.

Referenced by TableHeader::IntMap::setEntityMetadataForType(), TableHeader::List::setHeaderVisible(), TableHeader::IntMap::setHeaderVisible(), and TableHeader::IntMap::setTextColorForType().

◆ typeToString()

static QString TableHeader::typeToString ( int  type)
inlinestatic

Look up the string name for a header type integer.

Parameters
typeHeader type integer
Returns
Registered name string, or empty string if not found

Definition at line 245 of file tableheader.h.

◆ uuid()

QUuid TableHeader::uuid ( ) const
inline

Return the UUID stored in the attached metadata.

Returns
UUID, or null UUID if not set

Definition at line 134 of file tableheader.h.


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