created src subdir.

This commit is contained in:
2025-08-06 23:34:43 +02:00
parent 6ff6ea02a4
commit 6bdc487146
63 changed files with 3084 additions and 29 deletions

View File

@@ -0,0 +1,83 @@
/***************************************************************************
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.
***************************************************************************/
#include <QPersistentModelIndex>
#include <QClipboard>
#include <xqmainmodel.h>
#include <xqexception.h>
#include <xqtreeview.h>
#include <xqitemdelegate.h>
#include <xqitem.h>
#include <xqappdata.h>
#include <xqselectionmodel.h>
#include <xqitemfactory.h>
XQMainModel::XQMainModel(QObject *parent )
: XQModel{parent}
{
}
XQMainModel::~XQMainModel()
{
// delete
}
void XQMainModel::initModel(const QString& modelName)
{
XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName );
// #1: create structure: create static sections for this model
for( auto& sheetNode : modelSheet->children() )
{
qDebug() << " create main model: " << sheetNode->tag_name();
XQItemList list = { _itemFactory.makeHeaderItem( sheetNode ) };
Q_ASSERT(!list.isEmpty());
addSection(list, sheetNode );
//appendRow( list );
}
}
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
{
for(const auto& section : _sections )
{
if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") )
{
XQItem* newTreeentry = _itemFactory.makeContentItem( contentNode, section.sheetRootNode );
section.headerItem().appendRow( newTreeentry );
_treeView->expand( section.modelIndex );
// ??
_treeView->setCurrentIndex( section.modelIndex );
newTreeentry->setContentNode(contentNode);
emit xqItemCreated( newTreeentry );
return newTreeentry;
}
}
throw XQException( "createTreeEntry: main model should not be emtpy!" );
}
void XQMainModel::initContextMenu()
{
}