debugger icon indicating copy to clipboard operation
debugger copied to clipboard

Wrap debugger control buttons when sidebar is narrow

Open Copilot opened this issue 1 month ago • 1 comments

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 Vector35/debugger#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.

Copilot avatar Oct 21 '25 12:10 Copilot

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.

CLAassistant avatar Oct 21 '25 12:10 CLAassistant