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. How to get rid of empty spaces in a QTableView based on QStandardItemModels
Forum Updated to NodeBB v4.3 + New Features

How to get rid of empty spaces in a QTableView based on QStandardItemModels

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

    How to get rid of empty spaces in a QTableView based on QStandardItemModels, in yellow?

    3f7a9ddc-71bc-4fbf-94d6-a2c91b0b954d-image.png
    This is the code of headers:

    mModel = new QStandardItemModel(0,6,this);
        mModel->setHeaderData(0, Qt::Horizontal, "Description", Qt::DisplayRole);
        mModel->setHeaderData(1, Qt::Horizontal, "Command", Qt::DisplayRole);
        mModel->setHeaderData(2, Qt::Horizontal, "Direction", Qt::DisplayRole);
        mModel->setHeaderData(3, Qt::Horizontal, "ACK", Qt::DisplayRole);
        mModel->setHeaderData(4, Qt::Horizontal, "ExpectedResult", Qt::DisplayRole);
        mModel->setHeaderData(5, Qt::Horizontal, "Result", Qt::DisplayRole);
    
    
           m_ui->Table_CSV->setModel(mModel);
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2
      m_ui->Table_CSV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
      m_ui->Table_CSV->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
      
      1 Reply Last reply
      2
      • I Offline
        I Offline
        imene
        wrote on last edited by
        #3

        @mpergand It works thanks a lot!

        1 Reply Last reply
        0
        • I Offline
          I Offline
          imene
          wrote on last edited by imene
          #4

          Hi everyone,
          How to make those buttons "in yellow" change the size when i widen the interface?
          64b74dbe-9226-4260-acac-6673d2a3de67-image.png

          41e6a8b5-b86d-486f-b81a-b002aa5821cd-image.png

          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