Skip to content

Commit d5bf035

Browse files
authored
Revise conditional for when to use QCollator
According to https://doc.qt.io/qt-6/qcollator.html#posix-fallback-implementation The 'POSIX fallback implementation' is only used when ICU is not available. So the correct way is to detect ICU directly and not depend on the OS. The exceptions are macOS and Windows since they support the required functionalities natively. Closes #20205. PR #20207.
1 parent fc56fda commit d5bf035

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/base/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,16 @@ add_library(qbt_base STATIC
199199

200200
target_link_libraries(qbt_base
201201
PRIVATE
202-
OpenSSL::Crypto OpenSSL::SSL
202+
OpenSSL::Crypto
203+
OpenSSL::SSL
203204
ZLIB::ZLIB
204205
PUBLIC
205206
LibtorrentRasterbar::torrent-rasterbar
206-
Qt::Core Qt::Network Qt::Sql Qt::Xml
207+
Qt::Core
208+
Qt::CorePrivate
209+
Qt::Network
210+
Qt::Sql
211+
Qt::Xml
207212
qbt_common_cfg
208213
)
209214

src/base/utils/compare.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@
3131
#include <Qt>
3232
#include <QtSystemDetection>
3333

34-
#if !defined(Q_OS_WIN) && (!defined(Q_OS_UNIX) || defined(Q_OS_MACOS) || defined(QT_FEATURE_icu))
34+
// for QT_FEATURE_xxx, see: https://wiki.qt.io/Qt5_Build_System#How_to
35+
#include <QtCore/private/qtcore-config_p.h>
36+
37+
// macOS and Windows support 'case sensitivity' and 'numeric mode' natively
38+
// https://github.com/qt/qtbase/blob/6.0/src/corelib/CMakeLists.txt#L777-L793
39+
// https://github.com/qt/qtbase/blob/6.0/src/corelib/text/qcollator_macx.cpp#L74-L77
40+
// https://github.com/qt/qtbase/blob/6.0/src/corelib/text/qcollator_win.cpp#L72-L78
41+
#if ((QT_FEATURE_icu == 1) || defined(Q_OS_MACOS) || defined(Q_OS_WIN))
3542
#define QBT_USE_QCOLLATOR
3643
#include <QCollator>
3744
#endif

0 commit comments

Comments
 (0)