From 9d36032370f7b81279ff8774afd7dea4ea57ee6a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 14 Jul 2020 12:26:16 +0200 Subject: Implement QMetaType::canConvert() and use it in QVariant Use the fact that we return the conversion function as a lambda to find out reliably whether a conversion between two types can be done. This requires some minor adjustments to our tests: * Nothing can convert to an unknown type and vice versa * Adjust results to the fact that we don't convert from char to QString anymore (where the old method was incorrect) * QStringList->QString requires some adjustments, as we only convert if the string list has exactly one element. For now we return true in canConvert(), but the conversion behavior in this case is something we should rethink, as it is very surprising. Change-Id: I3f5f87ee9cb99d690f5a7d13b13d6a6313d8038e Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/kernel/qvariant/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/corelib/kernel/qvariant/CMakeLists.txt') diff --git a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt index f1baaefe43..8b122a48e2 100644 --- a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt @@ -13,6 +13,7 @@ qt_add_test(tst_qvariant ../../../other/qvariant_common PUBLIC_LIBRARIES Qt::CorePrivate + Qt::Gui ) # Resources: -- cgit v1.2.3