Important: Please read the Qt Code of Conduct -

Controlling Margin and Spacing during resize

  • This app has a GL widget within a QGridLayout. When being resized the QGLWidget has a paintGL() that gets called as it is resized. It can make adjustment during the resize. I am not seeing anything from the QWidget that is or might be called as the widgets are resized. Is there a way to write a function that is called during that operation?
    SetColSpacing() and SetRowSpacing() set the minimum spacing. Is there a way to set maximum spacing:
    The goal is to prevent the spacing and margins to change during the resize operations.

  • Lifetime Qt Champion


    Are you thinking about the QWidget::resizeEvent method ? Or the QGLWidget::resizeGL method ?

  • Don't know, might be, sounds good, looking them up.
    Yes, that is what I wanted. Its an intermediate step.
    I created a resize() method used it to interrogate the grid layout to get the values for column and row spacing, and for margin and spacing. I was hoping those values would change when the widget was resized. In that event they could be re-written during the resize event to preclude the spacing from changing.
    They don't change.
    To recap: As the enclosing widget is resized, the GL widget is to change size, but the spacing between the widgets is not to change.

Log in to reply