Closed nirvn closed 1 week ago
Download Windows builds of this PR for testing. Debug symbols for this build are available here. (Built from commit f6302256d441546be90b6643d8100545d1ab1d35)
Nice addition. Indeed it was indeed missing ;-)
According to QVariant::toBool(), it takes care of false
. Maybe it would nice for users to have the example of to_bool('false')
?
Question, would it be acceptable to move this logic into QgsStringUtils
? (or similar class) So it's available in Python. I see some plugins having a to_bool
function as well.
@Gustry , ATM, I'm matching the behavior to that of the mapboxgl spec. Although it does not explicitly say 'false' is true, it says a non-empty string is true, which 'false' would be.
We also don't follow the QVariant::toBool for '0' (which returns false, but we want to return true here).
Description
Title says it all. The PR adds a useful function to convert various value types into a boolean.
Required for a follow up PR to add support for mapbox gl's to-boolean expression when importing vector tile styles (https://docs.mapbox.com/style-spec/reference/expressions/#types-to-boolean)