Review Request 126720: Adds QML's PlasmaCore.SVG CustomColor feature

Marco Martin notmart at gmail.com
Mon Jan 11 22:58:05 UTC 2016



> On Jan. 11, 2016, 6:35 p.m., Marco Martin wrote:
> > src/plasma/svg.cpp, line 164
> > <https://git.reviewboard.kde.org/r/126720/diff/1/?file=430382#file430382line164>
> >
> >     coding style:
> >     void SvgPrivate::updateCustomStyleCrc()
> >     {
> 
> Nico Rodsevich wrote:
>     I don't totally get why QVariantMap is that bad:
>     The idea with this first patch is to have initially set the whole customColors palette with the bare minimun necessary code (and memory), up to the little I know, QVariantMap does this perfectly by don't consuming memmory when nothing is in it and only saving strings when it has **any number** of rules. Maybe there is some functionality Qt provides that in my research went out of my sight, but can't think it woould be much better than 0-N rules with just saving strings
>     
>     In addition, when reading QML code:
>     ```qml
>     PlasmaCore.SvgItem{
>         id: svgObject
>         svg: PlasmaCore.Svg{
>             customColorScheme: {
>                       "#rule1":"color",
>                       ".rule2":"color"
>             }
>         }
>     }
>     ```
>     seems pretty explanatory and when you gotta programatically change or add the colors you have the **svgObject.svg.customColorRule("#colorX","color")** function
>     From the perspective of a QML programmer this is bearable enough and simplifies a lot the programming of rich UI plasmoids with little imperceptible processing or memory consumption, doesn't it?
>     
>     *Please note that I'm totally new to this world and there are pretty much obvious things that I don't know right now, I'm only trying to understand*

if you have 
PlasmaCore.SvgItem{
    id: svgObject
    svg: PlasmaCore.Svg{
        customColorScheme: {
                  "#rule1":"color",
                  ".rule2":"color"
        }
    }
}

then is possible to have
Rectangle {
  color: svgObject.svg.customColorScheme[".rule2"]
}

and it will work, but property binding won't work, so changing the content of .rule2 won't update, this is usually considered a problem in a QML api (it will also produce a runtime warning)
If we go all this way, I would almost go all the way and have a simple string in an "additionalStyleSheet" property...


- Marco


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126720/#review90926
-----------------------------------------------------------


On Jan. 11, 2016, 9:37 p.m., Nico Rodsevich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126720/
> -----------------------------------------------------------
> 
> (Updated Jan. 11, 2016, 9:37 p.m.)
> 
> 
> Review request for Plasma, David Edmundson and Marco Martin.
> 
> 
> Repository: plasma-framework
> 
> 
> Description
> -------
> 
> Enables to set rules that extends the #current-color-scheme CSS style of the Svg in order to change the Svg's items with currentColor fill to the specified in the customColors rules
> 
> 
> Diffs
> -----
> 
>   src/plasma/private/svg_p.h 1d1000d 
>   src/plasma/svg.h 3a4ca1d 
>   src/plasma/svg.cpp 28abd00 
> 
> Diff: https://git.reviewboard.kde.org/r/126720/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Nico Rodsevich
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160111/e02c5ba2/attachment.html>


More information about the Plasma-devel mailing list