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. QHeaderView setSectionResizeMode "segmentation fault"

QHeaderView setSectionResizeMode "segmentation fault"

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 804 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.
  • Evgeny SiberiaE Offline
    Evgeny SiberiaE Offline
    Evgeny Siberia
    wrote on last edited by Evgeny Siberia
    #1

    Hi. I need ResizeToContents for VerticalHeader. My attempt:

    QHeaderView *vHeader = new QHeaderView(Qt::Orientation::Vertical, this);
    vHeader->setSectionResizeMode(Entity::SomeColumn, QHeaderView::ResizeToContents);
    ui->_tv->setVerticalHeader(vHeader);
    

    And I get segmentation fault in this line: setSectionResizeMode.
    How I can set heigh for my rows by context?

    if you see mistakes in English tell me about it

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I'm pretty sure it does not crash there but one line below. Please provide a minimal, compilable example to reproduce your problem.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • P Offline
        P Offline
        Phil K
        wrote on last edited by Phil K
        #3

        The crash is probably caused by the fact that the view sections are not initialized until after you set the view's model. You must ensure that use of the two-parameter version of setSectionResizeMode happens after setModel. Take it out of the view constructor and put it somewhere else.

        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