2
votes

I want to paint controls directly into TextEdit. It is easy, but the problem is i need to have space for them, so they are not painted over the text.

For example (the whole line is representing what will be shown in TextEdit and the highlighted code should be qml component):

Here is button: button and here is text again.

I need somehow to reserve space for the button between Here is button: and and here is text again.

It looks like Qt qml doesn't provide any way how to specify font metrics (in that case i could ask the component what it's width is and just add one whitespace char with properly setup font and its metrics and than specify component coordinates so it is painted exactly where the space is).

I did it in Java SWT, because SWT StyledText allows to setup metrics for each character. So this is example how it should look.

enter image description here

1

1 Answers

0
votes

You can use HTML markup in TextEdit

TextEdit {
    textFormat: TextEdit.RichText
    text: "<font size=50>text</font>"
}