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