New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve file table sort model #905
Improve file table sort model #905
Conversation
修复了 cloud file browser 中排序相关的两个 bug. |
e3ee038
to
6141421
Compare
src/filebrowser/file-table.cpp
Outdated
QVariant leftData = source_model_->data(left); | ||
QVariant rightData = source_model_->data(right); | ||
|
||
if (leftData.type() == QVariant::ULongLong) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该根据 ModelIndex 是哪一列来决定怎么排序, 而不是根据数据的类型来决定
如果是文件名那一列,就用 digitalCompare, 其它的就用默认的排序
src/filebrowser/file-table.cpp
Outdated
(right.column() == FILE_COLUMN_NAME)) { | ||
const QString left_name = source_model_->direntAt(left.row())->name; | ||
const QString right_name = source_model_->direntAt(right.row())->name; | ||
return digitalCompare(left_name, right_name) < 0 ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ return digitalCompare(left_name, right_name) < 0 ? true : false;
后面的 ? true : false 这个不需要吧
60f772a
to
15c9cc8
Compare
No description provided.