Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. TableView not showing all text on each row
Forum Updated to NodeBB v4.3 + New Features

TableView not showing all text on each row

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    skammers
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      skammers
      wrote on last edited by
      #2

      Alternatively help me to get my tableView to show plain text instead of rich text

      1 Reply Last reply
      0
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #3

        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.

        157

        1 Reply Last reply
        0
        • S Offline
          S Offline
          skammers
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved