// Copyright (C) 2025 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only // Qt-Security score:significant reason:default #ifndef QRANGEMODELADAPTER_IMPL_H #define QRANGEMODELADAPTER_IMPL_H #ifndef Q_QDOC #ifndef QRANGEMODELADAPTER_H #error Do not include qrangemodeladapter_impl.h directly #endif #if 0 #pragma qt_sync_skip_header_check #pragma qt_sync_stop_processing #endif #include #include #include #include QT_BEGIN_NAMESPACE namespace QRangeModelDetails { template using RangeImplementation = std::conditional_t, std::conditional_t::value, QGenericTreeItemModelImpl>, QGenericTableItemModelImpl >, QGenericTreeItemModelImpl >; template using construct_rangeModel_test = decltype(QRangeModel(std::declval()...)); template static constexpr bool can_construct_rangeModel = qxp::is_detected_v; template using if_can_construct = std::enable_if_t, bool>; template decltype(auto) forwardOrConvert(Input&& input) { if constexpr (std::is_same_v, q20::remove_cvref>) return std::forward(input); else return Output(std::forward(input)); } // we can't use wrapped_t, we only want to unpack smart pointers, and maintain // the pointer nature of the type. template struct data_type { using type = T; }; template <> struct data_type { using type = QVariant; }; // pointer types of iterators use QtPrivate::ArrowProxy if the type does not // provide operator->() (or is a pointer). template struct test_pointerAccess : std::false_type {}; template struct test_pointerAccess : std::true_type {}; template struct test_pointerAccess().operator->())>> : std::true_type {}; template using data_pointer_t = std::conditional_t::value, T, QtPrivate::ArrowProxy>; // Helpers to make a type const "in depth", taking into account raw pointers // and wrapping types, like smart pointers and std::reference_wrapper. // We need to return data by value, not by reference, as we might only have // temporary values (i.e. a QVariant returned by QAIM::data). template struct AsConstData { using type = T; }; template struct AsConstData { using type = T; }; template struct AsConstData { using type = const T *; }; template