Qt World Summit: Register Today!

Problem using SVGs in a BorderImage on the N950

  • Hi,

    I've been using SVGs in my BorderImages on Symbian like this:

    BorderImage {
    source: "border.svg"
    sourceSize: Qt.size(10, 10)
    width: 100
    height: sourceSize.height
    border {
    top: 1.5
    right: 1.5
    bottom: 1.5
    left: 1

    This rasterizes the SVG in the size I want and then uses the borders to stretch the image the way I want. Works perfectly.

    Now when taking my project over to Harmattan Meego. Which is using QtQuick 1.1 if I'm not mistaken the log tells me that:
    Invalid property assignment: "sourceSize" is a read-only property

    Why has this changed? Is there some other way I'm supposed to use my SVGs with BorderImage that I'm not aware of?

  • Very strange as sourceSize is not a read-only property according to the documentation


  • Actually the documentation for Harmattan states this for the BorderImage element:

    sourceSize : QSize

    This property holds the actual width and height of the loaded image.

    In BorderImage, this property is read-only.

    See also Image::sourceSize.

    But my question is why has this changed from previous versions of QtQuick?

    It's not backwards compatible either (I cannot just write import QtQuick 1.0 and everything works as before).

  • [quote author="h3nk3" date="1311760656"]Actually the documentation for Harmattan states this for the BorderImage element:
    sourceSize : QSize

    What is interesting is that for all read-only properties.. the documentation standard is something like this

    sourceSize : QSize read-only

    Its confusing to see that its not followed though-out.

  • You could possibly look into using a "QDeclarativeImageProvider":http://doc.qt.nokia.com/4.7/qdeclarativeimageprovider.html to rasterize your SVGs to a given size that could then be scaled.

  • Yes that's actually what I've been doing today.

    But still wondering why this limitation was introduced though.

  • I'm wondering (pure speculation) if it wasn't so much of a recent introduction that it's read-only but rather it might have been designed to be read-only from the beginning, but was mistakenly allowed to be modified on Symbian.

    I don't have the code or docs for both side-by-side at the moment, though. So, like I said, it's just a thought right now.

  • Yeah, maybe that's true. Thanks for the replies!

Log in to reply