Skip to content

Commit

Permalink
Added logical search song sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
ge022 committed Oct 13, 2017
1 parent 61282d6 commit 330750d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion songwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,18 @@ 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

// If search test is numeric, sort by the number, else 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);
}

// These two options are mutually exclusive:
bool match_beginning = (ui->comboBoxFilterType->currentIndex() == 1);
Expand Down

0 comments on commit 330750d

Please sign in to comment.