Enable section toggle
This commit is contained in:
87
src/model/xqsectionmanager.h
Normal file
87
src/model/xqsectionmanager.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/***************************************************************************
|
||||
|
||||
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 XQSECTIONMANAGER_H
|
||||
#define XQSECTIONMANAGER_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;
|
||||
|
||||
QModelIndex persistentModelIndex() const;
|
||||
XQNodePtr sectionRootNode() const;
|
||||
XQNodePtr sheetRootNode() const;
|
||||
XQNodePtr contentRootNode() const;
|
||||
void setContentRootNode( const XQNodePtr dataRootNode ) const;
|
||||
|
||||
const QString& contentType() const;
|
||||
XQItem& headerItem() const;
|
||||
|
||||
protected:
|
||||
|
||||
QPersistentModelIndex _modelIndex;
|
||||
|
||||
mutable XQNodePtr _sectionRootNode{};
|
||||
mutable XQNodePtr _contentRootNode{};
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(XQModelSection)
|
||||
|
||||
|
||||
//! 'maptor' struktur, die alle sections enthält
|
||||
|
||||
class XQSectionManager
|
||||
{
|
||||
public:
|
||||
|
||||
bool hasValidSection(const QString& sectionKey) const;
|
||||
|
||||
const XQModelSection& sectionByKey( const QString& sectionKey );
|
||||
const XQModelSection& sectionByRow( int row ) const;
|
||||
const XQModelSection& sectionByIndex( const QModelIndex& index ) const;
|
||||
|
||||
const XQModelSection& createSection(const QString& sectionKey, const QModelIndex& modelIndex, XQNodePtr sheetNode);
|
||||
|
||||
int firstRow(const QModelIndex& idx) const;
|
||||
int lastRow(const QModelIndex& idx) const;
|
||||
int lastRow(const XQModelSection& section) const;
|
||||
|
||||
void dump()const;
|
||||
|
||||
protected:
|
||||
|
||||
XQMaptor<XQModelSection> _sections;
|
||||
|
||||
};
|
||||
|
||||
#endif // XQSECTIONMANAGER_H
|
Reference in New Issue
Block a user