IconWidget and Svg's in QML

Marco Martin notmart at gmail.com
Mon May 9 15:37:20 CEST 2011


On Monday 09 May 2011, Onur-Hayri Bakici wrote:
> Hey guys,
> 
> I came across a certain problem when arranging a SvgItem in a row.
> If I have code like
> 
> Row {
>     anchors.fill: parent
>     PlasmaWidgets.IconWidget {
>         id: iconWidget
>         text: "Click me"
>     }
>     // i *must* combine these
>     Item {
>         id: closeItem
>         PlasmaCore.Svg {
>             id: iconSvg
>             imagePath: "widgets/configuration-icons"
>         }
>         PlasmaCore.SvgItem {
>             id: closeWidget
>             height: 32
>             width: 32
>             svg: iconSvg
>             elementId: "close"
>         }
>     }
> }
> 
> If you test this code you will see that the svgItem overlaps with the
> iconWidget. Which shouldn't be.
> Is there any way I can load a svg in IconWidget (like in C++) in qml? And
> also is there any way i can fix the code above?

just drag the PlasmaCore.Svg out of the row and will work.
(nice thing if more svgitem will be neded from the same svg file they can pull 
out of that single Svg instance)

also, i would really rather not use PlasmaWidgets.IconWidget.
now we -almost- have some replacements (each one doing only a sub-thing, like 
only icon or only pixmap or only svg but that's nice)


-- 
Marco Martin


More information about the Plasma-devel mailing list