Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Size of custom qml types
Forum Updated to NodeBB v4.3 + New Features

Size of custom qml types

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 781 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    billy_blaze42
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved