1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibGUI: Convert GTreeView to ObjectPtr

This commit is contained in:
Andreas Kling 2019-09-21 16:06:43 +02:00
parent e7b55037f4
commit efb8f9d538
3 changed files with 4 additions and 3 deletions

View file

@ -59,7 +59,7 @@ int main(int argc, char** argv)
auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar); auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar);
auto* splitter = new GSplitter(Orientation::Horizontal, widget); auto* splitter = new GSplitter(Orientation::Horizontal, widget);
auto* tree_view = new GTreeView(splitter); auto tree_view = GTreeView::construct(splitter);
auto file_system_model = GFileSystemModel::create("/", GFileSystemModel::Mode::DirectoriesOnly); auto file_system_model = GFileSystemModel::create("/", GFileSystemModel::Mode::DirectoriesOnly);
tree_view->set_model(file_system_model); tree_view->set_model(file_system_model);
tree_view->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill); tree_view->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);

View file

@ -46,7 +46,7 @@ int main(int argc, char** argv)
window->set_title(String::format("Inspector: %s (%d)", remote_process.process_name().characters(), remote_process.pid())); window->set_title(String::format("Inspector: %s (%d)", remote_process.process_name().characters(), remote_process.pid()));
}; };
auto* tree_view = new GTreeView(splitter); auto tree_view = GTreeView::construct(splitter);
tree_view->set_model(remote_process.object_graph_model()); tree_view->set_model(remote_process.object_graph_model());
tree_view->set_activates_on_selection(true); tree_view->set_activates_on_selection(true);

View file

@ -5,12 +5,13 @@
class GTreeView : public GAbstractView { class GTreeView : public GAbstractView {
C_OBJECT(GTreeView) C_OBJECT(GTreeView)
public: public:
explicit GTreeView(GWidget*);
virtual ~GTreeView() override; virtual ~GTreeView() override;
virtual void scroll_into_view(const GModelIndex&, Orientation); virtual void scroll_into_view(const GModelIndex&, Orientation);
protected: protected:
explicit GTreeView(GWidget*);
virtual void paint_event(GPaintEvent&) override; virtual void paint_event(GPaintEvent&) override;
virtual void mousedown_event(GMouseEvent&) override; virtual void mousedown_event(GMouseEvent&) override;
virtual void doubleclick_event(GMouseEvent&) override; virtual void doubleclick_event(GMouseEvent&) override;