-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parsing of HSL color with floats #58170
Comments
Qt itself only accepts int, https://doc.qt.io/qt-6/qcolor.html#getHsl But i find strange that the parsing need the % char. |
The values are casted to int before giving to Qt. QGIS/src/core/symbology/qgssymbollayerutils.cpp Lines 3944 to 3946 in 2f3bbc6
But the regex QGIS/src/core/symbology/qgssymbollayerutils.cpp Line 3940 in 2f3bbc6
"^\\s*hsl\\(?\\s*(\\d+)\\s*,\\s*(\\d+)\\s*%\\s*,\\s*(\\d+)\\s*%\\s*\\)?\\s*;?\\s*$"
|
Qt accepts float as well, https://doc.qt.io/qt-6/qcolor.html#setHslF |
If they are in the range 0 to 1.0, not bigger. |
Oh yes, you're right.
|
What is the bug or the crash?
HSL color definition consists of:
hue
- in degrees 0-360saturation
- in percentage 0-100lightness
- in percentage 0-100Unlike RGB where parameters are integers, for HSL valid color definition can be e.g.
hsl(74.5, 15.6%, 77.1%)
(float), however trying to parse this fails. On the other hand parsinghsl(74, 15%, 77%)
(only integers) goes without any problem. I'm usinggsSymbolLayerUtils.parseColor()
method.Steps to reproduce the issue
Open Python console (Ctrl+Alt+P)
Run this code:
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Active Python plugins
processing
2.12.99
grassprovider
2.12.99
MetaSearch
0.3.6
db_manager
0.1.20
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: