Hi,

I am trying to align the widgets of my application to the center of the window. To do so, I have been placing a HorizontalSpacer on both sides of the collection of widgets that I have placed on the QMainWindow.

It has done the trick to almost every tab I have been using. But I have some issues on some tabs I only display a table on them.

The table is dinamically created from the database (the columns, columns names, whether it is editable or not, the type of each column,...) and I don't know the size that would fit better to each table to set a fixed width, and the result is a table with a small width, and lots of spaces on each side.

Is there a way to obtain the maximum size I could use without getting into trouble? I have tested:

Qt Code:
  1. void MyTableWidget::resizeTable(){
  2. int width = 0;
  3. for(int i = 0 ; i < columnCount() ; i++){
  4. width += columnWidth(i);
  5. }
  6. setMinimumWidth(width);
  7. }
To copy to clipboard, switch view to plain text mode 

But when the QMainWindow is small or the table is too big, part of the table is not visible (even with the scroll).

Cheers,

Josep