Files
xtree.old.ng/src/application/xqmainmodel.cpp

83 lines
2.2 KiB
C++
Raw Normal View History

2025-08-05 22:39:41 +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.
***************************************************************************/
#include <QPersistentModelIndex>
#include <QClipboard>
#include <xqmainmodel.h>
#include <xqexception.h>
2025-08-07 03:11:56 +02:00
#include <xqtreetable.h>
2025-08-05 22:39:41 +02:00
#include <xqitemdelegate.h>
#include <xqitem.h>
#include <xqappdata.h>
#include <xqselectionmodel.h>
#include <xqitemfactory.h>
2025-08-08 21:39:33 +02:00
//! default konstruktor.
2025-08-05 22:39:41 +02:00
XQMainModel::XQMainModel(QObject *parent )
2025-08-07 03:11:56 +02:00
: XQViewModel{parent}
2025-08-05 22:39:41 +02:00
{
}
2025-08-11 22:27:55 +02:00
//! leere default implementation
2025-08-05 22:39:41 +02:00
void XQMainModel::initContextMenu()
{
}
2025-08-16 22:03:41 +02:00
//! erzeugt einen eintrag in der baum-übersicht.
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
{
for(const auto& section : _sections )
{
qDebug() << " --- wtf1: " << contentNode->to_string();
qDebug() << " --- wtf2: " << section.sheetRootNode()->to_string();
/*
if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") )
{
//XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode );
makeTreeChildItem:
// den itemtype des neuen items rausfinden
QString typeKey = sheetEntry->attribute("ItemType");
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
//XQItemType* itemType = makeItemType(sheetEntry); // throws
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
XQItem* newItem = new XQItem( itemType, contentPtr );
return newItem;
section.headerItem().appendRow( newTreeentry );
_treeTable->expand( section.modelIndex );
// ??
_treeTable->setCurrentIndex( section.modelIndex );
newTreeentry->setContentNode(contentNode);
emit xqItemCreated( newTreeentry );
return newTreeentry;
}
*/
}
throw XQException( "createTreeEntry: main model should not be empty!" );
}