Size of custom qml types



  • Hi all,

    I'm trying to extend qml by a custom type defined in C++. My type - called SvgItem - is supposed to be able to render a single element of a svg file (by elementId, like QGraphicsSvgItem).
    I got it working in-so-far, that the elements are painted in qml. Unfortunately, qml seems to be unable to access size information of my custom type. Therefore, I cannot put my SvgItem in a grid properly or make out its center.

    I implemented SvgItem by inheriting QDeclarativeItem and delegating to a QGraphicsSvgItem in painting functions. The QGraphicsSvgItem is held as a member in SvgItem.
    I declared the Q_PROPERTYs source and elementId in order to access the svg file and its elements, which apperently works.
    However, my SvgItem has no size in qml.

    I found a similar implementation in the KDE project: "SvgItem.h":http://lxr.kde.org/source//kde/kde-runtime/plasma/declarativeimports/core/svgitem.h
    It makes use of the properties implicitWidth and implicitHeight. I implemented them in my SvgItem, but it was no help.

    What is the correct way to go, in order to impart the size information to qml?

    Thanks a lot!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.