Skip to content
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

Merged
merged 8 commits into from May 16, 2017

Conversation

qdbgw3ihnjw
Copy link
Contributor

No description provided.

@qdbgw3ihnjw
Copy link
Contributor Author

@qdbgw3ihnjw qdbgw3ihnjw force-pushed the improve-file-table-sort-model branch from e3ee038 to 6141421 Compare May 11, 2017 00:19
QVariant leftData = source_model_->data(left);
QVariant rightData = source_model_->data(right);

if (leftData.type() == QVariant::ULongLong) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该根据 ModelIndex 是哪一列来决定怎么排序, 而不是根据数据的类型来决定

如果是文件名那一列,就用 digitalCompare, 其它的就用默认的排序

(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;
Copy link
Contributor

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 这个不需要吧

@qdbgw3ihnjw qdbgw3ihnjw force-pushed the improve-file-table-sort-model branch from 60f772a to 15c9cc8 Compare May 15, 2017 10:34
@lins05 lins05 merged commit 98c0db5 into haiwen:master May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants