QTableView not expanding/reducing when QMainWindow is resized
-
Any help, please?
-
Try set horizontal and vertical policy:
@policy.setHorizontalPolicy(QSizePolicy::Expanding);
policy.setVerticalPolicy(QSizePolicy::Expanding);@ -
I've tired both for the Table, both "expanding" as well as "MinimumExpanding".
Neither seems to work.
-
What is Static_Info,TableLayout? Can you post part of code as project somewhere if it is small?
-
[quote author="qxoz" date="1362984243"]What is Static_Info,TableLayout? Can you post part of code as project somewhere if it is small?[/quote]
Static_Info is a simple QWidget, which has a few QLabels as content, and is set in a QGridLayout.
@
class Static_Info : public QWidget
@TableLayout is a class derived from QAbstractTableModel.
@
class TableLayout : public QAbstractTableModel
@ -
I thing using frames and inserting ur widgets in frames and setting policy to frame will resolve.
-
[quote author="devfeel" date="1362986724"]I thing using frames and inserting ur widgets in frames and setting policy to frame will resolve.[/quote]
Could you develop your point, please?
And the problem is only with QTableView. The other widgets which I've added to QVBoxLayout of the central widget, they expand fine.
-
Kindly advise.
-
Hi .. starbearer try this code its working fine in my code
@
QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(Table->sizePolicy().hasHeightForWidth());
Table->setSizePolicy(sizePolicy);
@Edit: code goes between @ tags, please; Andre
-
Table gets expanded, but unfortunately, it overrides any size which I may have used for my columns.
I've set a fixed size for my columns( It's commented out in the code above)....but I need that size.
If I use the above method, then all the fixed size for columns gets overriden, and all columns get an equal size.
Any way, I can have the columns of a size ( to show the contents in full), and manage to resize the table as well?
I tried this...
@
Table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
@But this had the same effect.
Kindly advise...thanks.