little breakthrought im QML Layouts
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user