TableView not showing all text on each row
-
So I have a TableView which should display text from a QList. It works great, except one little problem.
The height of each row wont change to get all the text inside of it.If there is a line like this:
"This is a test <br/> Why wont this work?"Only "This is a test" is displayed in the row! But if i click on the row and displays the text in the row in a seperate textarea, then I get all of the text. So I know that all of the text is stored in the row, but it wont display everything.
Anyone have any idea?So my tableView is based on this ItemDelegate:
@
Component {
id: tableItemDelegate
Text {
color: {
if(masterResource.filteredList[styleData.row] !== undefined){
if(masterResource.filteredList[styleData.row].greenText){
color: "green";
}
else if(masterResource.filteredList[styleData.row].yellowText){
color: "yellow";
}
else if(masterResource.filteredList[styleData.row].redText){
color: "red";
}else{ color: "black"; } } else{ color: "black"; } } elide:styleData.elideMode text:styleData.value font.bold: styleData.selected } }
@
Also, could someone explain what elide is? I think it has something to do with that. Searched a bit, but still not certain what exactly elide is?
-
Alternatively help me to get my tableView to show plain text instead of rich text
-
You can use "wrapMode":http://qt-project.org/doc/qt-5/qml-qtquick-text.html#wrapMode-prop property of Text element.
With Elide mode set the long text(that doesnot fit in the ContentArea) is actually truncated and three dots are added to the text depending upon the "elide":http://qt-project.org/doc/qt-5/qml-qtquick-text.html#elide-prop mode set.
So for e.g
If the text is "This is a Very Very Looooooooooooooooong Text",
then,
Text.ElideLeft shows something like
...oooong Text
Text.ElideMiddle shows,
This is a...oong Text.
Text.ElideRight shows,
This is a Very Ver...Notice the positions of the included 3 Dots.
Try it you will understand. -
Okay thanks! I cant get wrapMode to work. It really didnt expand the height of the row in concern so that all of the text in the row is displayed.
Do you have a code example based on the code I showed you from my itemDelegate?