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

2987
doc/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -94,7 +94,7 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot )
section.contentRootNode = contentEntry->parent(); section.contentRootNode = contentEntry->parent();
int newRow = _sections.lastRow(section); int newRow = _sections.lastRow(section);
qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow; //qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow;
XQItemList list = _itemFactory.makeContentRow( contentEntry, section.sheetRootNode ); XQItemList list = _itemFactory.makeContentRow( contentEntry, section.sheetRootNode );
// als Baum? // als Baum?
//section.headerItem().appendRow( list ); //section.headerItem().appendRow( list );

View File

@@ -156,6 +156,8 @@ XQItem::XQItem(const XQItem& other)
} }
//! firz
XQItem::~XQItem() XQItem::~XQItem()
{ {
// fixed choices lebt im item type, also // fixed choices lebt im item type, also
@@ -167,6 +169,8 @@ XQItem::~XQItem()
} }
//! firz
XQItem* XQItem::clone() const XQItem* XQItem::clone() const
{ {
//return new XQItem( *this ); //return new XQItem( *this );
@@ -176,6 +180,9 @@ XQItem* XQItem::clone() const
return new XQItem(); return new XQItem();
} }
//! firz
bool XQItem::isValid() const bool XQItem::isValid() const
{ {
// fragwürdig // fragwürdig
@@ -183,24 +190,31 @@ bool XQItem::isValid() const
} }
//! firz
XQNodePtr XQItem::contentNode() const XQNodePtr XQItem::contentNode() const
{ {
return data( ContentNodeRole ).value<XQNodePtr>(); return data( ContentNodeRole ).value<XQNodePtr>();
} }
//! firz
void XQItem::setContentNode( const XQNodePtr& contentNode ) void XQItem::setContentNode( const XQNodePtr& contentNode )
{ {
QStandardItem::setData( QVariant::fromValue(contentNode), ContentNodeRole); QStandardItem::setData( QVariant::fromValue(contentNode), ContentNodeRole);
} }
//! firz
XQNodePtr XQItem::sheetNode() const XQNodePtr XQItem::sheetNode() const
{ {
// //
return data( SheetNodeRole ).value<XQNodePtr>(); return data( SheetNodeRole ).value<XQNodePtr>();
} }
//! firz
void XQItem::setSheetNode(const XQNodePtr& sheetNode ) void XQItem::setSheetNode(const XQNodePtr& sheetNode )
{ {
@@ -208,12 +222,16 @@ void XQItem::setSheetNode(const XQNodePtr& sheetNode )
} }
//! firz
bool XQItem::hasAttribute( const QString& attribKey ) const bool XQItem::hasAttribute( const QString& attribKey ) const
{ {
return contentNode()->has_attribute( attribKey ); return contentNode()->has_attribute( attribKey );
} }
//! firz
const QString& XQItem::attribute( const QString& attribKey, const QString& defaultValue ) const const QString& XQItem::attribute( const QString& attribKey, const QString& defaultValue ) const
{ {
if( !hasAttribute(attribKey ) ) if( !hasAttribute(attribKey ) )
@@ -221,18 +239,24 @@ const QString& XQItem::attribute( const QString& attribKey, const QString& defau
return contentNode()->attribute( attribKey ); return contentNode()->attribute( attribKey );
} }
//! firz
bool XQItem::testAttribute( const QString& attribKey, const QString& attribValue ) const bool XQItem::testAttribute( const QString& attribKey, const QString& attribValue ) const
{ {
return contentNode()->test_attribute( attribKey, attribValue ); return contentNode()->test_attribute( attribKey, attribValue );
} }
//! firz
XQItemType& XQItem::itemType() const XQItemType& XQItem::itemType() const
{ {
XQItemType* itemTypePtr = QStandardItem::data( XQItem::ItemTypeRole ).value<XQItemType*>(); XQItemType* itemTypePtr = QStandardItem::data( XQItem::ItemTypeRole ).value<XQItemType*>();
return *itemTypePtr; return *itemTypePtr;
} }
//! firz
void XQItem::setItemType( XQItemType* itemTypePtr ) void XQItem::setItemType( XQItemType* itemTypePtr )
{ {
@@ -241,12 +265,16 @@ void XQItem::setItemType( XQItemType* itemTypePtr )
} }
//! firz
void XQItem::addFlag( Qt::ItemFlag newFlag ) void XQItem::addFlag( Qt::ItemFlag newFlag )
{ {
setFlags( flags() | newFlag ); setFlags( flags() | newFlag );
} }
//! firz
void XQItem::clearFlag( Qt::ItemFlag newFlag ) void XQItem::clearFlag( Qt::ItemFlag newFlag )
{ {
setFlags( flags() & ~newFlag); setFlags( flags() & ~newFlag);
@@ -256,16 +284,22 @@ void XQItem::clearFlag( Qt::ItemFlag newFlag )
/// data() access shortcuts /// data() access shortcuts
/// ///
//! firz
XQItem::RenderStyle XQItem::renderStyle() const XQItem::RenderStyle XQItem::renderStyle() const
{ {
return data( RenderStyleRole ).value<RenderStyle>(); return data( RenderStyleRole ).value<RenderStyle>();
} }
//! firz
QString XQItem::renderStyleToString() const QString XQItem::renderStyleToString() const
{ {
return XQItem::fetchRenderStyleToString( renderStyle() ); return XQItem::fetchRenderStyleToString( renderStyle() );
} }
//! firz
void XQItem::setRenderStyle(RenderStyle renderStyle ) void XQItem::setRenderStyle(RenderStyle renderStyle )
{ {
@@ -275,17 +309,22 @@ void XQItem::setRenderStyle(RenderStyle renderStyle )
} }
//! firz
XQItem::EditorType XQItem::editorType() const XQItem::EditorType XQItem::editorType() const
{ {
return data( EditorTypeRole ).value<EditorType>(); return data( EditorTypeRole ).value<EditorType>();
} }
//! firz
QString XQItem::editorTypeToString() const QString XQItem::editorTypeToString() const
{ {
return XQItem::fetchEditorTypeToString( editorType() ); return XQItem::fetchEditorTypeToString( editorType() );
} }
//! firz
void XQItem::setEditorType(EditorType editorType) void XQItem::setEditorType(EditorType editorType)
{ {
@@ -295,24 +334,32 @@ void XQItem::setEditorType(EditorType editorType)
} }
//! firz
XQItem::UnitType XQItem::unitType() const XQItem::UnitType XQItem::unitType() const
{ {
return data( XQItem::UnitTypeRole ).value<UnitType>(); return data( XQItem::UnitTypeRole ).value<UnitType>();
} }
//! firz
QString XQItem::unitTypeToString() const QString XQItem::unitTypeToString() const
{ {
return XQItem::fetchUnitTypeToString( unitType() ); return XQItem::fetchUnitTypeToString( unitType() );
} }
//! firz
void XQItem::setUnitType(UnitType unitType) void XQItem::setUnitType(UnitType unitType)
{ {
setData( QVariant::fromValue(unitType), XQItem::UnitTypeRole); setData( QVariant::fromValue(unitType), XQItem::UnitTypeRole);
} }
//! firz
const QString& XQItem::content() const const QString& XQItem::content() const
{ {
const QString* contentPtr = QStandardItem::data( XQItem::ContentRole ).value<const QString*>(); const QString* contentPtr = QStandardItem::data( XQItem::ContentRole ).value<const QString*>();
@@ -325,16 +372,22 @@ const QString& XQItem::content() const
} }
//! firz
void XQItem::setContent( const QString* content ) void XQItem::setContent( const QString* content )
{ {
setData( QVariant::fromValue<const QString*>(content), XQItem::ContentRole ); setData( QVariant::fromValue<const QString*>(content), XQItem::ContentRole );
} }
//! firz
const QString& XQItem::contentKey() const const QString& XQItem::contentKey() const
{ {
return contentNode()->attributes().key_of( content() ); return contentNode()->attributes().key_of( content() );
} }
//! gibt den content-format string zurück
QString XQItem::contentFormat() const QString XQItem::contentFormat() const
{ {
@@ -348,12 +401,17 @@ void XQItem::setContentFormat(const QString& contentFormat)
} }
//! gibt das read-only auswahl-model zurück (wenn dieses item als
//! combobox gerendert wird)
QStandardItemModel* XQItem::fixedChoices() const QStandardItemModel* XQItem::fixedChoices() const
{ {
return data( XQItem::FixedChoicesRole ).value<QStandardItemModel*>(); return data( XQItem::FixedChoicesRole ).value<QStandardItemModel*>();
} }
//! erzeugt einen string aus den werten des read-only auswahl-models
QString XQItem::fixedChoicesToString() const QString XQItem::fixedChoicesToString() const
{ {
QStandardItemModel* model = fixedChoices(); QStandardItemModel* model = fixedChoices();
@@ -375,21 +433,29 @@ QString XQItem::fixedChoicesToString() const
return result; return result;
} }
//! setzt das auswahl-model für read-only comboboxes
void XQItem::setfixedChoices( QStandardItemModel* newModel ) void XQItem::setfixedChoices( QStandardItemModel* newModel )
{ {
// Der RenderStyle wohnt im ItemType
setData( QVariant::fromValue(newModel), XQItem::FixedChoicesRole); setData( QVariant::fromValue(newModel), XQItem::FixedChoicesRole);
} }
//! true, wenn 'ich' ein header item bin
bool XQItem::isHeaderStyle() bool XQItem::isHeaderStyle()
{ {
return renderStyle() == XQItem::HeaderStyle; return renderStyle() == XQItem::HeaderStyle;
} }
//! gibt den namen der datarole zurück
QString XQItem::dataRoleName(int role)
{
if( role < XQItem::NoRole && model() )
return model()->roleNames()[role];
return XQItem::fetchItemDataRoleName(role);
}
//! angespasste variante von qstandarditem::setData. geteilte attribute
//! werden vom xqitemtype geholt
QVariant XQItem::data(int role ) const QVariant XQItem::data(int role ) const
{ {
//emitDataChanged() //emitDataChanged()

View File

@@ -223,9 +223,14 @@ public:
// //
bool isHeaderStyle(); bool isHeaderStyle();
// ...
//! gibt den namen der datarole zurück
QString dataRoleName(int role);
//! angespasste variante von qstandarditem::data
QVariant data(int role = Qt::DisplayRole ) const override; QVariant data(int role = Qt::DisplayRole ) const override;
//! angespasste variante von qstandarditem::setData
void setData(const QVariant &value, int role ) override; void setData(const QVariant &value, int role ) override;
// Das sind die die items im tree links: icon,text, node pointer // Das sind die die items im tree links: icon,text, node pointer

View File

@@ -272,7 +272,8 @@ void XQModel::cmdCut( XQCommand& command )
} }
} }
//! entfernte knoten aus wieder einfügen , 'command' enthält die liste //! entfernte knoten wieder einfügen , 'command' enthält die liste
void XQModel::cmdCutUndo( XQCommand& command ) void XQModel::cmdCutUndo( XQCommand& command )
{ {
// die anfangsposition // die anfangsposition
@@ -296,6 +297,7 @@ void XQModel::cmdCutUndo( XQCommand& command )
//! clipboard inhalte einfügen //! clipboard inhalte einfügen
void XQModel::cmdPaste( XQCommand& command ) void XQModel::cmdPaste( XQCommand& command )
{ {
// selection holen ... // selection holen ...
@@ -315,19 +317,13 @@ void XQModel::cmdPaste( XQCommand& command )
// wir pasten das clipboard // wir pasten das clipboard
for (auto& entry : _clipBoard ) for (auto& entry : _clipBoard )
{ {
// // noch ein clone vom clone erzeugen ...
// siehe! und es war schrott! XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode );
// newNode->clone(section.contentRootNode )->add_me_at( nodePos );
// ... und damit eine frische item-row erzeugen
// das ist ein clon XQItemList list = _itemFactory.makeContentRow( newNode, section.sheetRootNode );
XQNodePtr savedNode = entry.contentNode;
// der wir hier rein gelinkt
XQItemList list = _itemFactory.makeContentRow( savedNode, section.sheetRootNode );
// wir klonen den knoten aus dem clipbord
savedNode->clone(section.contentRootNode )->add_me_at( nodePos );
insertRow( insRow, list ); insertRow( insRow, list );
// die neue item-row selektieren
const QModelIndex& selIdx = list[0]->index(); const QModelIndex& selIdx = list[0]->index();
_treeView->selectionModel()->select(selIdx, QItemSelectionModel::Select | QItemSelectionModel::Rows); _treeView->selectionModel()->select(selIdx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
// zur nächsten zeile // zur nächsten zeile
@@ -341,6 +337,8 @@ void XQModel::cmdPaste( XQCommand& command )
} }
//! einfügen aus dem clipboard wieder rückgängig machen
void XQModel::cmdPasteUndo( XQCommand& command ) void XQModel::cmdPasteUndo( XQCommand& command )
{ {
command.dumpList("Paste UNDO"); command.dumpList("Paste UNDO");
@@ -359,6 +357,7 @@ void XQModel::cmdPasteUndo( XQCommand& command )
// don't clone into clipboard, remove items // don't clone into clipboard, remove items
void XQModel::cmdDelete( XQCommand& command ) void XQModel::cmdDelete( XQCommand& command )
{ {
// wir gehen rückwärts über alle markieren knoten ... // wir gehen rückwärts über alle markieren knoten ...

View File

@@ -72,8 +72,6 @@ SOURCES += \
widgets/xqtreeview.cpp widgets/xqtreeview.cpp
FORMS += \ FORMS += \
application/xqmainwindow.ui application/xqmainwindow.ui

8
src/xtree.qrc Normal file
View File

@@ -0,0 +1,8 @@
<RCC>
<qresource prefix="/">
<file>../xml/modeldata1.xtr</file>
<file>../xml/modeldata2.xtr</file>
<file>../xml/modeldata3.xtr</file>
<file>../xml/modelsheets.xml</file>
</qresource>
</RCC>

View File

@@ -1,8 +0,0 @@
<RCC>
<qresource prefix="/">
<file>xml/modeldata1.xtr</file>
<file>xml/modeldata2.xtr</file>
<file>xml/modeldata3.xtr</file>
<file>xml/modelsheets.xml</file>
</qresource>
</RCC>