BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Represents the view of SessionItem's data in a single cell of ViewModel. More...
Classes | |
struct | ViewItemImpl |
Public Member Functions | |
virtual | ~ViewItem () |
void | appendRow (std::vector< std::unique_ptr< ViewItem >> items) |
Appends a row containing items. More... | |
ViewItem * | child (int row, int column) const |
std::vector< ViewItem * > | children () const |
void | clear () |
int | column () const |
Returns the column where the item is located in its parent's child table, or -1 if the item has no parent. More... | |
int | columnCount () const |
Returns the number of child item columns that the item has. More... | |
virtual QVariant | data (int qt_role) const |
Returns the data for given role according to Qt::ItemDataRole namespace definitions. More... | |
virtual Qt::ItemFlags | flags () const |
Returns Qt's item flags. More... | |
void | insertRow (int row, std::vector< std::unique_ptr< ViewItem >> items) |
Insert a row of items at index 'row'. More... | |
SessionItem * | item () const |
int | item_role () const |
ViewItem * | parent () const |
void | removeRow (int row) |
Removes row of items at given 'row'. Items will be deleted. More... | |
int | row () const |
Returns the row where the item is located in its parent's child table, or -1 if the item has no parent. More... | |
int | rowCount () const |
Returns the number of child item rows that the item has. More... | |
virtual bool | setData (const QVariant &value, int qt_role) |
Sets the data to underlying SessionItem. More... | |
Protected Member Functions | |
ViewItem (SessionItem *item, int role) | |
void | setParent (ViewItem *parent) |
Private Attributes | |
std::unique_ptr< ViewItemImpl > | p_impl |
Represents the view of SessionItem's data in a single cell of ViewModel.
Definition at line 29 of file viewitem.h.
|
virtualdefault |
|
protected |
Definition at line 105 of file viewitem.cpp.
void ViewItem::appendRow | ( | std::vector< std::unique_ptr< ViewItem >> | items | ) |
Appends a row containing items.
Number of items should be the same as columnCount() (if there are already some rows). If it is a first row, then items can be of any size.
Definition at line 128 of file viewitem.cpp.
References p_impl.
ViewItem * ViewItem::child | ( | int | row, |
int | column | ||
) | const |
Definition at line 163 of file viewitem.cpp.
References column(), p_impl, and row().
std::vector< ViewItem * > ViewItem::children | ( | ) | const |
Definition at line 237 of file viewitem.cpp.
References p_impl.
Referenced by ModelView::ViewModelController::ViewModelControllerImpl::remove_children_of_view().
void ViewItem::clear | ( | ) |
int ViewItem::column | ( | ) | const |
Returns the column where the item is located in its parent's child table, or -1 if the item has no parent.
Definition at line 190 of file viewitem.cpp.
References p_impl, and parent().
Referenced by ModelView::ViewItem::ViewItemImpl::child(), child(), and ModelView::ViewModelBase::indexFromItem().
int ViewItem::columnCount | ( | ) | const |
Returns the number of child item columns that the item has.
Definition at line 120 of file viewitem.cpp.
References p_impl.
Referenced by ModelView::ViewModelBase::columnCount().
|
virtual |
Returns the data for given role according to Qt::ItemDataRole namespace definitions.
Converts data and roles from underlying SessionItem to what Qt expects.
Reimplemented in ModelView::ViewDataItem, ModelView::ViewLabelItem, and ModelView::ViewEmptyItem.
Definition at line 199 of file viewitem.cpp.
References SessionItemUtils::ForegroundRole(), p_impl, ModelView::Utils::TextColorRole(), ModelView::Utils::ToolTipRole(), SessionItemUtils::ToolTipRole(), and ModelView::Utils::toQtVariant().
Referenced by ModelView::PropertyFlatView::PropertyFlatViewImpl::create_label(), ModelView::ViewLabelItem::data(), and ModelView::ViewDataItem::data().
|
virtual |
Returns Qt's item flags.
Converts internal SessionItem's status enable/disabled/readonly to what Qt expects.
Reimplemented in ModelView::ViewDataItem.
Definition at line 231 of file viewitem.cpp.
Referenced by ModelView::ViewDataItem::flags(), and TEST_F().
void ViewItem::insertRow | ( | int | row, |
std::vector< std::unique_ptr< ViewItem >> | items | ||
) |
SessionItem * ViewItem::item | ( | ) | const |
Definition at line 168 of file viewitem.cpp.
References p_impl.
Referenced by ModelView::PropertyFlatView::PropertyFlatViewImpl::create_label(), ModelView::ViewLabelItem::data(), ModelView::ViewDataItem::data(), ModelView::ViewModelController::ViewModelControllerImpl::findViews(), ModelView::ViewDataItem::flags(), ModelView::ViewModel::sessionItemFromIndex(), and TEST_F().
int ViewItem::item_role | ( | ) | const |
ViewItem * ViewItem::parent | ( | ) | const |
Definition at line 158 of file viewitem.cpp.
References p_impl.
Referenced by column(), ModelView::ViewModelBase::indexFromItem(), ModelView::ViewModelController::ViewModelControllerImpl::remove_row_of_views(), row(), and setParent().
void ViewItem::removeRow | ( | int | row | ) |
int ViewItem::row | ( | ) | const |
Returns the row where the item is located in its parent's child table, or -1 if the item has no parent.
Definition at line 181 of file viewitem.cpp.
References p_impl, and parent().
Referenced by ModelView::ViewItem::ViewItemImpl::child(), child(), ModelView::ViewModelBase::indexFromItem(), ModelView::ViewItem::ViewItemImpl::insertRow(), insertRow(), ModelView::ViewModelController::ViewModelControllerImpl::remove_row_of_views(), ModelView::ViewItem::ViewItemImpl::removeRow(), and removeRow().
int ViewItem::rowCount | ( | ) | const |
Returns the number of child item rows that the item has.
Definition at line 113 of file viewitem.cpp.
References p_impl.
Referenced by ModelView::ViewModelBase::rowCount().
|
virtual |
Sets the data to underlying SessionItem.
Converts data and roles from Qt definitions to what SessionItem expects.
Definition at line 221 of file viewitem.cpp.
References p_impl, and ModelView::Utils::toCustomVariant().
Referenced by TEST_F().
|
protected |
|
private |
Definition at line 71 of file viewitem.h.
Referenced by appendRow(), child(), children(), clear(), column(), columnCount(), data(), insertRow(), item(), item_role(), parent(), removeRow(), row(), rowCount(), setData(), and setParent().