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. QTableWidget - QHeaderView::ResizeMode - Stretch the columns but still enable user resizing
QtWS25 Last Chance

QTableWidget - QHeaderView::ResizeMode - Stretch the columns but still enable user resizing

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

    If you set

    header->setResizeMode(QHeaderView::Stretch);

    then the user can't resize the headers. But if you set it to interactive then the columns need a horizontal scroll bar. Is there any way to get the stretch by default and still resize?

    The winforms datagridview style behavior is what I am going for.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      You could use "strechLastSection":http://doc.qt.nokia.com/4.7/qheaderview.html#stretchLastSection-prop which stretch only the last one and use a resizeToContents after filling in the data.
      Then the user could change the width but the last column always fits.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      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