| 604 | } |
| 605 | |
| 606 | [[nodiscard]] bool ResourceFolderModel::ProxyModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const |
| 607 | { |
| 608 | auto* model = qobject_cast<ResourceFolderModel*>(sourceModel()); |
| 609 | if (!model || !source_left.isValid() || !source_right.isValid() || source_left.column() != source_right.column()) { |
| 610 | return QSortFilterProxyModel::lessThan(source_left, source_right); |
| 611 | } |
| 612 | |
| 613 | // we are now guaranteed to have two valid indexes in the same column... we love the provided invariants unconditionally and |
| 614 | // proceed. |
| 615 | |
| 616 | auto column_sort_key = model->columnToSortKey(source_left.column()); |
| 617 | auto const& resource_left = model->at(source_left.row()); |
| 618 | auto const& resource_right = model->at(source_right.row()); |
| 619 | |
| 620 | auto compare_result = resource_left.compare(resource_right, column_sort_key); |
| 621 | if (compare_result == 0) |
| 622 | return QSortFilterProxyModel::lessThan(source_left, source_right); |
| 623 | |
| 624 | return compare_result < 0; |
| 625 | } |
| 626 | |
| 627 | QString ResourceFolderModel::instDirPath() const |
| 628 | { |
nothing calls this directly
no test coverage detected