How to set initial size of the main window?

@pieper @lassoan @jcfr

How do I set the initial size and location of the main SlicerQREADS window. A physician complained it comes up too small and I agreed. Any solutions?


A physician complained it comes up too small and I agreed. Any solutions?

Last size of application is currently saved in the settings after the application is closed.

How would like to compute the initial size ?

Once you answer that question, it will be possible setting slicer.util.mainWindow().size if it has not already been saved in the settings.

OK, for some reason, mine is not remembering from previous runs. Ok, I will try to look inti that. thanks

I’ve seen this behavior on mac.

If you need a workaround you can also do something like slicer.util.mainWindow().setGeometry(20,20, 500, 500)

Hello @pieper,

That worked as far as being able to set the geometry, but it would be nice if I could, for instance, center it and set the size proportional to the screen geometry.


yes, you can query the screen size from and do all those calculations. See QGuiApplication Class | Qt GUI 5.15.3 and search for screen for details.

OK, I hope the save-settings thing starts working again. That would be best. This issue was actually mentioned by the chairman of the Apps Oversight Committee after my demo.

@jcfr @pieper

FYI: I won’t need this if it could remember the last geometry upon closing the window. That’s the root of the problem. So, if you could solve that, I’m cool.

For reference, the setting of initial window size related to the SlicerQReads demo is now tracked in issue SlicerQReads#62

I looked a couple times and it’s not instantly obvious. It bugs me but not enough to fix it myself.

For reference that issue regarding remembering window size on macOS is being tracked at Settings save on application exit does not work · Issue #4601 · Slicer/Slicer · GitHub.

That GitHub issue is currently assigned to you @pieper. If you don’t have plans to fix it, I guess you should remove yourself from the issue so that it doesn’t appear you are actively working on it or plan to work on it. I think it was assigned to you being a macOS user.

Thanks for making the link @jamesobutler, I unassigned myself so it’s up for grabs. I could test if someone proposes a fix.