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. QT 5.5 and QTableView column size adjustment..
Qt 6.11 is out! See what's new in the release blog

QT 5.5 and QTableView column size adjustment..

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 2 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.
  • D Offline
    D Offline
    dcbasso
    wrote on last edited by
    #1

    Hello All!
    How can I make the columns of a table make be "auto ajust" with content... I have try this and doesn't works:

    ui->tableLooger->resizeRowsToContents();
    ui->tableLooger->resizeColumnsToContents();

    I have done some code on older versions and this works for me, but now in 5.5 appers to be different. I found some tips that say's to use that: "ui->tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);" but the "setResizeMode" in the new API doesn't exists.

    Thanks for the help!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The new API is setSectionResizeMode

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcbasso
        wrote on last edited by
        #3

        Thank you very much!!!!

        ui->tableLooger->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        Now this uses all space from QTableView.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Also, consider up-voting answer(s) that helped you so the other users may find them more easily.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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