Skip to content

Dark mode for Qt6#1488

Open
TheForgotten69 wants to merge 21 commits into
Nerogar:previewfrom
TheForgotten69:fix/qt6-windows-issues
Open

Dark mode for Qt6#1488
TheForgotten69 wants to merge 21 commits into
Nerogar:previewfrom
TheForgotten69:fix/qt6-windows-issues

Conversation

@TheForgotten69

@TheForgotten69 TheForgotten69 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix various small issues that occured on Windows:

  • Remove SetProcessDpiAwareness(1) hack that prevented Qt6 from setting its preferred DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 context. I've tested this as I have two monitor and didn't got the transparent issue or the UI re-render on the other screen FYI. -> Already in preview now
  • Replace the forced light-mode workaround with a Windows-scoped apply_theme() that respects the system dark/light
    preference. Linux/macOS keep Qt's native theming untouched.
  • Add theme.py which applies the existing base stylesheet on all platforms and, on Windows only, layers QSS overrides
    (QTabWidget::pane / QTabBar contrast fixes + an adaptive progressbar) plus a white text-box fix for light mode — since
    Qt's dark mode renders tabs with no contrast on Windows.

The important gist is that the preferred mode is now respected and both light and dark are usable.

Screenshot 2026-05-30 204634 Screenshot 2026-05-30 204639

Test plan

  • pre-commit run --all-files passes
  • Launched the affected UI or script and exercised the change
  • Tested with at least one real preset / config when relevant (note which: Change is purely UI/Visual so no need for such test here)

AI assistance

  • AI-assisted — I have read every line in this diff and can defend each change

@TheForgotten69 TheForgotten69 force-pushed the fix/qt6-windows-issues branch 2 times, most recently from 9b5f76b to 8e22038 Compare May 30, 2026 19:10
@dxqb dxqb added the preview merged in the preview branch label Jun 2, 2026
dxqb added a commit to dxqb/OneTrainer that referenced this pull request Jun 3, 2026
SetProcessDpiAwareness was intended for CustomTkinter only; Qt handles
DPI natively and the call is not needed here. Suggested by PR Nerogar#1488.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dxqb dxqb deleted the branch Nerogar:preview June 3, 2026 07:27
@dxqb dxqb closed this Jun 3, 2026
@dxqb dxqb reopened this Jun 3, 2026
@dxqb

dxqb commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

this PR is empty now, because it was based on "preview" and "preview" is now updated to include your PR.
please rebase it on the PR branch: #1446

@dxqb dxqb mentioned this pull request Jun 3, 2026
2 tasks
dxqb and others added 2 commits June 4, 2026 20:53
factory.register() now detects whether its second argument is a type
(direct call form for loops) or an enum key (decorator form), allowing
implementations to declare themselves with @factory.register() directly
on the class definition instead of imperative calls at the bottom of
the file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dxqb dxqb removed the preview merged in the preview branch label Jun 4, 2026
Qt's dark mode support on Windows is broken (tabs render with no
contrast). apply_theme() applies explicit palette and QSS fixes on
Windows only, using palette() references so it adapts to the system
light/dark preference. Linux/macOS are left to Qt's native handling.

Replaces the previous force-light-mode workaround in train_ui_qt.py.
@TheForgotten69 TheForgotten69 force-pushed the fix/qt6-windows-issues branch from 55b7283 to 81dfba6 Compare June 5, 2026 20:28
@TheForgotten69

Copy link
Copy Markdown
Contributor Author

dark mode is scoped only on window, no custom styles either as the hardcoded white theme is handled

@dxqb

dxqb commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

thanks! will mark this waiting and come back to it when the Qt branch has merged

@dxqb dxqb added the waiting waiting for something / cannot fix currently label Jun 7, 2026
@dxqb dxqb changed the title Fix Qt6 Windows dark mode rendering and DPI warning Dark mode for Qt6 Jun 13, 2026
@dxqb dxqb force-pushed the preview branch 2 times, most recently from ce63c57 to 3c96784 Compare June 19, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting waiting for something / cannot fix currently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants