summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibGUI/GModel.cpp12
-rw-r--r--Libraries/LibGUI/GModel.h4
-rw-r--r--Libraries/LibGUI/GSortingProxyModel.cpp12
3 files changed, 0 insertions, 28 deletions
diff --git a/Libraries/LibGUI/GModel.cpp b/Libraries/LibGUI/GModel.cpp
index e6cbc03af9..d1c4e94d35 100644
--- a/Libraries/LibGUI/GModel.cpp
+++ b/Libraries/LibGUI/GModel.cpp
@@ -34,18 +34,6 @@ void GModel::did_update()
});
}
-void GModel::set_selected_index(const GModelIndex& index)
-{
- if (m_selected_index == index)
- return;
- m_selected_index = index;
- if (on_selection_changed)
- on_selection_changed(index);
- for_each_view([](auto& view) {
- view.did_update_selection();
- });
-}
-
GModelIndex GModel::create_index(int row, int column, const void* data) const
{
return GModelIndex(*this, row, column, const_cast<void*>(data));
diff --git a/Libraries/LibGUI/GModel.h b/Libraries/LibGUI/GModel.h
index 8824f42a0e..05ab64a83c 100644
--- a/Libraries/LibGUI/GModel.h
+++ b/Libraries/LibGUI/GModel.h
@@ -57,9 +57,6 @@ public:
return index.row() >= 0 && index.row() < row_count() && index.column() >= 0 && index.column() < column_count();
}
- void set_selected_index(const GModelIndex&);
- GModelIndex selected_index() const { return m_selected_index; }
-
virtual int key_column() const { return -1; }
virtual GSortOrder sort_order() const { return GSortOrder::None; }
virtual void set_key_column_and_sort_order(int, GSortOrder) {}
@@ -80,7 +77,6 @@ protected:
private:
HashTable<GAbstractView*> m_views;
- GModelIndex m_selected_index;
};
inline GModelIndex GModelIndex::parent() const
diff --git a/Libraries/LibGUI/GSortingProxyModel.cpp b/Libraries/LibGUI/GSortingProxyModel.cpp
index 17859a4c2b..3205123408 100644
--- a/Libraries/LibGUI/GSortingProxyModel.cpp
+++ b/Libraries/LibGUI/GSortingProxyModel.cpp
@@ -73,7 +73,6 @@ void GSortingProxyModel::set_key_column_and_sort_order(int column, GSortOrder so
void GSortingProxyModel::resort()
{
- int previously_selected_target_row = map_to_target(selected_index()).row();
int row_count = target().row_count();
m_row_mappings.resize(row_count);
for (int i = 0; i < row_count; ++i)
@@ -94,16 +93,5 @@ void GSortingProxyModel::resort()
is_less_than = data1 < data2;
return m_sort_order == GSortOrder::Ascending ? is_less_than : !is_less_than;
});
- if (previously_selected_target_row != -1) {
- // Preserve selection.
- ASSERT(m_row_mappings.size() == row_count);
- for (int i = 0; i < row_count; ++i) {
- if (m_row_mappings[i] == previously_selected_target_row) {
- set_selected_index(index(i, 0));
- break;
- }
- }
- }
-
did_update();
}