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. QTableview wordwrap

QTableview wordwrap

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 3.5k Views
  • 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.
  • MihanM Offline
    MihanM Offline
    Mihan
    wrote on last edited by
    #1

    I want to make items wordwrap, but I also set the model by myself( override ). So what should I do?

    JonBJ 1 Reply Last reply
    0
    • MihanM Mihan

      I want to make items wordwrap, but I also set the model by myself( override ). So what should I do?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @mihan
      So what about https://doc.qt.io/qt-5/qtableview.html#wordWrap-prop, QTableView::setWordWrap(bool on)? Docs state "This property is true by default.", so it should already be enabled...?

      It also says "Note that even of wrapping is enabled, the cell will not be expanded to fit all text. Ellipsis will be inserted according to the current textElideMode." So you may want to fiddle with setTextElideMode(Qt::ElideNone) too. Further information about possible resizeRowsToContents() in https://stackoverflow.com/questions/9544122/how-to-word-wrap-text-in-the-rows-and-columns-of-a-qtablewidget.

      MihanM 1 Reply Last reply
      3
      • JonBJ JonB

        @mihan
        So what about https://doc.qt.io/qt-5/qtableview.html#wordWrap-prop, QTableView::setWordWrap(bool on)? Docs state "This property is true by default.", so it should already be enabled...?

        It also says "Note that even of wrapping is enabled, the cell will not be expanded to fit all text. Ellipsis will be inserted according to the current textElideMode." So you may want to fiddle with setTextElideMode(Qt::ElideNone) too. Further information about possible resizeRowsToContents() in https://stackoverflow.com/questions/9544122/how-to-word-wrap-text-in-the-rows-and-columns-of-a-qtablewidget.

        MihanM Offline
        MihanM Offline
        Mihan
        wrote on last edited by
        #3

        @jonb Thanks~
        https://stackoverflow.com/questions/9544122/how-to-word-wrap-text-in-the-rows-and-columns-of-a-qtablewidget. It has been well explained in this topic.

        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