piintrospector/containers_view.cpp works proper with old and new PIP

This commit is contained in:
2022-06-09 13:23:04 +03:00
parent bddbda43ac
commit f9f49d605c

View File

@@ -214,8 +214,13 @@ int cmp_func_name_d(const PIIntrospectionContainers::TypeInfo * t0, const PIIntr
#endif
CMP_FUNC(item_size)
CMP_FUNC(count)
#if PIP_VERSION >= PIP_MAKE_VERSION(2,35,0)
CMP_FUNC(allocated_bytes)
CMP_FUNC(used_bytes)
#else
CMP_FUNC(allocated)
CMP_FUNC(used)
#endif
#undef CMP_FUNC
void ContainersModel::sort(int column, Qt::SortOrder order) {
ls_column = column;
@@ -228,17 +233,11 @@ void ContainersModel::sort(int column, Qt::SortOrder order) {
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_a : cmp_func_allocated_d; pf = print_func_allocated; break;
case ccBytesUsed : cf = order == Qt::AscendingOrder ? cmp_func_used_a : cmp_func_used_d ; pf = print_func_used; 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;
default : break;
}
if (cf) {
qDebug() << "\nsrc" << column << order;
cur_data.forEach(pf);
cur_data.sort(cf);
qDebug() << "sort" << column << order;
cur_data.forEach(pf);
}
if (cf) cur_data.sort(cf);
#else
switch (column) {
case ccType : cf = order == Qt::AscendingOrder ? cmp_func_name_a : cmp_func_name_d ; break;