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 width and columns width
Forum Updated to NodeBB v4.3 + New Features

QTableView width and columns width

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtableviewcolumn width masizescrollbar
3 Posts 2 Posters 3.0k Views 2 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.
  • M Offline
    M Offline
    Mark81
    wrote on 23 Nov 2015, 12:38 last edited by
    #1

    Hi! I have a QTableView placed into a horizontal layout in a QMainWindow. When the table is empty (I mean no model is set yet) the user can resize the main window (and therefore the table) down to a very small size.
    After setting the model, two odd things happen:

    1. the QMainWindow resize itself to accomodate the columns
    2. the user cannot shrink the window below the whole width of the column.

    Both behaviors are unwanted in my application. I need to maintain the current window's size and let the user to change its dimensions how he likes. Of course if the width of the table is less than the whole width of the columns I expect to use scrollbars.

    Which property you recommend to look for?

    1 Reply Last reply
    1
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Nov 2015, 22:55 last edited by
      #2

      Hi,

      You can try and modify the QSizePolicy of your QTableView

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 24 Nov 2015, 10:34
      0
      • S SGaist
        23 Nov 2015, 22:55

        Hi,

        You can try and modify the QSizePolicy of your QTableView

        M Offline
        M Offline
        Mark81
        wrote on 24 Nov 2015, 10:34 last edited by
        #3

        @SGaist
        The QSizePolicy is set to Expanding, because I want the table should take all the space by default. Anyway I tried to set it to Minimum but nothing changes. It seems something force the minimum size of the table, but I printed out the actual minimumSize value and is set to 0, even after adding the contents.

        1 Reply Last reply
        0

        1/3

        23 Nov 2015, 12:38

        • Login

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