Scrollable list of items with keyboard and mouse navigation. More...
#include <listview.h>


Public Member Functions | |
| TuiListView (ObjectBase *parent=nullptr) | |
| void | addItem (const String &item) |
| void | insertItem (int index, const String &item) |
| void | setItems (const StringList &items) |
| void | clear () |
| int | currentIndex () const |
| void | setCurrentIndex (int index) |
| String | currentItem () const |
| int | count () const |
| int | scrollOffset () const |
| Returns the current scroll offset. | |
| void | scrollBy (int delta) |
| Scrolls the viewport by the given number of items. | |
| void | ensureVisible (int index) |
| Adjusts the scroll offset so that the given index is visible. | |
| Size2Di32 | sizeHint () const override |
Public Member Functions inherited from promeki::TuiWidget | |
| TuiWidget (ObjectBase *parent=nullptr) | |
| Constructs a TuiWidget. | |
| ~TuiWidget () override | |
| Destructor. | |
| void | update () override |
| Marks the widget as needing a repaint. | |
Protected Member Functions | |
| void | paintEvent (PaintEvent *e) override |
| void | keyPressEvent (KeyEvent *e) override |
| void | mouseEvent (MouseEvent *e) override |
Scrollable list of items with keyboard and mouse navigation.
Supports single selection via keyboard (Up/Down/PageUp/PageDown/Home/End) and mouse (click to select, double-click to activate). Mouse wheel and scrollbar interaction scroll the viewport independently of the selection. The Enter key activates the current item via the itemActivated signal.
| void promeki::TuiListView::ensureVisible | ( | int | index | ) |
Adjusts the scroll offset so that the given index is visible.
| index | The item index to make visible. |
| void promeki::TuiListView::scrollBy | ( | int | delta | ) |
Scrolls the viewport by the given number of items.
Moves only the viewport scroll offset without changing the current selection (following Qt convention). The current index may end up off-screen after scrolling; use ensureVisible() to bring it back into view if needed.
| delta | Number of items to scroll (positive = down, negative = up). |