diff options
| -rw-r--r-- | cmake/QtFeature.cmake | 24 | ||||
| -rw-r--r-- | cmake/QtHeadersClean.cmake | 2 | ||||
| -rw-r--r-- | cmake/QtPlatformSupport.cmake | 187 | ||||
| -rw-r--r-- | cmake/QtProcessConfigureArgs.cmake | 1 | ||||
| -rw-r--r-- | cmake/QtPublicCMakeHelpers.cmake | 8 | ||||
| -rw-r--r-- | src/corelib/itemmodels/qrangemodel_impl.h | 16 | ||||
| -rw-r--r-- | src/gui/configure.cmake | 7 | ||||
| -rw-r--r-- | src/gui/text/qrawfont.cpp | 9 | ||||
| -rw-r--r-- | src/gui/text/qrawfont.h | 13 |
9 files changed, 200 insertions, 67 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index d8f031f5b27..6b218a8925a 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -595,7 +595,11 @@ function(_qt_feature_evaluate_alias out_var alias) set(not_kw "NOT") endif() # Evaluate the value and return it - qt_set01(${out_var} ${not_kw} FEATURE_${alias}) + if(${not_kw} FEATURE_${alias}) + set(${out_var} 1) + else() + set(${out_var} 0) + endif() set(${out_var} "${${out_var}}" PARENT_SCOPE) # Also set `not_kw` since it would be reused by the caller set(not_kw "${not_kw}" PARENT_SCOPE) @@ -607,7 +611,11 @@ function(_qt_feature_check_feature_alias feature) if(DEFINED "FEATURE_${feature}") # The main feature was already defined, use the current value. # Just check if the other aliases have agreeing values. - qt_set01(expected_value FEATURE_${feature}) + if(FEATURE_${feature}) + set(expected_value 1) + else() + set(expected_value 0) + endif() unset(alias_value) foreach(alias IN LISTS _QT_FEATURE_ALIASES_${feature}) _qt_feature_evaluate_alias(alias_value ${alias}) @@ -676,7 +684,11 @@ function(_qt_feature_check_cache_alias feature) # Check if the feature is set by another alias unset(expected_value) _qt_feature_evaluate_alias(expected_value "${feature}") - qt_set01(cache_sanitized ${arg_ALIAS_OF_CACHE}) + if(${arg_ALIAS_OF_CACHE}) + set(cache_sanitized 1) + else() + set(cache_sanitized 0) + endif() if(NOT DEFINED expected_value) # If nothing else set the alias value, use the primary cache value set("FEATURE_${feature}" "${${arg_ALIAS_OF_CACHE}}" PARENT_SCOPE) @@ -707,7 +719,11 @@ function(_qt_feature_save_alias feature) if(arg_ALIAS_NEGATE) set(not_kw "NOT") endif() - qt_set01(value ${not_kw} FEATURE_${feature}) + if(${not_kw} FEATURE_${feature}) + set(value 1) + else() + set(value 0) + endif() qt_evaluate_to_boolean(value) # Set the values based on the main feature's value set(FEATURE_${alias} ${value} CACHE BOOL diff --git a/cmake/QtHeadersClean.cmake b/cmake/QtHeadersClean.cmake index f548a2321db..3e59d68629c 100644 --- a/cmake/QtHeadersClean.cmake +++ b/cmake/QtHeadersClean.cmake @@ -4,6 +4,8 @@ # Add a custom ${module_target}_headersclean_check target that builds each header in # ${module_headers} with a custom set of defines. This makes sure our public headers # are self-contained, and also compile with more strict compiler options. +# To enable the `headersclean` checks, pass `-headersclean` to `configure` +# or `qt-configure-module`. function(qt_internal_add_headersclean_target module_target module_headers) if(INPUT_headersclean AND WASM) message(FATAL_ERROR "The headersclean targets are not supported on WASM platform.") diff --git a/cmake/QtPlatformSupport.cmake b/cmake/QtPlatformSupport.cmake index 9f8498e42c8..071711a5bd5 100644 --- a/cmake/QtPlatformSupport.cmake +++ b/cmake/QtPlatformSupport.cmake @@ -1,46 +1,161 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -function(qt_set01 result) - if (${ARGN}) - set("${result}" 1 PARENT_SCOPE) - else() - set("${result}" 0 PARENT_SCOPE) - endif() -endfunction() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(LINUX 1) +else() + set(LINUX 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "HPUX") + set(HPUX 1) +else() + set(HPUX 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "Android") + set(ANDROID 1) +else() + set(ANDROID 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "Integrity") + set(INTEGRITY 1) +else() + set(INTEGRITY 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks") + set(VXWORKS 1) +else() + set(VXWORKS 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "QNX") + set(QNX 1) +else() + set(QNX 0) +endif() -qt_set01(LINUX CMAKE_SYSTEM_NAME STREQUAL "Linux") -qt_set01(HPUX CMAKE_SYSTEM_NAME STREQUAL "HPUX") -qt_set01(ANDROID CMAKE_SYSTEM_NAME STREQUAL "Android") # FIXME: How to identify this? -qt_set01(INTEGRITY CMAKE_SYSTEM_NAME STREQUAL "Integrity") # FIXME: How to identify this? -qt_set01(VXWORKS CMAKE_SYSTEM_NAME STREQUAL "VxWorks") # FIXME: How to identify this? -qt_set01(QNX CMAKE_SYSTEM_NAME STREQUAL "QNX") # FIXME: How to identify this? -qt_set01(OPENBSD CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") # FIXME: How to identify this? -qt_set01(FREEBSD CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # FIXME: How to identify this? -qt_set01(NETBSD CMAKE_SYSTEM_NAME STREQUAL "NetBSD") # FIXME: How to identify this? -qt_set01(WASM CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR EMSCRIPTEN) -qt_set01(WASM64 QT_QMAKE_TARGET_MKSPEC STREQUAL "wasm-emscripten-64") -qt_set01(SOLARIS CMAKE_SYSTEM_NAME STREQUAL "SunOS") -qt_set01(HURD CMAKE_SYSTEM_NAME STREQUAL "GNU") +if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + set(OPENBSD 1) +else() + set(OPENBSD 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(FREEBSD 1) +else() + set(FREEBSD 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") + set(NETBSD 1) +else() + set(NETBSD 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR EMSCRIPTEN) + set(WASM 1) +else() + set(WASM 0) +endif() + +if(QT_QMAKE_TARGET_MKSPEC STREQUAL "wasm-emscripten-64") + set(WASM64 1) +else() + set(WASM64 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set(SOLARIS 1) +else() + set(SOLARIS 0) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "GNU") + set(HURD 1) +else() + set(HURD 0) +endif() # This is the only reliable way we can determine the webOS platform as the yocto recipe adds this # compile definition into its generated toolchain.cmake file -qt_set01(WEBOS CMAKE_CXX_FLAGS MATCHES "-D__WEBOS__") - -qt_set01(BSD APPLE OR OPENBSD OR FREEBSD OR NETBSD) - -qt_set01(IOS APPLE AND CMAKE_SYSTEM_NAME STREQUAL "iOS") -qt_set01(TVOS APPLE AND CMAKE_SYSTEM_NAME STREQUAL "tvOS") -qt_set01(WATCHOS APPLE AND CMAKE_SYSTEM_NAME STREQUAL "watchOS") -qt_set01(VISIONOS APPLE AND CMAKE_SYSTEM_NAME STREQUAL "visionOS") -qt_set01(UIKIT APPLE AND (IOS OR TVOS OR WATCHOS OR VISIONOS)) -qt_set01(MACOS APPLE AND NOT UIKIT) - -qt_set01(GCC CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -qt_set01(CLANG CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM") -qt_set01(APPLECLANG CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") -qt_set01(IntelLLVM CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") -qt_set01(QCC CMAKE_CXX_COMPILER_ID STREQUAL "QCC") # CMP0047 +if(CMAKE_CXX_FLAGS MATCHES "-D__WEBOS__") + set(WEBOS 1) +else() + set(WEBOS 0) +endif() + +if(APPLE OR OPENBSD OR FREEBSD OR NETBSD) + set(BSD 1) +else() + set(BSD 0) +endif() + +if(APPLE) + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(IOS 1) + else() + set(IOS 0) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "tvOS") + set(TVOS 1) + else() + set(TVOS 0) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "watchOS") + set(WATCHOS 1) + else() + set(WATCHOS 0) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(VISIONOS 1) + else() + set(VISIONOS 0) + endif() + + if(IOS OR TVOS OR WATCHOS OR VISIONOS) + set(UIKIT 1) + set(MACOS 0) + else() + set(UIKIT 0) + set(MACOS 1) + endif() +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(GCC 1) +else() + set(GCC 0) +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM") + set(CLANG 1) +else() + set(CLANG 0) +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") + set(APPLECLANG 1) +else() + set(APPLECLANG 0) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(IntelLLVM 1) +else() + set(IntelLLVM 0) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "QCC") + set(QCC 1) +else() + set(QCC 0) +endif() if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(QT_64BIT TRUE) diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 833daceba27..27d00ab63c7 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -491,7 +491,6 @@ defstub(qt_feature_config) defstub(qt_feature_definition) defstub(set_package_properties) defstub(qt_qml_find_python) -defstub(qt_set01) defstub(qt_internal_check_if_linker_is_available) defstub(qt_internal_add_sbom) defstub(qt_internal_extend_sbom) diff --git a/cmake/QtPublicCMakeHelpers.cmake b/cmake/QtPublicCMakeHelpers.cmake index f35ef3c070e..599820deab6 100644 --- a/cmake/QtPublicCMakeHelpers.cmake +++ b/cmake/QtPublicCMakeHelpers.cmake @@ -901,14 +901,6 @@ function(_qt_internal_path_is_prefix path_var input out_var) set(${out_var} "${${out_var}}" PARENT_SCOPE) endfunction() -function(qt_set01 result) - if (${ARGN}) - set("${result}" 1 PARENT_SCOPE) - else() - set("${result}" 0 PARENT_SCOPE) - endif() -endfunction() - # Configures the file using either the input template or the CONTENT. # Behaves as either file(CONFIGURE or configure_file( command, but do not depend # on CMake version. diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h index 55c7930cc36..96dacda0260 100644 --- a/src/corelib/itemmodels/qrangemodel_impl.h +++ b/src/corelib/itemmodels/qrangemodel_impl.h @@ -238,14 +238,16 @@ namespace QRangeModelDetails : std::true_type {}; - // we use std::rotate in moveRows/Columns, which requires std::swap + // we use std::rotate in moveRows/Columns, which requires std::swap and the + // iterators to be at least a forward iterator template <typename It, typename = void> struct test_rotate : std::false_type {}; template <typename It> struct test_rotate<It, std::void_t<decltype(std::swap(*std::declval<It>(), *std::declval<It>()))>> - : std::true_type + : std::is_base_of<std::forward_iterator_tag, + typename std::iterator_traits<It>::iterator_category> {}; template <typename C, typename = void> @@ -512,8 +514,12 @@ namespace QRangeModelDetails using row_type = typename range_traits<QRangeModelDetails::wrapped_t<Range>>::value_type; template <typename R = row_type, - std::enable_if_t<std::conjunction_v<std::is_destructible<wrapped_t<R>>, - is_owning_or_raw_pointer<R>>, bool> = true> + std::enable_if_t< + std::conjunction_v< + std::is_destructible<QRangeModelDetails::wrapped_t<R>>, + is_owning_or_raw_pointer<R> + >, + bool> = true> auto newRow() -> decltype(R(new QRangeModelDetails::wrapped_t<R>)) { if constexpr (is_any_of<R, std::shared_ptr>()) return std::make_shared<QRangeModelDetails::wrapped_t<R>>(); @@ -587,7 +593,7 @@ namespace QRangeModelDetails template <typename P, typename R> using protocol_mutable_childRows_test = decltype(refTo(std::declval<P&>() - .childRows(std::declval<wrapped_t<R>&>())) = {}); + .childRows(std::declval<QRangeModelDetails::wrapped_t<R>&>())) = {}); template <typename P, typename R> using protocol_mutable_childRows = qxp::is_detected<protocol_mutable_childRows_test, P, R>; diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index b14f7e74ad2..e34f4d8b30a 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -28,8 +28,11 @@ set_property(CACHE INPUT_libpng PROPERTY STRINGS undefined no qt system) #### Libraries -qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS OR - HURD) +if(LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS OR HURD) + set(X11_SUPPORTED 1) +else() + set(X11_SUPPORTED 0) +endif() qt_feature_vcpkg_scope(gui) qt_find_package(ATSPI2 MODULE PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_LIB atspi) qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 9eb3b62443c..7acc3c5218c 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -554,7 +554,6 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g } /*! - \fn QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes, LayoutFlags layoutFlags) const \since 5.1 Returns the QRawFont's advances for each of the \a glyphIndexes in pixel units. The advances @@ -570,6 +569,14 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g \sa QTextLine::horizontalAdvance(), QFontMetricsF::horizontalAdvance(), QTextLayout::glyphRuns() */ +QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const +{ + QList<QPointF> advances(glyphIndexes.size()); + if (advancesForGlyphIndexes(glyphIndexes.constData(), advances.data(), int(glyphIndexes.size()), layoutFlags)) + return advances; + return QList<QPointF>(); +} + /*! \fn QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index d0bed84a68a..f13f04ebe37 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -65,8 +65,8 @@ public: QList<quint32> glyphIndexesForString(const QString &text) const; inline QList<QPointF> advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const; - inline QList<QPointF> advancesForGlyphIndexes(const QList<quint32> &glyphIndexes, - LayoutFlags layoutFlags) const; + QList<QPointF> advancesForGlyphIndexes(const QList<quint32> &glyphIndexes, + LayoutFlags layoutFlags) const; bool glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const; bool advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const; bool advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs, LayoutFlags layoutFlags) const; @@ -128,14 +128,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags) Q_GUI_EXPORT size_t qHash(const QRawFont &font, size_t seed = 0) noexcept; -inline QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes, - QRawFont::LayoutFlags layoutFlags) const -{ - QList<QPointF> advances(glyphIndexes.size()); - if (advancesForGlyphIndexes(glyphIndexes.constData(), advances.data(), int(glyphIndexes.size()), layoutFlags)) - return advances; - return QList<QPointF>(); -} + inline QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const { |
