fixed cut undo.

This commit is contained in:
2025-09-07 11:29:51 +02:00
parent 1531ec14f1
commit 50703a4c44
2 changed files with 22 additions and 10 deletions

View File

@@ -128,14 +128,21 @@ const XQModelSection& XQSectionManager::sectionByKey( const QString& sectionKey
const XQModelSection& XQSectionManager::sectionByRow(int itemRow ) const
{
// wir gehen rückwärts, weil wir da nur einen vergleich brauchen
// und uns den test mit lastRow() sparen können.
int i = _sections.size() - 1;
for (; i >= 0; --i)
if( _sections.size() > 0)
{
if ( _sections.at(i).startIndex().row() <= itemRow )
return _sections.at(i);
// shortcut für die erste position
// wir gehen rückwärts, weil wir da nur einen vergleich brauchen
// und uns den test mit lastRow() sparen können.
int i = _sections.size() - 1;
for (; i >= 0; --i)
{
if ( _sections.at(i).startIndex().row() < itemRow )
return _sections.at(i);
}
}
throw XQException( "No section for item row: ", QString::number(itemRow));