Make QTableWidget expand when dialog window size is changed

  • I have a tablewidget, and a textEdit, and cancel +okay bottons
    I want these widgets to stay in the relative position to each other, and the tablewidget to expand if the dialog window is expanded or size changed...

    how can i do that?

  • Use a layout manager, "gridlayout": should work for you.

  • Please read the "introduction on layout management": from the documentation.

    For positioning the cancel and OK buttons, I would recommend you look into using a QDialogButtonBox. It will automatically layout and order the buttons for you in the way your platform prescribes.

  • so i have this
    @QGridLayout *layout=new QGridLayout();
    this->setLayout(layout); @

    but only a tiny box is created for viewing of each widget... the widget doesnt fill up the cell in the grid... and the setSizePolicy gave me error of it being private and cant be accessed.... ???

  • although the widgets, buttons do change position and size with respect to the parent dialog window

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.