Skip to content

Fix the Edit menu disappearing when changing languages.#4797

Merged
amtriathlon merged 1 commit intoGoldenCheetah:masterfrom
gille:editmenu
Jan 12, 2026
Merged

Fix the Edit menu disappearing when changing languages.#4797
amtriathlon merged 1 commit intoGoldenCheetah:masterfrom
gille:editmenu

Conversation

@gille
Copy link
Copy Markdown
Contributor

@gille gille commented Jan 9, 2026

The edit menu attempted to populate itself with aboutToShow() but this is fragile in this case.

Fixes: #4647

Comment thread src/goldencheetah_plugin_import.cpp Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this relevant to the editMenu fix ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! That's QT noise on Macs that I was going to remove but forgot to.

@amtriathlon
Copy link
Copy Markdown
Member

Good catch, the fact it only happens on macOS when using translations disoriented me.
This was introduce by 000a769#diff-a858c8d2d1dce20a3b475fd7013ed3348e86e11528b167843c72d304f4de12c0 likely to dynamically update the Edit menu according to configuration, after this change it looks like the user has to restart GC to get the updated Edit menu, may be populateEditMenu still needs to clear the existing menu and be called from configChanged?

@gille
Copy link
Copy Markdown
Contributor Author

gille commented Jan 10, 2026

Ok, I think I've fixed it (it worked just fine while testing).

For translations to kick in you need to restart GC but that's a problem outside of this patch.

@thejockl
Copy link
Copy Markdown
Contributor

@gille: Just out of curiosity, do you know why aboutToShow didn't work here?

The edit menu attempted to populate itself with aboutToShow() but this is fragile on Mac when the system menu is empty.
Also fixed a (very minor) memory leak and rewrote some code in more modern C++.

Fixes: GoldenCheetah#4647
@gille
Copy link
Copy Markdown
Contributor Author

gille commented Jan 11, 2026

The problem is that aboutToShow() doesn't fire the way you hope it does (the way it's supposed to!). MacOS (Cocoa?) is very opinionated about the Edit menu and if it is empty MacOS might just decide to not show it at all. For a while it seemed related to the ->clear() but then I noticed the signal didn't even trigger the way we hoped it did. Forcing a population of the contents avoids this and returns your original idea which lets us use signals the way they're intended.

I was even able to reproduce this (with some struggle) with English language (no translation) but only on a native ARM64 binary.

@amtriathlon
Copy link
Copy Markdown
Member

amtriathlon commented Jan 11, 2026

Retrospectively Joachim's change likely worked since it involved renaming the top level menu from Edit to Process, it was me who introduced this issue renaming it back in 5ef6080, considering the way we use that menu is unrelated to typical Edit system menus perhaps to rename it was a good idea after all, to change the wiki is not that a big issue and abandoned translations seems to be a lost cause.

@gille
Copy link
Copy Markdown
Contributor Author

gille commented Jan 11, 2026

@amtriathlon I can reproduce the bug regardless of menu name and translation (it's just less deterministic with English). The core problem is the empty menu.

Currently all this does is a force menu build which is near free and will be safe regardless of what we call the menu.

@amtriathlon
Copy link
Copy Markdown
Member

Ok, so the real fix is to add this before connecting the aboutToShow signal:

    // Force the signal to emit, without this on MacOS the edit menu disappears if we have translation enabled.
    onEditMenuAboutToShow();

and all the remaining changes are non-functional refactoring, am I right?

@gille
Copy link
Copy Markdown
Contributor Author

gille commented Jan 12, 2026

Yes that's the actual bug fix.

This also fixes a small memory leak, without this the QActions pile up until you exit GC.
auto* action = new QAction(QString("%1...").arg(iter->name()), toolMapper.get());
The rest is just modernizing the code (moving the codebase to actual C++17/20 would make it generally much more readable).

@amtriathlon amtriathlon merged commit 1c69798 into GoldenCheetah:master Jan 12, 2026
1 check passed
@amtriathlon
Copy link
Copy Markdown
Member

Thank you.

amtriathlon added a commit that referenced this pull request Jan 17, 2026
Main changes from v3.8-DEV2601:
686f431 Revert to Qt 6.5.3 for macOS builds
a00e276 Dialog to build filter queries for similar activities (#4805)
749a21d Train mode: Improved readability for ErgFilePlot (#4806)
3e8c6fe Updating power values of planned activities with linked workouts (#4799)
1c69798 Fix Edit menu disappearing when changing languages on macOS (#4797)
[publish binaries]
amtriathlon added a commit that referenced this pull request Jan 24, 2026
Changes from v3.8-DEV2601
4db88fa Update translation files
663526c Choose cyclist default to no avatar (#4814)
f6d4f6a Using "actual activity" instead of "completed activity" (#4813)
253b220 Add Zoomed Elevation Widget to Graphical Meters For simulation workouts without GPS data
b0d16d1 Add reconnect attempt timer after BT40Device unexpected disconnect (#4812)
c85da47 Fix typo in Nonzero Average Power description
07e673d Selectable show/hide planned activities (#4811)
1a4dd1d Updated Time Range context menu (#4808)
686f431 Revert to Qt 6.5.3 for macOS builds
a00e276 Dialog to build filter queries for similar activities (#4805)
749a21d Train mode: Improved readability for ErgFilePlot (#4806)
3e8c6fe Updating power values of planned activities with linked workouts (#4799)
1c69798 Fix Edit menu disappearing when changing languages on macOS (#4797)
[publish binaries]
amtriathlon added a commit that referenced this pull request Feb 7, 2026
Changes from v3.8-DEV2601
3b5ec90 Fix bug in RideMetadata
9087c0d Combine view indexes and view relevance definitions into single enumerated type (#4795)
a0fe8af Planned activities: Keeping track of original date (#4822)
31d8708 Fix default Plan layout
a124799 AppVeyor - Refactor Windows build scripts (#4820)
d8b10fe Cloud Service creates unnecessary GlobalContext instances (#4823)
40db2bc Standardize how the config is created for releases. (#4784)
6ab9950 AppVeyor - run lupdate on Windows
a36f527 Copy & Paste for planned activities on calendar (#4819)
dfd932d Fit file import - don't crash on malformed files
2eaf1bc Upgrade Python, Pandas, and SIP versions (#4747)
b00d3b7 Update German translation
4db88fa Update translation files
663526c Choose cyclist default to no avatar (#4814)
f6d4f6a Using "actual activity" instead of "completed activity" (#4813)
253b220 Add Zoomed Elevation Widget to Graphical Meters For simulation workouts without GPS data
b0d16d1 Add reconnect attempt timer after BT40Device unexpected disconnect (#4812)
c85da47 Fix typo in Nonzero Average Power description
07e673d Selectable show/hide planned activities (#4811)
1a4dd1d Updated Time Range context menu (#4808)
a00e276 Dialog to build filter queries for similar activities (#4805)
749a21d Train mode: Improved readability for ErgFilePlot (#4806)
3e8c6fe Updating power values of planned activities with linked workouts (#4799)
1c69798 Fix Edit menu disappearing when changing languages on macOS (#4797)
[publish binaries]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit menu is missing on macOS builds when using translations

4 participants