Replies: 3 comments
-
|
No comment on the code/classdesign but the overall design concept and GUI mockup screenshots look great to me. This has been talked about and requested before via the following issues (and possibly elsewhere too): May I also suggest:
p.s. If it were me id just go ahead and create the PR at this stage (this is a previously requested feature, its seems that you have already put considerable effort into it and you have code) |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for the references — good to know this has been requested before. Regarding the suggestions:
Will go ahead and submit the PR. |
Beta Was this translation helpful? Give feedback.
-
|
Implementation is now ready as a PR #24309 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
While working on PR #24090 (Add
Open Destination Folderbutton to toolbar), a recurring theme emerged in the review: disagreement about where buttons should be positioned. @stalkerok suggested one position, @Chocobo1 another, @cocopaw raised menu-order conventions. All valid perspectives — but the underlying issue is that qBittorrent's toolbar is entirely hardcoded with no user control whatsoever.If users could arrange the toolbar themselves, these debates become irrelevant. This discussion proposes a toolbar customization feature.
Proposed Features
1. Drag to reorder buttons (Core)
Left-click and drag any toolbar button to reposition it. A floating preview follows the cursor (constrained to the toolbar), the original button vanish as soon as the drag start, and a drop indicator line shows the insertion point. On release the button is placed at the closest position.
2. Show/Hide buttons (High priority)
Right-clicking on the empty toolbar area extends the existing context menu with a "Show/Hide Buttons" submenu — one checkbox per button. Includes a "Reset to Default" option at the top.
3. Separator management (Medium priority)
Right-clicking on a specific toolbar button shows a context-aware menu:
4. Persistence
All changes are saved immediately to
PreferencesunderMainWindow/toolbarStateand restored on startup.Implementation Approach
A new class
CustomizableToolBarsubclassesQToolBar. This is the cleanest Qt pattern —QToolBar's child buttons areQToolButtonwidgets that consume mouse events before the toolbar sees them, so the only clean interception point is via event filters installed on each child widget throughactionEvent, which is most naturally done in a subclass.Event filters are installed on each button widget as it is added to the toolbar via
actionEvent:Fixed widgets (spacer, column filter, Lock) are protected via
lockAction():Considered
QDragbut rejected it — it propagates drop events to any widget under the cursor, causing unintended actions (e.g. releasing over the torrent list triggered Torrent Creator). The custom mouse-event approach keeps drag entirely within the toolbar.Qt's built-in
QMainWindow::saveState()was considered for persistence but only handles toolbar docking, not action order or visibility. Custom serialization was necessary.Files changed:
src/gui/customizabletoolbar.h/.cppsrc/gui/mainwindow.h/.cpp/.uisrc/gui/CMakeLists.txtsrc/base/preferences.h/.cppIf this is a direction the project would consider I'm ready to submit a PR if there's interest. Also open to feedback on the implementation approach.
Beta Was this translation helpful? Give feedback.
All reactions