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. How can I set the row height and Column width of a QTableView?
Qt 6.11 is out! See what's new in the release blog

How can I set the row height and Column width of a QTableView?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 9.9k 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.
  • M Offline
    M Offline
    mythili
    wrote on last edited by
    #1

    I am having text and Image in one row and other rows are having only text. I want to set the height of row to the content of the row. So I am using ui->tableView->resizeColumnsToContents();
    ui->tableView->resizeRowsToContents();

    1)All other rows are resizing except the row which containing the image and test.
    2) How to break the text in the row if its long and then set the width of column.
    Please hrlp me in setting the height of rows in TableView.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      messi
      wrote on last edited by
      #2

      How about:
      http://qt-project.org/doc/qt-4.8/qtableview.html#setRowHeight
      http://qt-project.org/doc/qt-4.8/qtableview.html#setColumnWidth

      If you use QTableView than you have to handle that in your model which should be based on QAbstractTableModel

      If you will use QTableWidget than you can set the wrap property in QTableWidgetItem

      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