summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Applications/FileManager/DirectoryView.cpp2
-rw-r--r--Libraries/LibGUI/ColumnsView.cpp4
-rw-r--r--Libraries/LibGUI/Model.cpp10
-rw-r--r--Libraries/LibGUI/Model.h1
-rw-r--r--Libraries/LibGUI/TreeView.cpp2
5 files changed, 4 insertions, 15 deletions
diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp
index 2226ded8bc..a48a9ff8a1 100644
--- a/Applications/FileManager/DirectoryView.cpp
+++ b/Applications/FileManager/DirectoryView.cpp
@@ -325,7 +325,7 @@ void DirectoryView::update_statusbar()
current_view().selection().for_each_index([&](auto& index) {
auto& model = *current_view().model();
- auto size_index = model.sibling(index.row(), GUI::FileSystemModel::Column::Size, model.parent_index(index));
+ auto size_index = model.index(index.row(), GUI::FileSystemModel::Column::Size, model.parent_index(index));
auto file_size = model.data(size_index).to_i32();
selected_byte_count += file_size;
});
diff --git a/Libraries/LibGUI/ColumnsView.cpp b/Libraries/LibGUI/ColumnsView.cpp
index 29a2ca9117..ffc1e63cbf 100644
--- a/Libraries/LibGUI/ColumnsView.cpp
+++ b/Libraries/LibGUI/ColumnsView.cpp
@@ -289,7 +289,7 @@ void ColumnsView::keydown_event(KeyEvent& event)
auto old_index = selection().first();
auto parent_index = model.parent_index(old_index);
int row = old_index.row() > 0 ? old_index.row() - 1 : 0;
- new_index = model.sibling(row, old_index.column(), parent_index);
+ new_index = model.index(row, old_index.column(), parent_index);
} else {
new_index = model.index(0, m_model_column, {});
}
@@ -306,7 +306,7 @@ void ColumnsView::keydown_event(KeyEvent& event)
auto old_index = selection().first();
auto parent_index = model.parent_index(old_index);
int row = old_index.row() + 1;
- new_index = model.sibling(row, old_index.column(), parent_index);
+ new_index = model.index(row, old_index.column(), parent_index);
} else {
new_index = model.index(0, m_model_column, {});
}
diff --git a/Libraries/LibGUI/Model.cpp b/Libraries/LibGUI/Model.cpp
index 6ed496e551..a47e462521 100644
--- a/Libraries/LibGUI/Model.cpp
+++ b/Libraries/LibGUI/Model.cpp
@@ -73,16 +73,6 @@ ModelIndex Model::index(int row, int column, const ModelIndex&) const
return create_index(row, column);
}
-ModelIndex Model::sibling(int row, int column, const ModelIndex& parent) const
-{
- if (!parent.is_valid())
- return index(row, column, {});
- int row_count = this->row_count(parent);
- if (row < 0 || row > row_count)
- return {};
- return index(row, column, parent);
-}
-
bool Model::accepts_drag(const ModelIndex&, const StringView&)
{
return false;
diff --git a/Libraries/LibGUI/Model.h b/Libraries/LibGUI/Model.h
index c9404dc46a..0d647e32e7 100644
--- a/Libraries/LibGUI/Model.h
+++ b/Libraries/LibGUI/Model.h
@@ -81,7 +81,6 @@ public:
virtual void update() = 0;
virtual ModelIndex parent_index(const ModelIndex&) const { return {}; }
virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const;
- virtual ModelIndex sibling(int row, int column, const ModelIndex& parent) const;
virtual bool is_editable(const ModelIndex&) const { return false; }
virtual void set_data(const ModelIndex&, const Variant&) { }
virtual int tree_column() const { return 0; }
diff --git a/Libraries/LibGUI/TreeView.cpp b/Libraries/LibGUI/TreeView.cpp
index 8411332c73..63f23156db 100644
--- a/Libraries/LibGUI/TreeView.cpp
+++ b/Libraries/LibGUI/TreeView.cpp
@@ -288,7 +288,7 @@ void TreeView::paint_event(PaintEvent& event)
if (column_index != tree_column) {
Gfx::IntRect cell_rect(horizontal_padding() + x_offset, rect.y(), column_width, item_height());
- auto cell_index = model.sibling(index.row(), column_index, index.parent());
+ auto cell_index = model.index(index.row(), column_index, index.parent());
if (auto* delegate = column_data(column_index).cell_painting_delegate.ptr()) {
delegate->paint(painter, cell_rect, palette(), model, cell_index);