Cut off text using QML Text element in a Layout.
Solved
QML and Qt Quick
-
wrote on 2 Sept 2016, 19:51 last edited by
Re: How to cut off text using QML Text element
I understand "width" property must be set implicitly for edlide to work. However, we have a Text element in a Layout. We would like to truncate the text when gets too long. How can we use edlide in a Text type when is in a GridLayout?
import QtQuick 2.5 import QtQuick.Layouts 1.1 Rectangle { width: 100 height: 20 GridLayout { clip: true anchors.fill: parent rows: 1 Text{ text: "veryverylooooooonnnnnnnnnnnggggggggggggggtext" width: 50 elide: Text.ElideRight } } }
-
wrote on 7 Sept 2016, 22:01 last edited by
I was told to replace the "width" with "Layout.preferredWidth".
That worked.
1/2