73 lines
1.7 KiB
C++
73 lines
1.7 KiB
C++
/***************************************************************************
|
|
|
|
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 XQMODELSECTIONS_H
|
|
#define XQMODELSECTIONS_H
|
|
|
|
#include <QPersistentModelIndex>
|
|
#include <xqnode.h>
|
|
#include <xqmaptor.h>
|
|
|
|
class XQItem;
|
|
|
|
/**
|
|
* @brief Struct containing data for a header section
|
|
*/
|
|
|
|
struct XQModelSection
|
|
{
|
|
QPersistentModelIndex modelIndex;
|
|
|
|
// müsse die hier sein?
|
|
XQNodePtr sheetRootNode{};
|
|
XQNodePtr dataRootNode{};
|
|
|
|
XQModelSection() = default;
|
|
XQModelSection(const QModelIndex& aModelIndex, XQNodePtr aSheetNode);
|
|
|
|
bool operator==(const XQModelSection& other) const;
|
|
bool isValid() const;
|
|
int row() const;
|
|
XQItem& headerItem() const;
|
|
|
|
};
|
|
|
|
|
|
/**
|
|
* @brief Maptor containing all header sections.
|
|
*/
|
|
|
|
class XQModelSections : public XQMaptor<XQModelSection>
|
|
{
|
|
public:
|
|
|
|
XQModelSections() = default;
|
|
virtual ~XQModelSections() = default;
|
|
|
|
void addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode );
|
|
bool hasValidSection(const QString& sectionKey) const;
|
|
|
|
const XQModelSection& sectionFromRow( int row ) const;
|
|
const XQModelSection& sectionxqItemFromIndex( 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 // XQMODELSECTIONS_H
|