UI: Remove redundant view reference in view items
The new view item base class already holds a reference to the view, no need to have one in the derived class as well.
This commit is contained in:
@@ -36,8 +36,6 @@ class AbstractGridViewItem : public AbstractViewItem {
|
||||
friend class AbstractGridView;
|
||||
friend class GridViewLayoutBuilder;
|
||||
|
||||
const AbstractGridView *view_;
|
||||
|
||||
protected:
|
||||
/** Reference to a string that uniquely identifies this item in the view. */
|
||||
StringRef identifier_{};
|
||||
|
||||
@@ -29,8 +29,6 @@ AbstractGridViewItem &AbstractGridView::add_item(std::unique_ptr<AbstractGridVie
|
||||
items_.append(std::move(item));
|
||||
|
||||
AbstractGridViewItem &added_item = *items_.last();
|
||||
added_item.view_ = this;
|
||||
|
||||
item_map_.add(added_item.identifier_, &added_item);
|
||||
register_item(added_item);
|
||||
|
||||
@@ -181,7 +179,7 @@ const AbstractGridView &AbstractGridViewItem::get_view() const
|
||||
throw std::runtime_error(
|
||||
"Invalid state, item must be added through AbstractGridView::add_item()");
|
||||
}
|
||||
return *view_;
|
||||
return dynamic_cast<AbstractGridView &>(*view_);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user