Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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
artwaw last edited by
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
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
artwaw last edited by artwaw
@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.
JoeCFD last edited by
@artwaw That is not true. Layout is applied to arrange the child widgets which are not necessarily auto-sized.
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.
artwaw last edited by
@aftalib can you poste the code + show me how you've organised your layouts please?