diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 6423c2f8f4..d8c8d40ad3 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -156,6 +156,11 @@ inline static bool comp_hash_ui_display_name_key_lower(const QHash &lhs, const QHash &rhs) +{ + return lhs.value("name").toLower() < rhs.value("name").toLower(); +} + inline static bool comp_hash_label_key_lower(const QHash &lhs, const QHash &rhs) { return lhs.value("label").toLower() < rhs.value("label").toLower(); @@ -1979,13 +1984,14 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&) { QMapIterator coreListIterator(coreList); + QVector > cores; while (coreListIterator.hasNext()) { QString key; const core_info_t *core = NULL; - QAction *action = NULL; QString name; + QHash hash; coreListIterator.next(); @@ -2000,8 +2006,20 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&) if (name.isEmpty()) continue; - action = associateMenu->addAction(name); - action->setProperty("core_path", core->path); + hash["name"] = name; + hash["core_path"] = core->path; + + cores.append(hash); + } + + std::sort(cores.begin(), cores.end(), comp_hash_name_key_lower); + + for (j = 0; j < cores.count(); j++) + { + const QHash &hash = cores.at(j); + QAction *action = associateMenu->addAction(hash.value("name")); + + action->setProperty("core_path", hash.value("core_path")); } }