Make a MainWindow fit available screen and re-scale internal content?

Hi, I think I remember seeing a post on the forum related to this, but can’t seem to find it…

What is the right way to:

  • set the MainWindow of a standalone app to fit the available screen size (monitor on desktop, iPhone screen on iPhone, …), and more importantly:
  • rescale the internal contents of the MainWindow (I guess with an affine of transform) so that everything looks the same no matter which screen it’s displayed on?

I realize this might scale buttons, text, images, … and not look ideal, but it’s better than having some things disappear/clip in the internal components.
Just looking for a quick way to display a desktop app on an iPhone screen.

I already tried setting setFullScreen(true) on the MainWindow, and that resizes the MainWindow to fit the screen, but the internal components are not re-scaled (seems like they are resizing their bounds, but many internal widgets disappear because there is not enough space).

Use Component::setTransform (AffineTransform::scale (scaleFactor)) to scale everything in your main component.

1 Like