3

How can I make my QVTKwidget to adjust when I make my window expand or shrink?

I have more widgets in my layout. I want them to stay the same, just expand shrink the QvtkWidget. I found some things about the layout, but I can't use it on QVTKWidget.

Yotam Omer
  • 15,310
  • 11
  • 62
  • 65
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102

1 Answers1

5

Assuming this is a reasonably well behaved widget, you could either use:

  • QMainWindow and set the widget as the central widget (setCentralWidget)
  • Use layouts such as QVBoxLayout and ensure you set the stretch parameter of your QVTKWidget widget to 1 and your other widgets to 0, see QBoxLayout::addWidget.
Silas Parker
  • 8,017
  • 1
  • 28
  • 43
  • with this I can't use `setCentralWidget`. – SamuelNLP Sep 03 '12 at 16:11
  • I would try this suggestion. It seems reasonable and should work with QVTKWidget. Although remember that vtk autoscales the camera based on the height alone so you have to adjust for that if the width becomes the limiting factor. I do this with a vtkEvent – drescherjm Sep 03 '12 at 17:16
  • 1
    @SamuelNLP You need to say **why**, your comment by itself provides no useful information for someone to assist you with the problem. At a guess through is your problem the same as here: http://www.vtk.org/pipermail/vtkusers/2010-November/113376.html ? – Silas Parker Sep 04 '12 at 07:42
  • @skyhisi, sorry for the lack of information. yes that's exacly what happens to me, but in my case the qvtkwidget is not the only widget on the mainwindow, so I just want that to resize but the other ones to stay the same size. Thanks. – SamuelNLP Sep 04 '12 at 08:18