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 Column setSectionResizeMode and Font

QTableView Column setSectionResizeMode and Font

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 197 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.
  • Q Offline
    Q Offline
    Qt.Jo.Ha
    wrote on last edited by
    #1

    i have a table View, and column count 3

    setColumnWidth 0 -> 30
    setColumnWidth 1 -> 150
    setColumnWidth 2-> 150

    horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeMode::Stretch);

    Depending on the font, the width of the column may change, but what should be done to not change it?

    JonBJ 1 Reply Last reply
    0
    • Q Qt.Jo.Ha

      i have a table View, and column count 3

      setColumnWidth 0 -> 30
      setColumnWidth 1 -> 150
      setColumnWidth 2-> 150

      horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeMode::Stretch);

      Depending on the font, the width of the column may change, but what should be done to not change it?

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

      @Qt-Jo-Ha
      This should produce 3 columns: width 30, width 150, width whatever to stretch to fit.

      If you are saying some of the columns grow wider to fit their content, perhaps according to font, and you do not want that, then I think look at using horizontalHeader()->setSectionResizeMode(column, QHeaderView::Fixed); for each column?

      1 Reply Last reply
      2

      • Login

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