diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 16:03:59 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 16:03:59 +0200 |
commit | e7b55037f48b8fcddbe283598cad4ef7dcf323f5 (patch) | |
tree | a954b20046204aefd0eec325a54bd20bc57060f4 /Libraries/LibGUI | |
parent | c13b9e22144ab246355d158448a8f6111b5e0a48 (diff) | |
download | serenity-e7b55037f48b8fcddbe283598cad4ef7dcf323f5.zip |
LibGUI: Convert GTableView to ObjectPtr
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/GFilePicker.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/GFilePicker.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/GTableView.h | 5 |
3 files changed, 5 insertions, 4 deletions
diff --git a/Libraries/LibGUI/GFilePicker.cpp b/Libraries/LibGUI/GFilePicker.cpp index 7776f63179..9dd57ee8f8 100644 --- a/Libraries/LibGUI/GFilePicker.cpp +++ b/Libraries/LibGUI/GFilePicker.cpp @@ -76,7 +76,7 @@ GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringVie location_textbox->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); location_textbox->set_preferred_size(0, 20); - m_view = new GTableView(vertical_container); + m_view = GTableView::construct(vertical_container); m_view->set_model(GSortingProxyModel::create(*m_model)); m_view->set_column_hidden(GDirectoryModel::Column::Owner, true); m_view->set_column_hidden(GDirectoryModel::Column::Group, true); diff --git a/Libraries/LibGUI/GFilePicker.h b/Libraries/LibGUI/GFilePicker.h index 33bf05def1..f7862161a2 100644 --- a/Libraries/LibGUI/GFilePicker.h +++ b/Libraries/LibGUI/GFilePicker.h @@ -42,7 +42,7 @@ private: } } - GTableView* m_view { nullptr }; + ObjectPtr<GTableView> m_view; NonnullRefPtr<GDirectoryModel> m_model; FileSystemPath m_selected_file; diff --git a/Libraries/LibGUI/GTableView.h b/Libraries/LibGUI/GTableView.h index a469740cf1..f34d1c887d 100644 --- a/Libraries/LibGUI/GTableView.h +++ b/Libraries/LibGUI/GTableView.h @@ -19,7 +19,6 @@ public: class GTableView : public GAbstractView { C_OBJECT(GTableView) public: - explicit GTableView(GWidget* parent); virtual ~GTableView() override; int header_height() const { return m_headers_visible ? 16 : 0; } @@ -48,7 +47,9 @@ public: void set_cell_painting_delegate(int column, OwnPtr<GTableCellPaintingDelegate>&&); -private: +protected: + explicit GTableView(GWidget* parent); + virtual void did_update_model() override; virtual void paint_event(GPaintEvent&) override; virtual void mousedown_event(GMouseEvent&) override; |