QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
QetGraphicsHeaderItem Class Reference

The QetGraphicsHeaderItem class The header have a few parameters to edit her visual aspect. Margins, to edit the margin between the cell and the text. Text font. Text alignment in the cell These three parameters are not settable directly with the header but through the model to be displayed by the header. Header search these parameters only in the section 0 for cell of header. By consequence, set data in other section is useless also these parameter can't be set individually for each cell. The margins is stored in the model in index Qt::UserRole+1 and for value a QString. See QETUtils::marginsFromString and QETUtils::marginsToString. More...

#include <qetgraphicsheaderitem.h>

Inherits QGraphicsObject.

Collaboration diagram for QetGraphicsHeaderItem:
Collaboration graph

Public Types

enum  { Type = UserType + 1301 }
 

Signals

void sectionResized (int logicalIndex, int size)
 
void heightResized ()
 

Public Member Functions

 QetGraphicsHeaderItem (QGraphicsItem *parent=nullptr)
 QetGraphicsHeaderItem::QetGraphicsHeaderItem.
 
int type () const override
 
void setModel (QAbstractItemModel *model=nullptr)
 QetGraphicsHeaderItem::setModel Set the model presented by this item Since QetGraphicsHeaderItem don't take ownership of model, if item already have a model, it's your responsibility to delete it.
 
QAbstractItemModel * model () const
 QetGraphicsHeaderItem::model.
 
virtual QRectF boundingRect () const override
 QetGraphicsHeaderItem::boundingRect Reimplemented from QGraphicsObject::boundingRect() const;.
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 QetGraphicsHeaderItem::paint Reimplemented from QGraphicsObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) const;.
 
QRect rect () const
 QetGraphicsHeaderItem::rect.
 
void resizeSection (int logicalIndex, int size)
 QetGraphicsHeaderItem::resizeSection.
 
int sectionSize (int logical_index) const
 QetGraphicsHeaderItem::sectionSize.
 
QVector< int > minimumSectionWidth () const
 
int minimumWidth () const
 
QDomElement toXml (QDomDocument &document) const
 QetGraphicsHeaderItem::toXml save the header to xml.
 
void fromXml (const QDomElement &element)
 QetGraphicsHeaderItem::fromXml Restore the header from xml.
 
virtual bool toDXF (const QString &filepath)
 QetGraphicsHeaderItem::toDXF Draw this table to the dxf document.
 

Static Public Member Functions

static QString xmlTagName ()
 

Private Member Functions

void setUpMinimumSectionsSize ()
 QetGraphicsHeaderItem::setUpMinimumSectionsSize Setup the minimum section size and height of the item. Not that this function doesn't change the current size of this item.
 
void setUpBoundingRect ()
 QetGraphicsHeaderItem::setUpBoundingRect Setup the bounding rect of the item.
 
void headerDataChanged (Qt::Orientations orientation, int first, int last)
 QetGraphicsHeaderItem::headerDataChanged Update the header when data of displayed model change.
 
void adjustSize ()
 QetGraphicsHeaderItem::adjustSize If needed, this function resize the current height and section according to there minimum.
 
void modelReseted ()
 

Private Attributes

QRect m_current_rect
 
QRectF m_bounding_rect
 
QPointer< QAbstractItemModel > m_model
 
QVector< int > m_sections_minimum_width
 
QVector< int > m_current_sections_width
 
int m_section_height =1
 
int m_minimum_section_height =1
 
int m_minimum_width =1
 

Detailed Description

The QetGraphicsHeaderItem class The header have a few parameters to edit her visual aspect. Margins, to edit the margin between the cell and the text. Text font. Text alignment in the cell These three parameters are not settable directly with the header but through the model to be displayed by the header. Header search these parameters only in the section 0 for cell of header. By consequence, set data in other section is useless also these parameter can't be set individually for each cell. The margins is stored in the model in index Qt::UserRole+1 and for value a QString. See QETUtils::marginsFromString and QETUtils::marginsToString.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ QetGraphicsHeaderItem()

QetGraphicsHeaderItem::QetGraphicsHeaderItem ( QGraphicsItem *  parent = nullptr)

Member Function Documentation

◆ adjustSize()

void QetGraphicsHeaderItem::adjustSize ( )
private

QetGraphicsHeaderItem::adjustSize If needed, this function resize the current height and section according to there minimum.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ boundingRect()

QRectF QetGraphicsHeaderItem::boundingRect ( ) const
overridevirtual

QetGraphicsHeaderItem::boundingRect Reimplemented from QGraphicsObject::boundingRect() const;.

Returns

◆ fromXml()

