Commit e61c8238 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Sort target names in combobox

 * In the addtargetdialog: Sort targets based on their display
   name when putting them into the combobox.
parent b1e2a207
......@@ -44,8 +44,14 @@ AddTargetDialog::AddTargetDialog(Project *project, QWidget *parent) :
ui->setupUi(this);
foreach (const QString &id, m_project->possibleTargetIds()) {
ui->targetComboBox->addItem(m_project->targetFactory()->displayNameForId(id),
id);
for (int i = 0; i <= ui->targetComboBox->count(); ++i) {
const QString displayName = m_project->targetFactory()->displayNameForId(id);
if (i == ui->targetComboBox->count() ||
ui->targetComboBox->itemText(i) > displayName) {
ui->targetComboBox->insertItem(i, displayName, id);
break;
}
}
}
ui->targetComboBox->setCurrentIndex(0);
ui->targetComboBox->setEnabled(ui->targetComboBox->count() > 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment