return aRes;
}
- int aDestinationRow = -1;
+ int aDestinationIndex = -1;
switch ( theType ) {
case Up:
if ( theItem > 0 ) {
- aDestinationRow = theItem - 1;
+ aDestinationIndex = theItem - 1;
if ( theIsVisibleOnly ) {
- while ( aDestinationRow >= 0 && !myObjects.at( aDestinationRow ).second ) {
- aDestinationRow--;
+ while ( aDestinationIndex >= 0 && !IsObjectVisible( aDestinationIndex ) ) {
+ aDestinationIndex--;
}
}
}
break;
case Down:
if ( theItem < myObjects.count() - 1 ) {
- aDestinationRow = theItem + 1;
+ aDestinationIndex = theItem + 1;
if ( theIsVisibleOnly ) {
- while ( aDestinationRow < myObjects.count() && !myObjects.at( aDestinationRow ).second ) {
- aDestinationRow++;
+ while ( aDestinationIndex < myObjects.count() && !IsObjectVisible( aDestinationIndex ) ) {
+ aDestinationIndex++;
}
}
}
break;
case Top:
if ( theItem > 0 ) {
- aDestinationRow = 0;
+ aDestinationIndex = 0;
}
break;
case Bottom:
if ( theItem < myObjects.count() - 1 ) {
- aDestinationRow = myObjects.count() - 1;
+ aDestinationIndex = myObjects.count() - 1;
}
break;
}
- if ( aDestinationRow >= 0 && aDestinationRow < myObjects.count() ) {
- int aDestination = (theType == Up || theType == Top) ? aDestinationRow : aDestinationRow + 1;
- if ( beginMoveRows( QModelIndex(), theItem, theItem, QModelIndex(), aDestination ) ) {
- myObjects.move( theItem, aDestinationRow ); //TODO ???
+ if ( aDestinationIndex >= 0 && aDestinationIndex < myObjects.count() ) {
+ int aDestinationRow = (theType == Up || theType == Top) ? aDestinationIndex : aDestinationIndex + 1;
+ if ( beginMoveRows( QModelIndex(), theItem, theItem, QModelIndex(), aDestinationRow ) ) {
+ myObjects.move( theItem, aDestinationIndex );
endMoveRows();
aRes = true;
}