Skip to content

Use GUI application palette instead of default empty one - #4016

Open
softins wants to merge 2 commits into
jamulussoftware:mainfrom
softins:use-gui-application-palette
Open

softins wants to merge 2 commits into
jamulussoftware:mainfrom
softins:use-gui-application-palette

Conversation

@softins

@softins softins commented Dec 2, 2026

Copy link
Copy Markdown
Member

Short description of changes

This follows on from PR #3999.

With further testing on Pi, I've concluded that setPalette ( QPalette() ); is not correct, as QPalette() does not actually default correctly to the default light/dark theme.

Instead it should be setPalette ( QGuiApplication::palette() );, which works correctly on my Pi, for both the connect and chat dialogs.

CHANGELOG: GUI: Inherit light/dark mode theme correctly from environment.

Context: Fixes an issue?

The fix in #3999 was not completely successful on Linux.

Does this change need documentation? What needs to be documented and how?

No, bugfix only

Status of this Pull Request

Ready to test

What is missing until this pull request can be merged?

Specifically need to verify that this works correctly on iOS/iPadOS.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

Testing elsewhere showed that QPalette() returned an empty palette
instead of the one inherited by the GUI from the environment.
This caused the dialogs not to be fully themed. Using the GUI
application palette explicitly fixed that problem. at least on Linux.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

CBaseDlg now declares its constructor without an inline definition. Its inline event override, which applied a default-constructed palette on show, was removed. The HEADLESS guard now also excludes the constructor from headless builds.

Changes: Base dialog changes

Layer / File(s) Summary
Dialog declaration and build guard
src/util.h, src/util.cpp
CBaseDlg now declares its constructor in the header, and its inline event override was removed. The HEADLESS guard now covers the constructor and About dialog code.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Possibly related issues

  • AI bug findings for iOS #3994: The issue describes dialogs retaining a light palette in dark mode. This diff removes the event override that applied a default-constructed palette; it does not establish that the issue is resolved.

Possibly related PRs

  • jamulussoftware/jamulus#3999: PR #3999 also changes dialog palette behavior. This diff removes the inline show-event override associated with that behavior.

Suggested reviewers: ann0see

Merge Risk: Minimal · up to e8c68

The change makes the connect and chat dialogs take the application's palette when they are created instead of forcing an empty palette on show. No concrete regression has been established. It is worth a quick manual check on iOS/iPadOS and in dark mode, as the author already noted.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the CBaseDlg palette is now taken from QGuiApplication::palette() instead of an empty QPalette(). The raw summary and PR description both describe this palette change,…
Description check Passed The description follows the template. It has a short description of changes, a CHANGELOG entry in the required form, a context section that explains the fix for #3999 was incomplete on Linux, a docume…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the CBaseDlg palette is now taken from QGuiApplication::palette() instead of an empty QPalette(). The raw summary and PR description both describe this palette change, so the title matches the changeset. It does not mention the HEADLESS guard change, which is a secondary change.

Full details: Description check

Explanation

The description follows the template. It has a short description of changes, a CHANGELOG entry in the required form, a context section that explains the fix for #3999 was incomplete on Linux, a documentation answer (not needed), a status (ready to test), and a list of remaining work (iOS/iPadOS verification). The checklist is partly ticked. The unchecked items are the GitHub checks item and the 'filled all the content above' item. The template's optional AUTOBUILD note is absent, and the description does not mention the HEADLESS change in util.cpp. These gaps are minor.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 5c3c4d03-aa81-44ce-ad01-f2308e4677da
Commits

Reviewing files that changed from the base of the PR and between 631bb02 and e8c689e.

Files selected for processing: 2

  • src/util.cpp
  • src/util.h

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@softins
softins requested review from ann0see and pljones December 2, 2026 11:36
@softins softins added bug Something isn't working backport_required A change to main that needs fix on an existing release. labels Dec 2, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Dec 2, 2026
@softins softins added this to the Release 4.0.0 milestone Dec 2, 2026
@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

I believe it regresses it on iOS.

@ann0see ann0see left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So iOS definitely regresses with this. You could ifdef it...

@ann0see ann0see left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry. should not have approved

@github-project-automation github-project-automation Bot moved this from Triage to Waiting externally in Tracking Dec 2, 2026
@softins

softins commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

So iOS definitely regresses with this. You could ifdef it...

I think I'd prefer to understand why first. It shouldn't.

@softins

softins commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Also just noticed that in dark mode some of the labels in the Settings dialog are still black instead of white. Need a bit of an audit of style specifications.

@softins

softins commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Agree. Could you rebase this branch to latest main if it isn't?

It is, I only made it this morning.

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

Just saw that I locally had a weird state. Maybe that's the cause.

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

image

image

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

Huh, now it seems to also have this bug on the current main again and TestFlight?

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

So my PR did not solve it. But I could swear that I could reproduce it working...

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

Maybe Qt 6.12 regresses it again.

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

Actually no. It does not. Same issue with 6.11.1. meaning we should probably revert my PR

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

But the question is then really why does this happen.

@pljones

pljones commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Is it broken for every widget or only specific types of widget? (I'm wondering if our custom widgets are the problem or whether it's even basic Qt ones.)

@softins

softins commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Well I've moved the setting of the palette from the event handler to the CBaseDlg constructor, and that seems to have fixed dark mode on Linux for the Connect and Chat dialogs. The text box on the About dialog is still black on white, and some of the labels in the Settings dialog seem to be wrong - perhaps they use hard coded colours instead of defaults? Also the Server dialog is only partially correct.

@ann0see could you test the latest commit on iOS for the Connect and Chat dialogs?

@softins

softins commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

I also don't know how it varies between Qt versions - my Linux build is on Qt 5.15.8

@ann0see

This comment has been minimized.

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

Follow-up on the new head (e8c689ed, palette set in the CBaseDlg constructor via QApplication::palette(this)).

I rebuilt that exact commit with the Qt 6.12.1 native arm64 simulator kit, set the simulator to dark mode, cold-launched the app and opened the Connect dialog. Because the directory was unreachable, I injected test-only rows into a temporary copy so the item text could be measured; the installed build did not have those rows.

Measured brightness of the server-name column at first paint:

Build First paint After any repaint
previous head 631bb02e 29 255
new head e8c689ed 29 255
test-only explicit item foreground 255 255

So the constructor-based palette change does not fix the first-paint colour problem under the same conditions. The explicit item foreground remains the only workaround I have measured to work; it is in my earlier comment, with its caveats.

No images attached, and nothing was committed or pushed from this test.

🤖 Used AI: Hy4 flash Free, OpenCode

@ann0see

ann0see commented Dec 2, 2026

Copy link
Copy Markdown
Member

I'll test myself once I have physical access to my setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport_required A change to main that needs fix on an existing release. bug Something isn't working

Projects

Status: Waiting externally

Development

Successfully merging this pull request may close these issues.

3 participants