Files
xtree/src/model/xqmodelsectionlist.h

81 lines
1.9 KiB
C
Raw Normal View History

2025-08-22 22:57:06 +02:00
/***************************************************************************
source::worx xtree
Copyright © 2024-2025 c.holzheuer
christoph.holzheuer@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#ifndef XQMODELSECTIONLIST_H
#define XQMODELSECTIONLIST_H
#include <QPersistentModelIndex>
#include <xqmaptor.h>
#include <xqitem.h>
/**
* @brief Struct containing data for a header section
*/
class XQModelSection
{
public:
XQModelSection() = default;
XQModelSection(const QModelIndex& modelIndex, XQNodePtr sheetNode );
bool operator==(const XQModelSection& other) const;
bool isValid() const;
int row() const;
2025-08-26 17:45:06 +02:00
QModelIndex persistentModelIndex() const;
2025-08-22 22:57:06 +02:00
XQNodePtr sectionRootNode() const;
XQNodePtr sheetRootNode() const;
XQNodePtr contentRootNode() const;
void setContentRootNode( const XQNodePtr dataRootNode );
const QString& contentType() const;
XQItem& headerItem() const;
protected:
QPersistentModelIndex _modelIndex;
XQNodePtr _sectionRootNode{};
XQNodePtr _contentRootNode{};
};
Q_DECLARE_METATYPE(XQModelSection)
2025-09-01 17:40:08 +02:00
//! 'maptor' struktur, die alle sections enthält
2025-08-22 22:57:06 +02:00
class XQModelSectionList : public XQMaptor<XQModelSection>
{
public:
bool hasValidSection(const QString& sectionKey) const;
const XQModelSection& sectionFromRow( int row ) const;
const XQModelSection& sectionFromIndex( const QModelIndex& index ) const;
int firstRow(const QModelIndex& idx) const;
int lastRow(const QModelIndex& idx) const;
int lastRow(const XQModelSection& section) const;
void dump()const override;
};
#endif // XQMODELSECTIONLIST_H