Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
sorting.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#include "sorting.h"
5
7
8using namespace Qt::Literals::StringLiterals;
9
10/*!
11 \namespace Sorting
12 \internal
13 \brief Pure text-to-enum helpers for sort directives used by
14 \\generatelist and \\annotatedlist atoms.
15
16 These helpers live in QDocLib so that the QDocLib-pure content
17 builder can parse sort directives without pulling in the driver-layer
18 Generator header. The legacy Generator::sortOrder member delegates
19 here, preserving legacy behavior at all call sites.
20*/
21
22/*!
23 \internal
24 Parses a QDoc sort directive into a Qt::SortOrder.
25
26 Returns \c Qt::DescendingOrder when \a directive is \c "descending"
27 (exact match, case-sensitive). Any other value, including the empty
28 string, returns \c Qt::AscendingOrder. This matches the legacy
29 behavior of Generator::sortOrder, which accepts the atom's raw
30 second-string argument even when it is the command's primary
31 argument rather than a bracketed sort directive.
32*/
33Qt::SortOrder Sorting::parseSortOrder(const QString &directive)
34{
35 return (directive == "descending"_L1) ? Qt::DescendingOrder : Qt::AscendingOrder;
36}
37
38QT_END_NAMESPACE
Combined button and popup list for selecting options.
Pure text-to-enum helpers for sort directives used by \generatelist and \annotatedlist atoms.
Definition sorting.h:12
Qt::SortOrder parseSortOrder(const QString &directive)
Definition sorting.cpp:33