-- fy
This commit is contained in:
@@ -83,6 +83,16 @@ XQItem& XQViewModel::xqFirstItem(int row) const
|
||||
return *static_cast<XQItem*>( QStandardItemModel::item(row) );
|
||||
}
|
||||
|
||||
void XQViewModel::expandNewItem(const QModelIndex& index)
|
||||
{
|
||||
if( _treeTable )
|
||||
{
|
||||
// ... ausklappen...
|
||||
_treeTable->expand( index );
|
||||
// ... und markieren
|
||||
_treeTable->setCurrentIndex( index );
|
||||
}
|
||||
}
|
||||
|
||||
//! initialisiert dieses model über den namen. Es wird hier
|
||||
//! nur die strukur erzeugt, keine inhalte.
|
||||
@@ -148,6 +158,27 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sectionNod
|
||||
}
|
||||
|
||||
|
||||
void XQViewModel::onToggleSection(const QString& sectionKey )
|
||||
{
|
||||
qDebug() << " --- onToggleSection: " << sectionKey;
|
||||
/*
|
||||
|
||||
connect(model, &QStandardItemModel::dataChanged, this, &YourClass::onItemChanged);
|
||||
|
||||
void YourClass::onItemChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
||||
{
|
||||
if (roles.contains(Qt::CheckStateRole)) {
|
||||
Qt::CheckState state = static_cast<Qt::CheckState>(topLeft.data(Qt::CheckStateRole).toInt());
|
||||
if (state == Qt::Checked) {
|
||||
qDebug() << "Checkbox wurde aktiviert!";
|
||||
// Hier kannst du dein QObject benachrichtigen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//! SLOT, der aufgerufen wird, wenn eine edit-action getriggert wurde.
|
||||
|
||||
void XQViewModel::onActionTriggered(QAction* action)
|
||||
@@ -428,6 +459,29 @@ void XQViewModel::cmdNew( const XQCommand& command )
|
||||
*/
|
||||
}
|
||||
|
||||
void XQViewModel::toggleSection( const XQModelSection& section )
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
if(_treeTable)
|
||||
{
|
||||
|
||||
qDebug() << " ---- FIRZ: " << _sections.keyOf( sec );
|
||||
int fstRow = _sections.firstRow( index );
|
||||
int lstRow = _sections.lastRow( index );
|
||||
_treeTable->toggleRowsHidden(fstRow, lstRow );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
emit sectionToggled( section );
|
||||
|
||||
}
|
||||
|
||||
//! entfernt die neu angelegte zeile.
|
||||
|
||||
void XQViewModel::cmdNewUndo( const XQCommand& command )
|
||||
@@ -441,19 +495,11 @@ void XQViewModel::cmdToggleSection( const XQCommand& command )
|
||||
{
|
||||
const QModelIndex& index = command.originIndex();
|
||||
Q_ASSERT(index.isValid());
|
||||
|
||||
int fstRow = _sections.firstRow( index );
|
||||
int lstRow = _sections.lastRow( index );
|
||||
|
||||
bool hidden =_treeTable->isRowHidden( fstRow, _treeTable->rootIndex() );
|
||||
for (int row = fstRow; row < lstRow; ++row )
|
||||
_treeTable->setRowHidden( row, _treeTable->rootIndex(), !hidden );
|
||||
|
||||
emit sectionToggled( _sections.sectionFromIndex(index) );
|
||||
toggleSection( _sections.sectionFromIndex(index) );
|
||||
}
|
||||
|
||||
|
||||
//! git die treetable zurück
|
||||
//! gibt die treetable zurück
|
||||
|
||||
XQTreeTable* XQViewModel::treeTable()
|
||||
{
|
||||
|
Reference in New Issue
Block a user