RADLib
RADical C++ application framework
RADUi::StringListModel Class Reference

Simple string-list state model for list views and combo boxes. More...

#include <RADWidgets.h>

+ Inheritance diagram for RADUi::StringListModel:
+ Collaboration diagram for RADUi::StringListModel:

Public Member Functions

size_t rowCount () const
 Returns the number of list rows. More...
 
bool empty () const
 Returns true when no values are stored. More...
 
const std::string & at (size_t index) const
 Returns value at index. More...
 
std::vector< std::string > values () const
 Returns a copy of all values. More...
 
void append (std::string value)
 Appends one value and emits changed. More...
 
void set (size_t index, std::string value)
 Replaces value at index and emits changed. More...
 
void remove (size_t index)
 Removes value at index and emits changed. More...
 
void clear ()
 Removes all values and emits changed. More...
 
- Public Member Functions inherited from RADCore::RADObject
 RADObject ()
 Creates a RADObject bound to the current thread. More...
 
virtual ~RADObject ()
 Disconnects tracked event links and releases lifetime token. More...
 
void registerLink (const ConnectionRecord &record)
 Registers a connection for cleanup when this object is destroyed. More...
 
std::thread::id threadId () const
 Returns the thread id this object is currently associated with. More...
 
EventLoopassociatedEventLoop () const
 Returns the associated event loop, if any. More...
 
ThreadAffinity threadAffinity () const
 Returns both thread id and associated loop atomically. More...
 
std::weak_ptr< void > lifetimeToken () const
 Returns a weak token used to drop queued callbacks after destruction. More...
 
void moveToThread (std::thread::id tId, EventLoop *loop=nullptr)
 Moves the object's affinity to tId and optional loop. More...
 

Public Attributes

RADCore::Event< void() > changed
 Raised when list contents change. More...
 

Detailed Description

Simple string-list state model for list views and combo boxes.

Member Function Documentation

◆ append()

void RADUi::StringListModel::append ( std::string  value)

Appends one value and emits changed.

◆ at()

const std::string& RADUi::StringListModel::at ( size_t  index) const

Returns value at index.

◆ clear()

void RADUi::StringListModel::clear ( )

Removes all values and emits changed.

◆ empty()

bool RADUi::StringListModel::empty ( ) const

Returns true when no values are stored.

◆ remove()

void RADUi::StringListModel::remove ( size_t  index)

Removes value at index and emits changed.

◆ rowCount()

size_t RADUi::StringListModel::rowCount ( ) const

Returns the number of list rows.

◆ set()

void RADUi::StringListModel::set ( size_t  index,
std::string  value 
)

Replaces value at index and emits changed.

◆ values()

std::vector<std::string> RADUi::StringListModel::values ( ) const

Returns a copy of all values.

Member Data Documentation

◆ changed

RADCore::Event<void () > RADUi::StringListModel::changed

Raised when list contents change.


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