From e06ce1189c9986d100a08370002831dd4e3a065d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Fri, 13 Sep 2024 17:40:04 +0200 Subject: [PATCH] [PartDesign]: Sort sketches in Attach sketch tool alphabetically The order of sketches in sketch attaching tool is now determined by the order in which they were added to document. Sorting them alphabetically makes IMHO much easier to find a sketch by user, compared to current state, especially in large and complex projects with lot of sketches. Of cuser thix expects the user use sensible names for the sketches. --- src/Mod/Sketcher/Gui/Command.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index c1cea15ffc..bea923be7d 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -605,6 +605,9 @@ void CmdSketcherMapSketch::activated(int iMsg) return; } + std::sort(sketches.begin(), sketches.end(), [](const auto &a, const auto &b) { + return QString::fromUtf8(a->Label.getValue()) < QString::fromUtf8(b->Label.getValue()); + }); bool ok; QStringList items;