Is it possible to use Text.ElideMiddle for each row in a TextArea?
-
I would like to have a TextArea (scrollable) that contains multiple lines of text, each ending in a "\n". For each of those lines, I would like to use:
elide: Text.ElideMiddle
However, TextArea does not contain an elide property, and furthermore, I need it to apply to each newline terminated string individually.
I do not want to permanently modify the actual text stored. I only want to display it in middle elided format. The lines of text will be URL's and I need to be able to perform operations on the full URL's. Therefore, I don't want to manually shorten them before adding to the TextArea.
For example, I would like to display 3 urls in a TextArea like this
https://doc.qt.io/.../qml-qtquick-dragevents.html https://forum.qt.io/topic/68405/...text-into-from https://forum.qt.io/topic/102632/...es-elidemiddle
But when hovering or clicking on one of them, I want to show/navigate to the full and correct URL.
Is there an existing or easy solution? I can imagine how a more complex solution might be cooked up (such as even storing an original string and a modified elided string), but I am hoping there is a better way to accomplish this.
Thanks for any ideas.
-
I would like to have a TextArea (scrollable) that contains multiple lines of text, each ending in a "\n". For each of those lines, I would like to use:
elide: Text.ElideMiddle
However, TextArea does not contain an elide property, and furthermore, I need it to apply to each newline terminated string individually.
I do not want to permanently modify the actual text stored. I only want to display it in middle elided format. The lines of text will be URL's and I need to be able to perform operations on the full URL's. Therefore, I don't want to manually shorten them before adding to the TextArea.
For example, I would like to display 3 urls in a TextArea like this
https://doc.qt.io/.../qml-qtquick-dragevents.html https://forum.qt.io/topic/68405/...text-into-from https://forum.qt.io/topic/102632/...es-elidemiddle
But when hovering or clicking on one of them, I want to show/navigate to the full and correct URL.
Is there an existing or easy solution? I can imagine how a more complex solution might be cooked up (such as even storing an original string and a modified elided string), but I am hoping there is a better way to accomplish this.
Thanks for any ideas.
@april_heard
I would say, this looks like a job for a listview. You can define your own delegate and than elide it. That way only the display is changed, the underlying data is unchanged.