[Interest] Seeking tips on restoring application geometry

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Aug 4 19:48:01 CEST 2015


On 2015-08-04 03:30, alexander golks wrote:
>> I'm kind of leaning towards saving multiple geometries in my settings based on the current desktop size, so that the user can set one geometry for the laptop-only case, set a different geometry for the external monitor(s) case, and have the application remember those settings independently. I'm just not sure if I'm overlooking an obvious pitfall with this approach?
> 
> what about re-/storing relations rather then fix pixel sizes? that is, calculate the percent-of-screen-x, percent-of-screen-y...
> but then in turn, what about font sizes? or doesn't this matter in your case?

That may or may not work. For starters, it would be much harder,
requiring reimplementation of the state preserving logic. It may also be
the case that the user wants panels arranged differently depending on
the screen size, which would not be achievable with this approach.

I didn't reply previously because I didn't feel I'd be saying much, but
Sean's proposed approach seems sensible to me. (I'd probably compute a
hash of the screen configuration, somehow, and use that as part of the
QSettings key for persisting the geometry. That "hash" could be just the
desktop size converted to a string, or could take into account
additional information, as seems best.)

-- 
Matthew




More information about the Interest mailing list