Workaround for minimum size not being kept when deactivating constants
In my previous resizing support merge request (!24 (merged)), I made sure that any KCalc mode changes that happen at minimum window size result in the window resizing itself to the new minimum size. However, this turns out to not have worked in one specific case: Showing/Hiding the constants buttons.
Upon investigation of this issue, I noticed that minimumSize()
isn't updating correctly after hiding of the buttons (and stays at the old minimumSize). Thus, the call to resize(minimumSize())
doesn't work.
I tried several things to fix this, including
- Somehow using
QApplication::processEvents()
to make sure minimumSize is updated before I use it - Creating a helper function
resizeToMinimum
that's called deferred - Manual checking in
resizeEvent
- forcing several update events (updateGeometry, ...) before resizing to minimum
None of them worked, however I noticed that calling resize
multiple times in a row resulted in the minimumSize
being updated properly.
This is exactly what I use in this (somewhat stupid) workaround that fixes the issue.
Before | After |
---|---|
2022-01-19_11-15-28 | 2022-01-19_11-17-24 |