Skip to content

qt menus float as one surface; composer buttons are the input box's height - #2118

Closed
trissim wants to merge 1 commit into
mainfrom
fork-qt-menu-float-send-button
Closed

trissim wants to merge 1 commit into
mainfrom
fork-qt-menu-float-send-button

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

Tristan, on the phone: "The menu pop-up pushes things instead of floating, and it looks really atrocious: a box in a box in a box … instead of minimal and clean. And make the send button a little bigger: the same height as the input box, so they're aligned."

What was wrong (main, phone profile 412×915, offscreen)

  • The menu pushed the page. QtMenu was added to the window's chrome layout above the bar. Opening the app menu changed 121,308 pixels outside the menu: the conversation and the sidebar moved up.
  • Triple box. The menu's chrome frame, then each row drawn as a styled button box, then the key column as a second box inside the row.
  • An outside tap left it open.
  • The sort choice used a QMenu: a second, top-level pop-up, which is the EGL hazard on Android.
  • The Send button was shorter than the input box (about 26 px against 43).

What changed

  • One pop-up owner, QtMenu, floating. It's a child of the window in no layout, placed at the anchor it was asked from: under it, or above it where there's more room. It covers the application menu (under ≡), a message's menu (at the pressed row), a sidebar row's held menu (at the pressed point), the bus-connect choices (top), and a sort choice (under its button). Callers pass the anchor in the window's coordinates (offer_entries(entries, anchor); block_menu_requested now carries the pressed point).
  • Dismissal.
    • A tap outside closes it and does nothing else: the press and its release are eaten.
    • Escape closes it ahead of any shortcut bound to Escape, by accepting the ShortcutOverride while open.
    • Back closes it through go_back, as before.
    • The app-wide event filter is installed only while the menu is open, or until it eats the outside tap's release.
  • Not a top-level window. It's still a child widget, so it adds no second EGL surface. Quitting with it open is covered by the drive.
  • One surface.
    • Background: the theme's float tone. Border: one RuleColour line (radius 6). There's no shadow.
    • Rows are flat at touch height (48 on touch), with the float hover tone and muted descriptions. The per-row button boxes and the chrome frame are gone.
    • Width: the window's width up to 420 px, with rows eliding inside. It scrolls only when its rows don't fit.
  • The sort choice lists its orders and its toggles in the same menu, under its button. The unused QMenu/QAction imports in thread_comms_panel.py are deleted.
  • Composer buttons. Composer.fit_buttons: every button in the box's row is the box's one-line height (editor one-line height + box padding + border) and at least as wide. Each is bottom-aligned, so it's level with a one-line box and pinned to the bottom of a taller one. A button another composer adds to that row, such as the file picker's Attach, gets the same sizing.

Depends on

The contrast fork's ui_theme roles: FloatToneColour, FloatHoverToneColour, RuleColour (and MutedColour). Rollout: ui-theme, then pyqt-reactive, then the runtime rebuild, then this PR. Every local run here put that branch's ui_theme first on the path. check.sh ran on a scratch copy of the installed runtime with that ui_theme in its site-packages.

Evidence: qt_drive.py menu_float

Phone profile, #comms on the live bus. Main vs branch:

step main branch
app menu open: pixels changed outside it 121,308 0
outside tap closes it stays open closes; the tab and page are unchanged
Escape closes it closes closes
message menu (right-click on a row) — at the pressed row, 0 pixels moved
sort menu QMenu pop-up under/over its button, 0 pixels moved
Send button, 1 line shorter than the box 43 px = box 43 px, bottoms level
Send button, 3 lines — 43 px, bottom = box bottom (box 77 px)
quit with the menu open — exit 0, no error files

I read the screenshots of main and the branch. On main the menu sits inside the bottom chrome with a button box per row and the conversation pushed up. On the branch it's one full-width rounded surface over the content with flat rows, and the page underneath is unchanged.

Gates, once on the final head

  • ratchet: Textual-UI modules 11/11, widgets imports 0, bare Qt classes 21/21, copies 0
  • shadow_check: 0
  • glyph_check: 0
  • tools/android/check.sh with PYTHONFAULTHANDLER=1: rc 0. The shipped app ran every view kind and bound key on a scratch bus, with no fatal error or traceback.
  • drives: menu, chrome, feedback and menu_float all exit 0, with 0 error files and 0 tracebacks.

Expect to rebase over

  • The file picker (fork-android-file-picker-2) adds Attach to the composer's box row. fit_buttons already sizes it, and the likely conflict is the frame_row lines in Composer.__init__.
  • The stall fork defers the composer's construction.
  • The contrast fork owns the role colours.
  • history.py: only the block_menu_requested signal and its emit changed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

…eight

Every pop-up Toad opens (the application menu, a message's and a sidebar row's
menu, the bus-connect choices, a sort choice) is the window's one QtMenu. It is
a child of the window in no layout, placed at the anchor it was asked from
(under it, or above it where there is no room below), so opening or closing it
moves nothing underneath. A tap outside closes it and does nothing else (the
press and its release are eaten); Escape closes it ahead of any shortcut bound
to Escape; Back closes it through go_back. The sort choice's QMenu (a top-level
popup window, the EGL hazard on Android) is gone; it lists its choices in the
same menu under its button.

The menu is one surface: the float tone, one rule-coloured border, flat rows
with the float hover tone and muted descriptions. The per-row button boxes and
the chrome frame around it are gone. It is the window's width up to 420 px and
scrolls only when its rows do not fit.

Every button in the composer's box row is the box's one-line height, pinned to
the bottom of a taller box (Composer.fit_buttons).

tools/qt_drive.py menu_float checks each menu changes no pixel outside it, the
outside tap and Escape, the anchors, the composer's button, and quits with the
menu open.

Depends on the contrast fork's ui_theme roles (FloatToneColour,
FloatHoverToneColour, RuleColour).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim

trissim commented Nov 18, 2026

Copy link
Copy Markdown
Author

Merged as part of #2130: this branch was rebased onto main and gated together with the other UI branches, since they edit the same lines.

@trissim trissim closed this Nov 18, 2026
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.

1 participant