Skip to content

Make the main window the key window again after the chat window is hidden on iOS - #4000

Draft
ann0see wants to merge 1 commit into
mainfrom
ios/fix-chat-close-dark-mode
Draft

ann0see wants to merge 1 commit into
mainfrom
ios/fix-chat-close-dark-mode

Conversation

@ann0see

@ann0see ann0see commented Nov 15, 2026

Copy link
Copy Markdown
Member

Short description of changes

Make the main window the key window again when the chat window is hidden on iOS.

When the full screen chat window is hidden, iOS leaves the application without a key window. The palette is then resolved from the default light appearance, so the main window is painted with black text on the dark background it still has, until it becomes key again — which happened only when the user tapped the window, or switched to another app and back.

CClientDlg now watches the chat window with an event filter and raises and activates itself when the chat is hidden. The handler is guarded with Q_OS_IOS.

A related but separate problem is fixed in #3999: dialogs opened after the system appearance is known used to be painted with the light palette once.

CHANGELOG: iOS: Fixed the main window being unreadable after closing the chat window in dark mode

Context: Fixes an issue?

Fixes #3994 (dark mode item).

Measured on the iPad Pro 11-inch simulator with Qt 6.11.1, system in dark mode:

Case before after
open chat, close it via its Close entry menu bar, labels and buttons black on dark until tapped readable immediately
repeat twice black every time readable every time
same in light mode readable unchanged
crash reports none none

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

No.

Status of this Pull Request

Working implementation.

What is missing until this pull request can be merged?

  • Only tested in the simulator, not on a physical device, and only with the connection idle. Whether the palette is also wrong while a connection is running was not checked.
  • The event filter is installed on all platforms but does nothing outside iOS; the desktop behaviour is unchanged, but not exercised here.
  • The underlying behaviour — iOS dropping the key window and Qt resolving the palette from the default appearance — is worth a Qt bug report on its own.

🤖 Used AI: DeepSeek V4.1 Flash, OpenCode

…dden on iOS

When the full screen chat window is hidden, iOS leaves the application without a
key window. The palette is then resolved from the default light appearance, so
the main window is painted with black text on the dark background it still has
until it becomes the key window again, which happened only when the user tapped
it or switched away from the application and back.

Raise and activate the main window when the chat window is hidden.
@ann0see ann0see added the AI AI generated or potentially AI generated label Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

CClientDlg now filters ChatDlg events. On iOS, when ChatDlg is hidden, the filter raises and activates the main window before forwarding the event to the base-class filter.

Changes: Chat hide activation

Layer / File(s) Summary
Filter declaration and event handling
src/clientdlg.h, src/clientdlg.cpp
CClientDlg declares and installs an event filter on ChatDlg. On iOS, the filter raises and activates the main window for a Hide event, then forwards the event to the base-class filter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: bug

Suggested reviewers: softins, pljones

Merge Risk: Minimal · up to d2282

This change restores the main window's readable appearance on iOS after the chat window is closed in dark mode. Other platforms are unaffected. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: after the chat window is hidden on iOS, the main window is made key again. The raw summary confirms the event filter raises and activates CClientDlg when the chat is h…
Description check Passed The description follows the template. It has a short description of changes, a CHANGELOG entry in past tense, and a context section that links Fixes #3994. It also covers documentation needs, PR statu…
Linked Issues check Passed Scope is the dark-mode item of #3994 (hiding the chat window leaves the main window with black text). Per the PR objectives, the other #3994 items are not objectives here. The requirement is to raise …
Out of Scope Changes check Passed The reviewed changes, as described by the summary, touch only src/clientdlg.cpp (+20 lines, eventFilter installation and handler) and src/clientdlg.h (one eventFilter declaration). Both serve the chat…
Full details: Title check

Explanation

The title names the main change: after the chat window is hidden on iOS, the main window is made key again. The raw summary confirms the event filter raises and activates CClientDlg when the chat is hidden, guarded by Q_OS_IOS. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description follows the template. It has a short description of changes, a CHANGELOG entry in past tense, and a context section that links Fixes #3994. It also covers documentation needs, PR status, and remaining work. The checklist is absent from the description, but the template treats its boxes as author confirmations. The description explains the cause, the fix, the test setup, and the open risks. The remaining gaps are minor: the checklist is unticked, and the tests ran only on the simulator.

Full details: Linked Issues check

Explanation

Scope is the dark-mode item of #3994 (hiding the chat window leaves the main window with black text). Per the PR objectives, the other #3994 items are not objectives here. The requirement is to raise and activate the main window when the chat window is hidden on iOS. The AI-generated summary states that CClientDlg installs an event filter on ChatDlg, and that on iOS, when the chat is hidden, the filter raises and activates the main window before forwarding to CBaseDlg::eventFilter. The header declares the matching eventFilter override. This matches the requirement. The PR description reports simulator verification over repeated open/close cycles, with light mode unchanged. The #3994 item does not require automated tests. Limitation: the text diff for src/clientdlg.cpp could not be read (changed blobs unavailable in the checkout). The file read was truncated before the eventFilter code. The PASS rests on the summary and the PR description, not on direct code inspection.

Full details: Out of Scope Changes check

Explanation

The reviewed changes, as described by the summary, touch only src/clientdlg.cpp (+20 lines, eventFilter installation and handler) and src/clientdlg.h (one eventFilter declaration). Both serve the chat-hidden focus fix for #3994. The summary lists no palette, dialog, or other unrelated edits. The #3999 palette fix is described as separate and is not present in this PR's described changes. Limitation: the full diff could not be read, so the complete file list and hunk contents are confirmed only by the summary.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • 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: feaf101d-eba8-4a21-a7e7-a94ee2fa4d0f
Commits

Reviewing files that changed from the base of the PR and between 2442abc and d22828f.

Files selected for processing: 2

  • src/clientdlg.cpp
  • src/clientdlg.h

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

@ann0see ann0see mentioned this pull request Nov 15, 2026
6 of 16 tasks
@ann0see
ann0see marked this pull request as draft November 15, 2026 20:02
@ann0see ann0see added the iOS iOS runtime issue label Nov 15, 2026
@ann0see

ann0see commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

iOS dropping the key window and Qt resolving the palette from the default appearance — is worth a Qt bug report on its own.

Probably yes, however I do not really trust that Qt will implement this...

@ann0see ann0see added this to Tracking Nov 15, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Nov 15, 2026
@ann0see ann0see moved this from Triage to Backlog in Tracking Nov 15, 2026
@ann0see ann0see added this to the Release 4.0.0 milestone Nov 15, 2026
@ann0see

ann0see commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

Not a severe bug, only slightly annoying. May or may not warrant a back port...

Comment thread src/clientdlg.cpp
}

// Connections -------------------------------------------------------------
// react to the chat window being hidden, see eventFilter()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Probably also ifdef for iOS only

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

Labels

AI AI generated or potentially AI generated iOS iOS runtime issue

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

AI bug findings for iOS

1 participant