MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / lessThan

Method lessThan

launcher/minecraft/mod/ResourceFolderModel.cpp:606–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
627QString ResourceFolderModel::instDirPath() const
628{

Callers

nothing calls this directly

Calls 4

columnToSortKeyMethod · 0.80
isValidMethod · 0.45
atMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected