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

Auto sort by song number #13

Merged
merged 2 commits into from
Oct 14, 2017
Merged

Auto sort by song number #13

merged 2 commits into from
Oct 14, 2017

Conversation

ge022
Copy link
Contributor

@ge022 ge022 commented Oct 11, 2017

Songs will sort by song number at initial load, with songbook change, and during searches (if the table view is not sorted by number already.)

songwidget.cpp Outdated
@@ -288,6 +293,9 @@ void SongWidget::on_lineEditSearch_textEdited(QString text)
// If no full-text search is in progress, then filter
if(!ui->pushButtonClearResults->isVisible())
{
// Sort by song number
ui->songs_view->sortByColumn(1,Qt::AscendingOrder);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would do the following:

// If search test is numeric, sort by the number, esle sort by title
bool ok;
text.toInt(&ok);
if(ok)
{
ui->songs_view->sortByColumn(1,Qt::AscendingOrder);
}
else
{
ui->songs_view->sortByColumn(2,Qt::AscendingOrder);
}

This way if the search test is a number, sorting will be done by number, otherwise sorting will be done by title

@vladozar
Copy link
Contributor

Thanks for your input. Approved and I will merge it.

@vladozar vladozar merged commit 6b9ec77 into SoftProjector:master Oct 14, 2017
@ge022 ge022 deleted the auto-sort-songs-by-number branch October 17, 2017 23:21
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.

2 participants