mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-09 17:12:31 -06:00
Add literal operator to efficiently construct QString in Qt5
PR #16448.
This commit is contained in:
@@ -48,3 +48,11 @@ constexpr typename std::add_const_t<T> asConst(T &&t) noexcept { return std::mov
|
||||
// Prevent const rvalue arguments
|
||||
template <typename T>
|
||||
void asConst(const T &&) = delete;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
// https://doc.qt.io/qt-6/qstring.html#operator-22-22_qs
|
||||
inline QString operator"" _qs(const char16_t *str, const std::size_t size)
|
||||
{
|
||||
return QString::fromRawData(reinterpret_cast<const QChar *>(str), size);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user