From 7842d03ef6da84d37524a1d9ee9d9d89ff8d0a9b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Oct 2024 14:23:20 +0200 Subject: [PATCH] [libcalamares] Add an "integer-like" predicate for variants --- src/libcalamares/compat/Variant.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcalamares/compat/Variant.h b/src/libcalamares/compat/Variant.h index f1038ee66..dab4e8586 100644 --- a/src/libcalamares/compat/Variant.h +++ b/src/libcalamares/compat/Variant.h @@ -45,6 +45,13 @@ const auto ULongLongVariantType = QMetaType::Type::ULongLong; const auto DoubleVariantType = QMetaType::Type::Double; #endif +inline bool +isIntegerVariantType( const QVariant& v ) +{ + const auto t = typeOf( v ); + return t == IntVariantType || t == UIntVariantType || t == LongLongVariantType || t == ULongLongVariantType; +} + } // namespace Calamares #endif