| 1079 | } |
| 1080 | |
| 1081 | int QMappingSequenceEdit::getInsertRowFromSelectionOrAppend(int insertMode) const |
| 1082 | { |
| 1083 | const MappingSequenceEditTableWidget *table = ui->mappingSequenceEditTable; |
| 1084 | |
| 1085 | QList<QTableWidgetSelectionRange> ranges = table->selectedRanges(); |
| 1086 | if (ranges.isEmpty()) { |
| 1087 | return m_MappingSequenceList.size(); |
| 1088 | } |
| 1089 | |
| 1090 | const QTableWidgetSelectionRange range = ranges.first(); |
| 1091 | const int topRow = range.topRow(); |
| 1092 | const int bottomRow = range.bottomRow(); |
| 1093 | |
| 1094 | const int preferredRow = (insertMode == TABLE_INSERT_MODE_BELOW) |
| 1095 | ? (bottomRow + 1) |
| 1096 | : topRow; |
| 1097 | |
| 1098 | return qBound(0, preferredRow, m_MappingSequenceList.size()); |
| 1099 | } |
| 1100 | |
| 1101 | void QMappingSequenceEdit::reselectionRangeAndScroll(int top_row, int bottom_row) |
| 1102 | { |