code brush

This commit is contained in:
Бычков Анлрей
2022-06-09 13:39:30 +03:00
parent f9f49d605c
commit ebe7f3fc73

View File

@@ -228,16 +228,14 @@ void ContainersModel::sort(int column, Qt::SortOrder order) {
if (cur_data.isEmpty()) return;
PIVector<PIIntrospectionContainers::TypeInfo>::CompareFunc cf = nullptr;
#if PIP_VERSION >= PIP_MAKE_VERSION(2,35,0)
std::function<void(PIIntrospectionContainers::TypeInfo & e)> pf;
switch (column) {
case ccType : cf = order == Qt::AscendingOrder ? cmp_func_name_a : cmp_func_name_d ; pf = print_func_name; break;
case ccItemSize : cf = order == Qt::AscendingOrder ? cmp_func_item_size_a : cmp_func_item_size_d; pf = print_func_item_size; break;
case ccCount : cf = order == Qt::AscendingOrder ? cmp_func_count_a : cmp_func_count_d ; pf = print_func_count; break;
case ccBytesAllocated: cf = order == Qt::AscendingOrder ? cmp_func_allocated_bytes_a : cmp_func_allocated_bytes_d; pf = print_func_allocated_bytes; break;
case ccBytesUsed : cf = order == Qt::AscendingOrder ? cmp_func_used_bytes_a : cmp_func_used_bytes_d ; pf = print_func_used_bytes; break;
case ccType : cf = order == Qt::AscendingOrder ? cmp_func_name_a : cmp_func_name_d ; break;
case ccItemSize : cf = order == Qt::AscendingOrder ? cmp_func_item_size_a : cmp_func_item_size_d; break;
case ccCount : cf = order == Qt::AscendingOrder ? cmp_func_count_a : cmp_func_count_d ; break;
case ccBytesAllocated: cf = order == Qt::AscendingOrder ? cmp_func_allocated_bytes_a : cmp_func_allocated_bytes_d; break;
case ccBytesUsed : cf = order == Qt::AscendingOrder ? cmp_func_used_bytes_a : cmp_func_used_bytes_d ; break;
default : break;
}
if (cf) cur_data.sort(cf);
#else
switch (column) {
case ccType : cf = order == Qt::AscendingOrder ? cmp_func_name_a : cmp_func_name_d ; break;
@@ -247,8 +245,8 @@ void ContainersModel::sort(int column, Qt::SortOrder order) {
case ccBytesUsed : cf = order == Qt::AscendingOrder ? cmp_func_used_a : cmp_func_used_d ; break;
default : break;
}
if (cf) cur_data.sort(cf);
#endif
if (cf) cur_data.sort(cf);
//qDebug() << "sort" << column << order;
dataChanged(index(0, 0), index(cur_data.size_s() - 1, columnCount()));
}