[SOLVED] Qt4 - Layout Issues
-
Hello,
I have some difficulties to understand layouts and I don't know what to do to solve my problems. Here is what I have :!http://img842.imageshack.us/img842/3885/a94t.png(test)!
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)
@ _table->setColumnWidth(0,175);
_table->setColumnWidth(1, 75);
_table->setColumnWidth(2, 50);
_table->setColumnWidth(3, 150);
_table->setColumnWidth(4, 75);
_table->setColumnWidth(5, 300);
this->resize(1200, 400);@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()
Two tips:
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