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

Serializable snapshot of a QHeaderView's section sizes and visibility. More...

#include <headerstate.h>

+ Inheritance diagram for HeaderState:
+ Collaboration diagram for HeaderState:

Classes

class  SectionState
 Describes the saved state of a single header section. More...
 

Public Member Functions

virtual ~HeaderState ()
 Virtual destructor.
 
virtual QByteArray serializeToJson () const override
 Serialize this header state to a JSON byte array.
 
virtual void deserializeFromJson (const QByteArray &json) override
 Deserialize a header state from a JSON byte array.
 
void addSection (int section, const QString &text, int size, bool visible)
 Record a section in this header state.
 
SectionState getSection (int section)
 Return the saved state for a given section index.
 

Detailed Description

Serializable snapshot of a QHeaderView's section sizes and visibility.

HeaderState captures per-section metadata (index, label, pixel width, and visibility) so that a header view layout can be saved to JSON and restored later.

Definition at line 14 of file headerstate.h.

Constructor & Destructor Documentation

◆ ~HeaderState()

virtual HeaderState::~HeaderState ( )
inlinevirtual

Virtual destructor.

Definition at line 19 of file headerstate.h.

Member Function Documentation

◆ addSection()

void HeaderState::addSection ( int  section,
const QString &  text,
int  size,
bool  visible 
)

Record a section in this header state.

Parameters
sectionLogical section index
textHeader label text
sizeSection pixel width
visibleWhether the section is visible

◆ deserializeFromJson()

virtual void HeaderState::deserializeFromJson ( const QByteArray &  json)
overridevirtual

Deserialize a header state from a JSON byte array.

Parameters
jsonJSON-encoded representation

◆ getSection()

SectionState HeaderState::getSection ( int  section)
inline

Return the saved state for a given section index.

Parameters
sectionLogical section index
Returns
Matching SectionState, or an invalid one if not found

Definition at line 135 of file headerstate.h.

◆ serializeToJson()

virtual QByteArray HeaderState::serializeToJson ( ) const
overridevirtual

Serialize this header state to a JSON byte array.

Returns
JSON-encoded representation

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