QWidget with QTabWidget
-
@ixion
Add this method:QSize sizeHint() const override { return QSize(500,400); }
Or resize your widget after show():
widget.resize(500,400); -
@mpergand thanks, but I can't make the widget resize automatically depending on the objects inside it?
-
@ixion
Try:
tableWidget->resize(500,400);
If it doesn't work try to set a fixed or a minimum size instead. -
@mpergand said in QWidget with QTabWidget:
ni
thanks, I know about resize, I'm interested in the automatic resizing of the widget, without explicitly specifying the size
@ixion without being in a layout, as far as I know, there's nothing. I think you will have either to live with your main widget not risizing automatically, or implement that auto resize by yourself (by adding the width of all tabs + some constant should be what you need).
-
@mpergand said in QWidget with QTabWidget:
ni
thanks, I know about resize, I'm interested in the automatic resizing of the widget, without explicitly specifying the size
-
@ixion
I don't think it works with a tabWidget ...
What size is return by tabWidget->sizeHint() ? -
@ankou29666 said in QWidget with QTabWidget:
without being in a layout, as far as I know, there's nothing. I think you will have either to live with your main widget not risizing automatically, or implement that auto resize by yourself (by adding the width of all tabs + some constant should be what you need).
thanks
-
@ankou29666 said in QWidget with QTabWidget:
without being in a layout, as far as I know, there's nothing. I think you will have either to live with your main widget not risizing automatically, or implement that auto resize by yourself (by adding the width of all tabs + some constant should be what you need).
thanks
-
@mpergand
I have only used Qt on Linux. My impression was that it never auto-grows a top-level window, at least when you put more content into it, i.e. like the left-hand one. Maybe it only does that window-widening under MacOS?@JonB said in QWidget with QTabWidget:
I have only used Qt on Linux. My impression was that it never auto-grows a top-level window, at least when you put more content into it, i.e. like the left-hand one.
Since on linux, the length of the tab titles are not taken into account, the overall size of the tab widget reflects the widest element present in the tab pages.
On mac, the minimum size of the tab widget depends of the length of the tab titles.
Otherwise the tab titles are troncated with ellipsis, very ugly.