Important: Please read the Qt Code of Conduct -

Fixing widget geometry

  • I'm pretty new to QT and creating an app that requires one of its widgets to have identical height and width (i.e. square), no matter what the size / geometry of the containing view might be. Ideally the main window will have only two available size states - a "small" state that's some fraction of the screen size (and the same aspect ratio), and fullscreen.

    Can anyone point me at some example code or offer advice on the best way to realize this?

    Thanks in advance,


  • Set its sizePolicy to fixed and then use setSize.

Log in to reply