libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
promeki::TuiListView Class Reference

Scrollable list of items with keyboard and mouse navigation. More...

#include <listview.h>

Inheritance diagram for promeki::TuiListView:
Collaboration diagram for promeki::TuiListView:

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
 

Detailed Description

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.

Thread Safety
Thread-affine — see TuiWidget.

Member Function Documentation

◆ ensureVisible()

void promeki::TuiListView::ensureVisible ( int  index)

Adjusts the scroll offset so that the given index is visible.

Parameters
indexThe item index to make visible.

◆ scrollBy()

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.

Parameters
deltaNumber of items to scroll (positive = down, negative = up).

The documentation for this class was generated from the following file: