qt: Handle fonts of deleted widgets properly, streamline the flow in GUIUtil::updateFonts#3772
Conversation
Use QPointer-s to process deleted widgets properly, streamline the flow (less loops and map scans).
GUIUtil::updateFontsGUIUtil::updateFonts
|
@UdjinM6 I can confirm this solves the issues pointed out in #3767 (FYI, i was able to reproduce it on macOS also). But this fix introduces a new scaling bug due to font inheritance (Just start the wallet with a very low/high font scale to reproduce it in most screens). See suggestion-3772 which contains a fix (8c075b9) for the introduced issue and also some more refactoring in |
The "Normal" was added when we also had other maps containing font updates
|
@xdustinface Good catch! Cherry-picked them all 👍 |
| ++nUpdatable; | ||
|
|
||
| QFont font = w->font(); | ||
| assert(font.pointSize() > 0); |
There was a problem hiding this comment.
I really don't love using asserts... If they do catch they provide basically no info to the user for us to debug with...
There was a problem hiding this comment.
>0 means that it's either a default font size (set via setApplicationFont) or some another valid value and font size was not set via setPixelSize. IMO it's safe to use it here, should only crash if we break smth in code (e.g. use setPixelSize).
…`GUIUtil::updateFonts` (dashpay#3772) * Refactor and fix `GUIUtil::updateFonts` Use QPointer-s to process deleted widgets properly, streamline the flow (less loops and map scans). * Add some debug output * qt: Rename mapNormalFontUpdates -> mapFontUpdates The "Normal" was added when we also had other maps containing font updates * qt: Count removed items, adjust debug logs * qt: Use the emplace result for the default font size * qt: Perform all widget font updates later in a seperate step * qt: Drop pointSize checks * qt: Refactor app class font scaling Co-authored-by: xdustinface <xdustinfacex@gmail.com>
…`GUIUtil::updateFonts` (dashpay#3772) * Refactor and fix `GUIUtil::updateFonts` Use QPointer-s to process deleted widgets properly, streamline the flow (less loops and map scans). * Add some debug output * qt: Rename mapNormalFontUpdates -> mapFontUpdates The "Normal" was added when we also had other maps containing font updates * qt: Count removed items, adjust debug logs * qt: Use the emplace result for the default font size * qt: Perform all widget font updates later in a seperate step * qt: Drop pointSize checks * qt: Refactor app class font scaling Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Fixes #3767