Skip to content

Dark mode for Qt6#1488

Open
TheForgotten69 wants to merge 110 commits into
Nerogar:masterfrom
TheForgotten69:fix/qt6-windows-issues
Open

Dark mode for Qt6#1488
TheForgotten69 wants to merge 110 commits into
Nerogar:masterfrom
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

Koratahiu and others added 30 commits December 30, 2025 17:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… VideoToolUI

Removes abstract _create_browse_dir_button/_create_browse_file_button from
BaseVideoToolUIView and uses the combined path_entry component instead, fixing
widget alignment issues. Adds allow_video_files flag to path_entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…IView

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…UIView

Now handled by path_entry in the base class.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…files)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Base view concrete methods were accessing self.controller, self.ui_state,
and toolkit-specific action methods that were only set by CTK subclass
__init__ after the base __init__ call, with no enforcement in the base.

- BaseTrainUIView: add controller/ui_state as constructor params; fix
  sync_cloud_secrets to use controller.train_config; add @AbstractMethod
  for export_training, generate_debug_package, open_profiling_tool
- CtkTrainUIView: reorder __init__ to create deps before base init call;
  replace self.train_config with self.controller.train_config
- BaseCloudTabView: add controller as constructor param
- CtkCloudTabView: pass controller to base __init__, drop redundant assignment
- BaseCaptionUIView: add ABC + @AbstractMethod for 6 action callbacks
- BaseConceptTabView: remove concrete _update_filters() (accessed CTK vars);
  add ConceptConfig import; add concept: ConceptConfig param to
  BaseConceptWidgetView.__init__
- CtkConceptTabView: implement _update_filters(); pass concept to base init
- BaseConceptWindowView: initialize bucket_ax/text_color/canvas to None
- BaseTrainingTabView: replace callbacks dict with 6 @AbstractMethod
  declarations; restore_optimizer_config(variable: str) matches controller
- CtkTrainingTabView: implement all 6 abstract methods directly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ctypes DPI awareness call is toolkit-specific (fixes CTK transparency
on Windows monitor changes). It already exists in CtkTrainUIView.py and
has no place in the toolkit-agnostic controller.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- PySide6TrainUIView: create train_config/ui_state/controller before base
  init so they can be passed as constructor params; replace self.train_config
  with self.controller.train_config throughout
- PySide6CloudTabView: pass controller to BaseCloudTabView.__init__;
  remove now-redundant self.controller assignment
- PySide6ConceptTabView: implement _update_filters() (removed from base);
  pass concept to BaseConceptWidgetView.__init__
- PySide6TrainingTabView: remove callbacks dict; call build() without it;
  implement 6 abstract methods with logic inlined from private helpers;
  remove now-unused private helper methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
search_var/filter_var/show_disabled_var were stored in the base but never
used there after _update_filters() was removed. Subclasses manage them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…abView

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
@dxqb dxqb changed the base branch from preview to merge July 5, 2026 09:29
@dxqb dxqb removed the waiting waiting for something / cannot fix currently label Jul 5, 2026
@TheForgotten69

Copy link
Copy Markdown
Contributor Author

I saw that Qt is merged in main, any point in me rebasing @dxqb ?
Changes were minimal, scoped only to windows and can be removed down the line

@dxqb

dxqb commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

please coordinate this #1593

@Zueuk

Zueuk commented Jul 11, 2026

Copy link
Copy Markdown

@TheForgotten69 what was the Windows problem you were fixing here? Qt Fusion style looks fine on Windows for me in both light and dark modes

@dxqb dxqb changed the base branch from merge to master July 12, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants