little breakthrought im QML Layouts

This commit is contained in:
2025-08-26 17:45:06 +02:00
parent a39ce321f2
commit b217f2f9ad
16 changed files with 463 additions and 70 deletions

View File

@@ -40,9 +40,9 @@ bool XQModelSection::isValid() const
return _modelIndex.isValid() && _sectionRootNode;
}
const QModelIndex& XQModelSection::modelIndex() const
QModelIndex XQModelSection::persistentModelIndex() const
{
return _modelIndex;
return _modelIndex.operator QModelIndex();
}
XQNodePtr XQModelSection::sectionRootNode() const
@@ -129,7 +129,7 @@ const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const
int i = size() - 1;
for (; i >= 0; --i)
{
if ( at(i).modelIndex().row() < itemRow )
if ( at(i).persistentModelIndex().row() < itemRow )
return at(i);
}
@@ -170,7 +170,7 @@ int XQModelSectionList::lastRow(const XQModelSection& section ) const
{
// last section? return last row of model
if (index == size() - 1)
return section.modelIndex().model()->rowCount();// - 1;
return section.persistentModelIndex().model()->rowCount();// - 1;
// return row above the row of the next section -> last row of given section
return at(index+1).row();
}
@@ -185,7 +185,7 @@ void XQModelSectionList::dump() const
qDebug() << " --- sections dump(): " <<size() << " entries.";
for( int i = 0; i<size(); ++i )
{
QModelIndex idx = at(i).modelIndex();
QModelIndex idx = at(i).persistentModelIndex();
qDebug() << " --- sections:" << i << "row: " << idx.row() << " keyOf(i): " << keyOf(i) << " indexData: "<< idx.data().toString() << " itemData: " << XQItem::xqItemFromIndex(idx).data(Qt::DisplayRole).toString();
}