From 070177c232aa1308111edf9ccfd5e869170ae1e6 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 23 Jan 2026 14:04:46 +0000 Subject: [PATCH] Use natural sort to sort children in annotations --- qrenderdoc/Widgets/AnnotationDisplay.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qrenderdoc/Widgets/AnnotationDisplay.cpp b/qrenderdoc/Widgets/AnnotationDisplay.cpp index 4c95f9216..32124b83f 100644 --- a/qrenderdoc/Widgets/AnnotationDisplay.cpp +++ b/qrenderdoc/Widgets/AnnotationDisplay.cpp @@ -24,6 +24,7 @@ #include "AnnotationDisplay.h" #include +#include #include #include #include @@ -132,7 +133,21 @@ bool AnnotationDisplay::shouldBeDisplayed(const SDObject &obj) void AnnotationDisplay::addStructuredChildren(RDTreeWidgetItem *parent, const SDObject &parentObj) { + QCollator collator; + collator.setNumericMode(true); + collator.setCaseSensitivity(Qt::CaseInsensitive); + + rdcarray children; + children.reserve(parentObj.NumChildren()); for(const SDObject *obj : parentObj) + children.push_back(obj); + + if(parentObj.type.basetype != SDBasic::Array) + std::sort(children.begin(), children.end(), [&collator](const SDObject *a, const SDObject *b) { + return collator.compare(QString(a->name), QString(b->name)) < 0; + }); + + for(const SDObject *obj : children) { if(!shouldBeDisplayed(*obj)) continue;