4

I have a Text element with some HTML content which contains an <img> tag. I want to adjust the baseline of this image since it displays a rasterized latex math formula. Detecting the baseline within the image is another task. This question is how to adjust the vertical position of the image when I know how many pixels I have to move the image.

In HTML, I can use relative positioning. Since Qt only supports a subset of CSS, I have to use different CSS properties. However, none of them seem to be working when displaying HTML using a QML Text element! What's wrong?

Text {
    text: 'test <img style="padding: 100px" src="latex/182.png"/>'
}

This displays exactly the same compared to leaving out the style attribute. It's like QML ignores style attributes. Does QML use another (even tinier) HTML engine?

I already found out that images are only supported in the "rich text" mode (there also is the "styled text" mode which doesn't support images but other HTML tags like <b> and <i>).

4

1 回答 1

1

我已经通过使用 HTML 解决了类似<table>的问题。它们在 Qt 中得到更好的支持。

于 2012-11-28T14:08:13.353 回答