ScrollableToolbar
Horizontally scrollable container for toolbar-like widgets.
| Declared in | src/libs/libwidgets/components/ScrollableToolbar.hpp |
| Inherits | QWidget |
| Group | widgets |
Detailed description
ScrollableToolbar hosts a horizontal row of child widgets (buttons, separators, combo boxes, labels, etc.) inside a QScrollArea. The scrollbar appears only when the content exceeds the available width — so on wide windows the toolbar looks like a conventional QHBoxLayout-backed toolbar, and on narrow windows (e.g. a phone in portrait orientation) the user can swipe horizontally to reach off-screen items rather than seeing them truncated or clipped.
This encapsulates the pattern originally implemented in Banter's BanterBusWidget; it's used there as well as in ConstructShell's top toolbar.
Basic Usage
auto *bar = new ScrollableToolbar(this);
bar->addWidget(openBtn);
bar->addWidget(saveBtn);
bar->addSeparator();
bar->addWidget(shadingCombo);
bar->addStretch();
bar->addWidget(fpsLabel);