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