mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-21 12:29:04 -06:00
Sort additional scripts by row-order, not selection-order (closes #2862)
This commit is contained in:
@@ -167,7 +167,18 @@ void ScriptlogDialog::updateScriptList() {
|
||||
void ScriptlogDialog::saveChosenScripts() {
|
||||
std::vector<std::string> chosenScripts;
|
||||
QList<QListWidgetItem*> itemList = _scriptlogList->selectedItems();
|
||||
for (QListWidgetItem* item : _scriptlogList->selectedItems()) {
|
||||
|
||||
// The selected items are returned in order of **selection** not in row-order, so we
|
||||
// need to sort them first
|
||||
std::sort(
|
||||
itemList.begin(),
|
||||
itemList.end(),
|
||||
[this](QListWidgetItem* lhs, QListWidgetItem* rhs) {
|
||||
return _scriptlogList->row(lhs) < _scriptlogList->row(rhs);
|
||||
}
|
||||
);
|
||||
|
||||
for (QListWidgetItem* item : itemList) {
|
||||
chosenScripts.push_back(item->text().toStdString());
|
||||
}
|
||||
emit scriptsSelected(chosenScripts);
|
||||
|
||||
Reference in New Issue
Block a user