little de-firzifikation.

This commit is contained in:
2025-08-07 18:49:18 +02:00
parent d70df0cbaa
commit 666a2a9440
6 changed files with 33 additions and 35 deletions

View File

@@ -20,6 +20,10 @@
#include <xqtreetable.h> #include <xqtreetable.h>
#include <xqitemfactory.h> #include <xqitemfactory.h>
//! default konstruktor.
XQChildModel::XQChildModel( QObject *parent ) XQChildModel::XQChildModel( QObject *parent )
: XQViewModel{parent} : XQViewModel{parent}
{ {
@@ -27,15 +31,8 @@ XQChildModel::XQChildModel( QObject *parent )
} }
XQChildModel::~XQChildModel() //! erzeugt die basisstruktur des models.
{
}
/**
* @brief XQChildModel::initModel: Create the own modelstructure
* using subtree 'Components'
*/
void XQChildModel::initModel(const QString& modelName) void XQChildModel::initModel(const QString& modelName)
{ {
// #0: Wir suchen die Model-Beschreibung // #0: Wir suchen die Model-Beschreibung
@@ -65,6 +62,8 @@ void XQChildModel::initModel(const QString& modelName)
} }
//! erzegut den sichtbaren inhalt des models aus einem root-datenknoten.
void XQChildModel::setContent( const XQNodePtr& contentRoot ) void XQChildModel::setContent( const XQNodePtr& contentRoot )
{ {
@@ -105,6 +104,8 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot )
} }
//! firz
void XQChildModel::createModelContentChildRow( QStandardItem* parent, XQNodePtr contentNode ) void XQChildModel::createModelContentChildRow( QStandardItem* parent, XQNodePtr contentNode )
{ {
/* /*
@@ -121,6 +122,8 @@ void XQChildModel::createModelContentChildRow( QStandardItem* parent, XQNodePtr
} }
//! erzeugt ein adhoc-contextmenu, je nachdem welche aktionen gerade möflich sind.
void XQChildModel::initContextMenu() void XQChildModel::initContextMenu()
{ {

View File

@@ -27,7 +27,7 @@ class XQChildModel : public XQViewModel
public: public:
explicit XQChildModel(QObject *parent = nullptr); explicit XQChildModel(QObject *parent = nullptr);
virtual ~XQChildModel(); virtual ~XQChildModel() = default;
void initModel(const QString& modelName) override; void initModel(const QString& modelName) override;
void setContent(const XQNodePtr& contentRoot ); void setContent(const XQNodePtr& contentRoot );

View File

@@ -28,7 +28,7 @@ void XQNodeStore::dumpList( const QString& title ) const
} }
//! firz //! kostruktor. übergibt command-type und die aufrufende modelView.
XQCommand::XQCommand(CmdType cmdType, XQViewModel* modelView ) XQCommand::XQCommand(CmdType cmdType, XQViewModel* modelView )
: _cmdType{ cmdType }, _model(modelView) : _cmdType{ cmdType }, _model(modelView)
@@ -46,7 +46,7 @@ XQCommand::~XQCommand()
//! firz //! gibt den enum-type dieses commands zurück.
XQCommand::CmdType XQCommand::commandType() const XQCommand::CmdType XQCommand::commandType() const
{ {
@@ -54,7 +54,7 @@ XQCommand::CmdType XQCommand::commandType() const
} }
//! firz //! setzt den enum-type dieses commands.
void XQCommand::setCommandType( XQCommand::CmdType cmdType ) void XQCommand::setCommandType( XQCommand::CmdType cmdType )
{ {

View File

@@ -16,7 +16,8 @@
#include <xqitem.h> #include <xqitem.h>
//! firz //! kontstruktor. übergibt den start-index und einen model-knoten mit der beschreibung
//! der datenknoten.
XQModelSection::XQModelSection(const QModelIndex& aModelIndex, XQNodePtr aSheetNode) XQModelSection::XQModelSection(const QModelIndex& aModelIndex, XQNodePtr aSheetNode)
: modelIndex{ aModelIndex }, sheetRootNode{ aSheetNode } : modelIndex{ aModelIndex }, sheetRootNode{ aSheetNode }
@@ -25,7 +26,7 @@ XQModelSection::XQModelSection(const QModelIndex& aModelIndex, XQNodePtr aSheetN
} }
//! firz //! elementvergleich.
bool XQModelSection::operator==(const XQModelSection& other) const bool XQModelSection::operator==(const XQModelSection& other) const
{ {
@@ -33,7 +34,7 @@ bool XQModelSection::operator==(const XQModelSection& other) const
} }
//! firz //! true wenn der start-index valide und ein model-knoten vorhanden.
bool XQModelSection::isValid() const bool XQModelSection::isValid() const
{ {
@@ -41,7 +42,7 @@ bool XQModelSection::isValid() const
} }
//! firz //! gibt die zeile des start-index zurück.
int XQModelSection::XQModelSection::row() const int XQModelSection::XQModelSection::row() const
{ {
@@ -49,7 +50,7 @@ int XQModelSection::XQModelSection::row() const
} }
//! firz //! gibt das dieser section entsprechende header-item zurück.
XQItem& XQModelSection::XQModelSection::headerItem() const XQItem& XQModelSection::XQModelSection::headerItem() const
{ {
@@ -57,20 +58,14 @@ XQItem& XQModelSection::XQModelSection::headerItem() const
} }
//
//
// -------------------------------------------------------------------------------------------------------------------------------------------------------
//
//
void XQModelSectionList::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode)
void XQModelSections::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode)
{ {
XQModelSection section(idx, sheetNode); XQModelSection section(idx, sheetNode);
addAtKey(sheetNode->tag_name(), section); addAtKey(sheetNode->tag_name(), section);
} }
bool XQModelSections::hasValidSection(const QString& sectionKey) const bool XQModelSectionList::hasValidSection(const QString& sectionKey) const
{ {
if (!contains(sectionKey) ) if (!contains(sectionKey) )
return false; return false;
@@ -78,13 +73,13 @@ bool XQModelSections::hasValidSection(const QString& sectionKey) const
} }
const XQModelSection& XQModelSections::sectionxqItemFromIndex( const QModelIndex& index ) const const XQModelSection& XQModelSectionList::sectionxqItemFromIndex( const QModelIndex& index ) const
{ {
return sectionFromRow( index.row() ); return sectionFromRow( index.row() );
} }
const XQModelSection& XQModelSections::sectionFromRow(int itemRow ) const const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const
{ {
int i = size() - 1; int i = size() - 1;
@@ -100,19 +95,19 @@ const XQModelSection& XQModelSections::sectionFromRow(int itemRow ) const
} }
int XQModelSections::firstRow(const QModelIndex& idx) const int XQModelSectionList::firstRow(const QModelIndex& idx) const
{ {
return sectionFromRow(idx.row() ).row(); return sectionFromRow(idx.row() ).row();
} }
int XQModelSections::lastRow(const QModelIndex& idx) const int XQModelSectionList::lastRow(const QModelIndex& idx) const
{ {
return lastRow(sectionFromRow(idx.row())); return lastRow(sectionFromRow(idx.row()));
} }
int XQModelSections::lastRow(const XQModelSection& section ) const int XQModelSectionList::lastRow(const XQModelSection& section ) const
{ {
//qDebug() << " -- last row in section: " << section.modelIndex.data().toString() << " --> " << section.modelIndex.row(); //qDebug() << " -- last row in section: " << section.modelIndex.data().toString() << " --> " << section.modelIndex.row();
// row() der section unterhalb dieser // row() der section unterhalb dieser
@@ -130,7 +125,7 @@ int XQModelSections::lastRow(const XQModelSection& section ) const
} }
void XQModelSections::dump() const void XQModelSectionList::dump() const
{ {
qDebug() << " --- sections dump(): " <<size() << " entries."; qDebug() << " --- sections dump(): " <<size() << " entries.";
for( int i = 0; i<size(); ++i ) for( int i = 0; i<size(); ++i )

View File

@@ -47,12 +47,12 @@ struct XQModelSection
* @brief Maptor containing all header sections. * @brief Maptor containing all header sections.
*/ */
class XQModelSections : public XQMaptor<XQModelSection> class XQModelSectionList : public XQMaptor<XQModelSection>
{ {
public: public:
XQModelSections() = default; XQModelSectionList() = default;
virtual ~XQModelSections() = default; virtual ~XQModelSectionList() = default;
void addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode ); void addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode );
bool hasValidSection(const QString& sectionKey) const; bool hasValidSection(const QString& sectionKey) const;

View File

@@ -123,7 +123,7 @@ protected:
// das eine reference auf ein globales singleton // das eine reference auf ein globales singleton
XQItemFactory& _itemFactory; XQItemFactory& _itemFactory;
XQSimpleClipBoard _clipBoard; XQSimpleClipBoard _clipBoard;
XQModelSections _sections; XQModelSectionList _sections;
XQTreeTable* _treeTable{}; XQTreeTable* _treeTable{};
QUndoStack* _undoStack{}; QUndoStack* _undoStack{};