Important: Please read the Qt Code of Conduct -

Anchoring to Window

  • How do I take a control say... a splitter and anchor it to the sides of the window?

    So when I resize the window, the items that are in the splitter.. resize accordingly?

    I see sizePolicy, minimumSize, maximumSize and geometry but not sure which one it is I should be looking at.

  • Please explain with more datails.

  • I have a QTextEdit with a QLineEdit within a Splitter.

    I want both QTextEdit and QLineEdit to span the width of the client window even if the window is resized.

  • Ah figured it out.

    With MainWindow.ui
    Right-click on the main window
    Select Layout
    I chose 'Lay out in Grid'

    This anchored my splitter to all 4 corners so when i resize the window, the QTextEdit and QLineEdit resize properly too!

Log in to reply