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::stretchLastSection interferes with QTableView::resizeSection
Forum Updated to NodeBB v4.3 + New Features

QTableView::stretchLastSection interferes with QTableView::resizeSection

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 447 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.
  • deisikD Offline
    deisikD Offline
    deisik
    wrote on last edited by deisik
    #1

    Basically, I want the first column to always have a fixed width of 21 pixels but if I set QTableView::stretchLastSection property to true, it gets resized to 23 pixels or so. It looks like it worked before but now doesn't work with Qt 5.9.5 anymore

    This code works:

    table->horizontalHeader()->setStretchLastSection(false);
    table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
    table->horizontalHeader()->resizeSection(0, 21);
    

    This code doesn't:

    table->horizontalHeader()->setStretchLastSection(true);
    table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
    table->horizontalHeader()->resizeSection(0, 21);
    

    Does anyone have same issue?

    deisikD 1 Reply Last reply
    0
    • deisikD deisik

      Basically, I want the first column to always have a fixed width of 21 pixels but if I set QTableView::stretchLastSection property to true, it gets resized to 23 pixels or so. It looks like it worked before but now doesn't work with Qt 5.9.5 anymore

      This code works:

      table->horizontalHeader()->setStretchLastSection(false);
      table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
      table->horizontalHeader()->resizeSection(0, 21);
      

      This code doesn't:

      table->horizontalHeader()->setStretchLastSection(true);
      table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
      table->horizontalHeader()->resizeSection(0, 21);
      

      Does anyone have same issue?

      deisikD Offline
      deisikD Offline
      deisik
      wrote on last edited by deisik
      #2

      It seems I have fixed this issue by setting minimumSectionSize equal to 21

      1 Reply Last reply
      1

      • Login

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