Search code examples
qtvtkqvtkwidget

Ajust QVTKWidget to window


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.


Solution

  • 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.