Simplify Models panel and dialog layout

Models panel: replace the manual resizeEvent column-sizing hack with
QHeaderView Stretch/Fixed modes, re-applied via sectionCountChanged so
they survive the model rebuilds that QHeaderView resets them on.

Dialog: only wrap the body in a QScrollArea when scrollable, mirroring
Panel. The scroll area caps its sizeHint at 36x24 cells, which turned
wide fixed-size dialog content into spurious scrollbars.

Add Model dialog: reserve a stable, font-metrics-measured height for the
hover description so longer text never reflows the buttons; regroup the
buttons into LOCAL / CLOUD / TOOLS.

Buttons: move the trailing-separator decision out of makeButtonGroup
into a new addButtonGroups row builder, so the last group in a row
never draws a dangling divider.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-20 20:56:19 +10:00
parent 19bff92a47
commit 96941463c0
9 changed files with 155 additions and 118 deletions
+6 -1
View File
@@ -23,6 +23,7 @@
#include <QList>
class QBoxLayout;
class QToolButton;
class QWidget;
@@ -35,9 +36,13 @@ QToolButton* makeButton(const QString& text,
QWidget* makeButtonGroup(const QString& title,
const QList<QToolButton*>& buttons,
QWidget* parent,
bool trailing_separator = true,
int vertical_spacing = 4);
// Adds button groups to a ribbon row, drawing a vertical divider between
// adjacent groups but never after the last one. Centralising the decision
// here means a row can't end up with a dangling trailing separator.
void addButtonGroups(QBoxLayout* row, const QList<QWidget*>& groups);
} // namespace bonsaiviewer::components::buttons
#endif