Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

Summary

Fixes the issue where debugger control buttons would be hidden when the debugger sidebar was narrow, requiring users to click an overflow menu to access them. With this change, buttons automatically wrap to the next row when the sidebar width is constrained, ensuring all controls remain visible and accessible.

Problem

Previously, DebugControlsWidget inherited from QToolBar, which doesn't support automatic wrapping. When the sidebar was narrow, buttons would overflow and become hidden, making the debugger less accessible:

Narrow sidebar before:
┌──────────────────┐
│ [▶][⏸][▶▶] [▼] │  ← Overflow menu required to access hidden buttons
└──────────────────┘

Solution

Converted DebugControlsWidget from QToolBar to QWidget with a custom FlowLayout that automatically wraps buttons to additional rows when space is insufficient:

Narrow sidebar after:
┌──────────────────┐
│ [▶][⏸][▶▶][🔌]  │
│ [⏹][🔄][❌] | [↓]│  ← All buttons visible and accessible
│ [↷][↩] | [⚙]    │
└──────────────────┘

Implementation Details

New Files

  • ui/flowlayout.h / flowlayout.cpp: Custom QLayout subclass that implements automatic wrapping behavior, based on Qt's standard custom layout patterns.

Modified Files

  • ui/controlswidget.h: Changed base class from QToolBar to QWidget, added button member variables while preserving action members for keyboard shortcuts.
  • ui/controlswidget.cpp: Refactored button creation to use explicit QToolButton widgets positioned by FlowLayout, maintained all existing functionality including tooltips, icons, and state management.

Key Features

No Hidden Buttons: All controls remain visible regardless of sidebar width
Automatic Adaptation: Layout dynamically adjusts as sidebar is resized
Backward Compatible: All public interfaces, signals, and slots preserved
Keyboard Shortcuts: Continue to work through preserved QAction connections
Visual Consistency: Maintains same appearance when sidebar is wide

Testing

Manual testing should verify:

  • Buttons wrap correctly to multiple rows when sidebar is narrowed
  • All buttons remain functional (click, hover, tooltips)
  • Keyboard shortcuts continue to work
  • Button enable/disable states work correctly in all debugger states
  • Button visibility changes appropriately (e.g., TTD-specific buttons)
Original prompt

This section details on the original issue you should resolve

<issue_title>Wrap the controls button when the debugger side bar is narrow</issue_title>
<issue_description>Currently they will be hidden and show up when a button is clicked. It would be ideal if the dialog and automatically puts the buttons to the next row when it's narrow</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #891


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Created FlowLayout class for automatic button wrapping
- Changed DebugControlsWidget from QToolBar to QWidget with FlowLayout
- Updated button creation to use QToolButtons within the flow layout
- Maintained all existing functionality while enabling button wrapping

Co-authored-by: xusheng6 <[email protected]>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Wrap controls button when debugger sidebar is narrow Wrap debugger control buttons when sidebar is narrow Oct 21, 2025
Copilot AI requested a review from xusheng6 October 21, 2025 12:54
Copilot finished work on behalf of xusheng6 October 21, 2025 12:54
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.

Wrap the controls button when the debugger side bar is narrow

3 participants