void QetGraphicsHeaderItem::fromXml ( const QDomElement &  element)

QetGraphicsHeaderItem::fromXml Restore the header from xml.

Parameters
element
Here is the call graph for this function:
Here is the caller graph for this function:

◆ headerDataChanged()

void QetGraphicsHeaderItem::headerDataChanged ( Qt::Orientations  orientation,
int  first,
int  last 
)
private

QetGraphicsHeaderItem::headerDataChanged Update the header when data of displayed model change.

Parameters
orientation
first
last
Here is the call graph for this function:
Here is the caller graph for this function:

◆ heightResized

void QetGraphicsHeaderItem::heightResized ( )
signal
Here is the caller graph for this function:

◆ minimumSectionWidth()

QVector< int > QetGraphicsHeaderItem::minimumSectionWidth ( ) const
inline
Here is the caller graph for this function:

◆ minimumWidth()

int QetGraphicsHeaderItem::minimumWidth ( ) const
inline

◆ model()

QAbstractItemModel * QetGraphicsHeaderItem::model ( ) const

QetGraphicsHeaderItem::model.

Returns
the model that this item is presenting
Here is the caller graph for this function:

◆ modelReseted()

void QetGraphicsHeaderItem::modelReseted ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paint()

void QetGraphicsHeaderItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
overridevirtual

QetGraphicsHeaderItem::paint Reimplemented from QGraphicsObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) const;.

Parameters
painter
option
widget
Here is the call graph for this function:

◆ rect()

QRect QetGraphicsHeaderItem::rect ( ) const

QetGraphicsHeaderItem::rect.

Returns
the current rect of the item aka the size of rectangle painted.
Here is the caller graph for this function:

◆ resizeSection()

void QetGraphicsHeaderItem::resizeSection ( int  logicalIndex,
int  size 
)

QetGraphicsHeaderItem::resizeSection.

Parameters
logicalIndex
size
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sectionResized

void QetGraphicsHeaderItem::sectionResized ( int  logicalIndex,
int  size 
)
signal
Here is the caller graph for this function:

◆ sectionSize()

int QetGraphicsHeaderItem::sectionSize ( int  logical_index) const

QetGraphicsHeaderItem::sectionSize.

Parameters
logical_index
Returns
the width (or height for vertical headers) of the given logicalIndex.
Here is the caller graph for this function:

◆ setModel()

void QetGraphicsHeaderItem::setModel ( QAbstractItemModel *  model = nullptr)

QetGraphicsHeaderItem::setModel Set the model presented by this item Since QetGraphicsHeaderItem don't take ownership of model, if item already have a model, it's your responsibility to delete it.

Parameters
model
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUpBoundingRect()

void QetGraphicsHeaderItem::setUpBoundingRect ( )
private

QetGraphicsHeaderItem::setUpBoundingRect Setup the bounding rect of the item.

Here is the caller graph for this function:

◆ setUpMinimumSectionsSize()

void QetGraphicsHeaderItem::setUpMinimumSectionsSize ( )
private

QetGraphicsHeaderItem::setUpMinimumSectionsSize Setup the minimum section size and height of the item. Not that this function doesn't change the current size of this item.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toDXF()

bool QetGraphicsHeaderItem::toDXF ( const QString &  filepath)
virtual

QetGraphicsHeaderItem::toDXF Draw this table to the dxf document.

Parameters
filepathfile path of the the dxf document
Returns
true if draw success
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toXml()

QDomElement QetGraphicsHeaderItem::toXml ( QDomDocument &  document) const

QetGraphicsHeaderItem::toXml save the header to xml.

Parameters
document
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ type()

int QetGraphicsHeaderItem::type ( ) const
inlineoverride

◆ xmlTagName()

static QString QetGraphicsHeaderItem::xmlTagName ( )
inlinestatic
Here is the caller graph for this function:

Member Data Documentation

◆ m_bounding_rect

QRectF QetGraphicsHeaderItem::m_bounding_rect
private

◆ m_current_rect

QRect QetGraphicsHeaderItem::m_current_rect
private

◆ m_current_sections_width

QVector<int> QetGraphicsHeaderItem::m_current_sections_width
private

◆ m_minimum_section_height

int QetGraphicsHeaderItem::m_minimum_section_height =1
private

◆ m_minimum_width

int QetGraphicsHeaderItem::m_minimum_width =1
private

◆ m_model

QPointer<QAbstractItemModel> QetGraphicsHeaderItem::m_model
private

◆ m_section_height

int QetGraphicsHeaderItem::m_section_height =1
private

◆ m_sections_minimum_width

QVector<int> QetGraphicsHeaderItem::m_sections_minimum_width
private

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