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 set the size of a QTableView within a Layout ?

How to set the size of a QTableView within a Layout ?

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

    Hello, i am using QT Creator in order to display arrays inside of QTableViews. i have put 2 QTableView in a layout so it can follow the window when i move it. however, i would like to modify the size of the QTableViews because theyre too big for the arrays i'm displaying, but changing the "baseSize" parameters doesnt make a difference. however it works when i set a minimum or maximum size for these views.. but what i would like to do is to set a base size so that my arrays fit perfectly with my QTableViews.

    any solutions ?

    PS : just started picking up Qt a few days ago.. im still kind of a newbie here

    1 Reply Last reply
    0
    • artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      The whole idea of layouts is that you don't. They auto-size.
      Having said that - you can control some of the parameters. Please take look at the minimum and maximum size properties of QTableView.
      I would also recommend to read this piece of docs: https://doc.qt.io/qt-5/layout.html

      For more information please re-read.

      Kind Regards,
      Artur

      JoeCFDJ 1 Reply Last reply
      1
      • A Offline
        A Offline
        aftalib
        wrote on last edited by
        #3

        So besides setting the minimum and maximum properties of my QTableView i cannot control them as they are inside the layout ?

        thank you for the piece of doc i'm gonna take a look at it

        artwawA 1 Reply Last reply
        0
        • A aftalib

          So besides setting the minimum and maximum properties of my QTableView i cannot control them as they are inside the layout ?

          thank you for the piece of doc i'm gonna take a look at it

          artwawA Offline
          artwawA Offline
          artwaw
          wrote on last edited by artwaw
          #4

          @aftalib You can control more than that, everything should be between that doc I linked, QTableView docs and related documentation. I dare to say you can do almost everything and have almost absolute control but achieving that might be not obvious at first. For me layouts were always a tricky subject and I am far from being a master but never had an idea I could not implement. It's just that, again, solutions were not obvious to me at the time.

          For more information please re-read.

          Kind Regards,
          Artur

          1 Reply Last reply
          0
          • artwawA artwaw

            The whole idea of layouts is that you don't. They auto-size.
            Having said that - you can control some of the parameters. Please take look at the minimum and maximum size properties of QTableView.
            I would also recommend to read this piece of docs: https://doc.qt.io/qt-5/layout.html

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            @artwaw That is not true. Layout is applied to arrange the child widgets which are not necessarily auto-sized.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aftalib
              wrote on last edited by
              #6

              okay thanks to your documentation i have managed to set the size of my tableview but i have another problem. above this tableview, i have two TabWidgets, and when i go on the second one the size of my QTableViews goes back to how they were before. let me specify the QTableViews are NOT a part of the TabWidgets, theyre just under it.

              artwawA 1 Reply Last reply
              0
              • A aftalib

                okay thanks to your documentation i have managed to set the size of my tableview but i have another problem. above this tableview, i have two TabWidgets, and when i go on the second one the size of my QTableViews goes back to how they were before. let me specify the QTableViews are NOT a part of the TabWidgets, theyre just under it.

                artwawA Offline
                artwawA Offline
                artwaw
                wrote on last edited by
                #7

                @aftalib can you poste the code + show me how you've organised your layouts please?

                For more information please re-read.

                Kind Regards,
                Artur

                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