Backup.
This commit is contained in:
@@ -57,7 +57,8 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot )
|
|||||||
|
|
||||||
const XQModelSection& section = _sections.sectionByKey( key );
|
const XQModelSection& section = _sections.sectionByKey( key );
|
||||||
section.setContentRootNode( contentEntry->parent() );
|
section.setContentRootNode( contentEntry->parent() );
|
||||||
int newRow = _sections.lastRow(section);
|
// FaRZ!
|
||||||
|
//int newRow = _sections.lastRow(section);
|
||||||
|
|
||||||
XQNodePtr sheetNode = section.sheetRootNode();
|
XQNodePtr sheetNode = section.sheetRootNode();
|
||||||
XQItemList list = _itemFactory.makeRow( sheetNode, contentEntry );
|
XQItemList list = _itemFactory.makeRow( sheetNode, contentEntry );
|
||||||
@@ -79,7 +80,8 @@ void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& content
|
|||||||
if(section.isValid() )
|
if(section.isValid() )
|
||||||
{
|
{
|
||||||
section.setContentRootNode( contentEntry->parent() );
|
section.setContentRootNode( contentEntry->parent() );
|
||||||
int newRow = _sections.lastRow(section);
|
// FARZ!
|
||||||
|
int newRow = 1;//_sections.lastRow(section);
|
||||||
XQNodePtr sheetNode = section.sheetRootNode();
|
XQNodePtr sheetNode = section.sheetRootNode();
|
||||||
XQItemList list = _itemFactory.makeRow( sheetNode, nullptr );
|
XQItemList list = _itemFactory.makeRow( sheetNode, nullptr );
|
||||||
insertRow( newRow, list);
|
insertRow( newRow, list);
|
||||||
|
@@ -61,8 +61,6 @@ public:
|
|||||||
cmdNew,
|
cmdNew,
|
||||||
cmdDelete,
|
cmdDelete,
|
||||||
|
|
||||||
cmdToggleSection,
|
|
||||||
|
|
||||||
cmdExtern //??
|
cmdExtern //??
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -158,15 +158,17 @@ const XQModelSection& XQSectionManager::createSection(const QString& sectionKey,
|
|||||||
|
|
||||||
//! ermittelt die erste zeile einer section.
|
//! ermittelt die erste zeile einer section.
|
||||||
|
|
||||||
|
/*
|
||||||
int XQSectionManager::firstRow(const QModelIndex& idx) const
|
int XQSectionManager::firstRow(const QModelIndex& idx) const
|
||||||
{
|
{
|
||||||
return sectionByRow(idx.row() ).row();
|
return sectionByRow(idx.row() ).row();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//! ermittelt die zeile unterhalb des gegebenen modelindex,
|
//! ermittelt die zeile unterhalb des gegebenen modelindex,
|
||||||
//! zum einfügen neuer items ebendort.
|
//! zum einfügen neuer items ebendort.
|
||||||
|
|
||||||
|
/*
|
||||||
int XQSectionManager::lastRow(const QModelIndex& idx) const
|
int XQSectionManager::lastRow(const QModelIndex& idx) const
|
||||||
{
|
{
|
||||||
return lastRow(sectionByRow(idx.row()));
|
return lastRow(sectionByRow(idx.row()));
|
||||||
@@ -192,6 +194,18 @@ int XQSectionManager::lastRow(const XQModelSection& section ) const
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
int firstRow(const QModelIndex& idx) const;
|
||||||
|
int lastRow(const QModelIndex& idx) const;
|
||||||
|
int lastRow(const XQModelSection& section) const;
|
||||||
|
*/
|
||||||
|
|
||||||
|
XQSectionPos XQSectionManager::sectionPos()
|
||||||
|
{
|
||||||
|
return XQSectionPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! gibt alle sections aus, zum ankucken.
|
//! gibt alle sections aus, zum ankucken.
|
||||||
|
@@ -20,9 +20,10 @@
|
|||||||
#include <xqmaptor.h>
|
#include <xqmaptor.h>
|
||||||
#include <xqitem.h>
|
#include <xqitem.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Struct containing data for a header section
|
|
||||||
*/
|
|
||||||
|
//! Daten zur beschreibung einer 'sektion' des models.
|
||||||
|
|
||||||
class XQModelSection
|
class XQModelSection
|
||||||
{
|
{
|
||||||
@@ -57,8 +58,15 @@ protected:
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(XQModelSection)
|
Q_DECLARE_METATYPE(XQModelSection)
|
||||||
|
|
||||||
|
//! Erste und letzte ziele einer XQModelSection
|
||||||
|
struct XQSectionPos
|
||||||
|
{
|
||||||
|
int firstRow{-1};
|
||||||
|
int lastRow{-1};
|
||||||
|
};
|
||||||
|
|
||||||
//! 'maptor' struktur, die alle sections enthält
|
|
||||||
|
//! struktur, die alle sections enthält
|
||||||
|
|
||||||
class XQSectionManager
|
class XQSectionManager
|
||||||
{
|
{
|
||||||
@@ -72,9 +80,13 @@ public:
|
|||||||
|
|
||||||
const XQModelSection& createSection(const QString& sectionKey, const QModelIndex& modelIndex, XQNodePtr sheetNode);
|
const XQModelSection& createSection(const QString& sectionKey, const QModelIndex& modelIndex, XQNodePtr sheetNode);
|
||||||
|
|
||||||
|
/*
|
||||||
int firstRow(const QModelIndex& idx) const;
|
int firstRow(const QModelIndex& idx) const;
|
||||||
int lastRow(const QModelIndex& idx) const;
|
int lastRow(const QModelIndex& idx) const;
|
||||||
int lastRow(const XQModelSection& section) const;
|
int lastRow(const XQModelSection& section) const;
|
||||||
|
*/
|
||||||
|
|
||||||
|
XQSectionPos sectionPos();
|
||||||
|
|
||||||
void dump()const;
|
void dump()const;
|
||||||
|
|
||||||
|
@@ -178,27 +178,21 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sectionNod
|
|||||||
void XQViewModel::onToggleSection(const QString& sectionKey )
|
void XQViewModel::onToggleSection(const QString& sectionKey )
|
||||||
{
|
{
|
||||||
qDebug() << " --- onToggleSection: " << sectionKey;
|
qDebug() << " --- onToggleSection: " << sectionKey;
|
||||||
if( _sections.hasValidSection( sectionKey ) )
|
if( _sections.hasValidSection( sectionKey ) && _treeTable )
|
||||||
toggleSection( _sections.sectionByKey(sectionKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void XQViewModel::toggleSection( const XQModelSection& section )
|
|
||||||
{
|
|
||||||
if(_treeTable)
|
|
||||||
{
|
{
|
||||||
const QModelIndex& index = section.persistentModelIndex();
|
//const XQModelSection& section =_sections.sectionByKey(sectionKey);
|
||||||
qDebug() << " ---- toggle section: FIRZ: " << index.isValid() << " : " << index.data().toString() << " : " << section.contentType();//_sections.keyOf( sec );
|
|
||||||
int fstRow = _sections.firstRow( index );
|
//int fstRow = _sections.firstRow(index);
|
||||||
int lstRow = _sections.lastRow( index );
|
//int lstRow = _sections.lastRow(index);
|
||||||
_treeTable->toggleRowsHidden(fstRow, lstRow );
|
//_treeTable->toggleRowsHidden(fstRow, lstRow);
|
||||||
emit sectionToggled( section );
|
|
||||||
|
//emit sectionToggled(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sectionToggled( section );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//! SLOT als weiterleitung vom SIGNAL itemchanged
|
//! SLOT als weiterleitung vom SIGNAL itemchanged
|
||||||
|
|
||||||
@@ -495,13 +489,14 @@ void XQViewModel::cmdNewUndo( const XQCommand& command )
|
|||||||
|
|
||||||
//! schaltet eine section sichtbar oder unsichtbar.
|
//! schaltet eine section sichtbar oder unsichtbar.
|
||||||
|
|
||||||
|
/*
|
||||||
void XQViewModel::cmdToggleSection( const XQCommand& command )
|
void XQViewModel::cmdToggleSection( const XQCommand& command )
|
||||||
{
|
{
|
||||||
const QModelIndex& index = command.originIndex();
|
const QModelIndex& index = command.originIndex();
|
||||||
Q_ASSERT(index.isValid());
|
Q_ASSERT(index.isValid());
|
||||||
toggleSection( _sections.sectionByIndex(index) );
|
toggleSection( _sections.sectionByIndex(index) );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//! gibt die treetable zurück
|
//! gibt die treetable zurück
|
||||||
|
|
||||||
|
@@ -55,7 +55,6 @@ public:
|
|||||||
virtual void initModel( const QString& modelName);
|
virtual void initModel( const QString& modelName);
|
||||||
|
|
||||||
void expandNewItem(const QModelIndex& index);
|
void expandNewItem(const QModelIndex& index);
|
||||||
void toggleSection( const XQModelSection& section );
|
|
||||||
void toggleSection( const QString& sectionKey );
|
void toggleSection( const QString& sectionKey );
|
||||||
|
|
||||||
//little helpers
|
//little helpers
|
||||||
@@ -67,7 +66,7 @@ public:
|
|||||||
|
|
||||||
// undo-/redo-able stuff
|
// undo-/redo-able stuff
|
||||||
|
|
||||||
virtual void cmdToggleSection( const XQCommand& command );
|
//virtual void cmdToggleSection( const XQCommand& command );
|
||||||
virtual void cmdCut( const XQCommand& command );
|
virtual void cmdCut( const XQCommand& command );
|
||||||
virtual void cmdCutUndo( const XQCommand& command );
|
virtual void cmdCutUndo( const XQCommand& command );
|
||||||
virtual void cmdPaste( const XQCommand& command );
|
virtual void cmdPaste( const XQCommand& command );
|
||||||
@@ -77,29 +76,15 @@ public:
|
|||||||
virtual void cmdNew( const XQCommand& command );
|
virtual void cmdNew( const XQCommand& command );
|
||||||
virtual void cmdNewUndo( const XQCommand& command );
|
virtual void cmdNewUndo( const XQCommand& command );
|
||||||
|
|
||||||
|
// Derzeit wird die default-implementierung von data/setData genutzt. hier wäre dann die
|
||||||
|
// Stelle um setData & data an externe 'handler' umzubiegen, siehe giovannies 'model-injection'
|
||||||
/*!
|
|
||||||
|
|
||||||
Derzeit wird die default-implementierung von data/setData genutzt. hier wäre dann die
|
|
||||||
Stelle um setData & data an externe 'handler' umzubiegen, siehe giovannies 'model-injection'
|
|
||||||
|
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override
|
|
||||||
{
|
|
||||||
return QStandardItemModel::data( index, role );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override
|
|
||||||
{
|
|
||||||
qDebug() << " --- setData: " << value.toString();
|
|
||||||
return QStandardItemModel::setData( index, value, role );
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void xqItemChanged( const XQItem& item );
|
void xqItemChanged( const XQItem& item );
|
||||||
|
void itemCreated( XQItem* newItem );
|
||||||
|
void sectionCreated( const XQModelSection& section );
|
||||||
|
void sectionToggled( const XQModelSection& section );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@@ -111,11 +96,7 @@ public slots:
|
|||||||
virtual void onCommandRedo( const XQCommand& command );
|
virtual void onCommandRedo( const XQCommand& command );
|
||||||
virtual void onCommandUndo( const XQCommand& command );
|
virtual void onCommandUndo( const XQCommand& command );
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
void itemCreated( XQItem* newItem );
|
|
||||||
void sectionCreated( const XQModelSection& section );
|
|
||||||
void sectionToggled( const XQModelSection& section );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user