Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Qt4 - Layout Issues
Elfayer last edited by
I have some difficulties to understand layouts and I don't know what to do to solve my problems. Here is what I have :
First, I'd like the "Actions" QGroupBox to stick on top of the window and not to expand like this.
Then, I have to do like follow if I don't want the window to be completely crushed when launched : (this is a QWidget and _table is a QTableWidget)
How can I say to my window to consider the width of my table ?
So that I don't have to set it manually.
Also, how can I set automatically the width of each columns of my table to the max width of their content (text for example) ? Or the size of their title by default (like in this case).
Thanks in advance !
Hi, you want QBoxLayout::addStretch(), QTableView::resizeColumnsToContents(), and QWidget::setMinimumWidth()
Read the documentation -- Qt's docs are widely considered to be very comprehensive. Don't forget to check a class' inherited functions too.
Use Qt Designer for laying out custom widgets -- It will likely save you lots of time in the long run