diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 14:19:05 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 15:25:08 +0200 |
commit | c7437f9caa5485d99e0101bfac98d968e767741f (patch) | |
tree | 0268e791f6d419da644eca6fc6789e5429c10848 /Applications/DisplayProperties | |
parent | 6b347747f2f912721bc076fcd4aabb8a4bfa9e98 (diff) | |
download | serenity-c7437f9caa5485d99e0101bfac98d968e767741f.zip |
LibGUI: Convert GLabel to ObjectPtr
Diffstat (limited to 'Applications/DisplayProperties')
-rw-r--r-- | Applications/DisplayProperties/DisplayProperties.cpp | 8 | ||||
-rw-r--r-- | Applications/DisplayProperties/DisplayProperties.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Applications/DisplayProperties/DisplayProperties.cpp b/Applications/DisplayProperties/DisplayProperties.cpp index 12046f5113..a21caba385 100644 --- a/Applications/DisplayProperties/DisplayProperties.cpp +++ b/Applications/DisplayProperties/DisplayProperties.cpp @@ -101,19 +101,19 @@ void DisplayPropertiesWidget::create_frame() background_content->set_layout(make<GBoxLayout>(Orientation::Vertical)); background_content->layout()->set_margins({ 4, 4, 4, 4 }); - auto* wallpaper_preview = new GLabel(background_splitter); + m_wallpaper_preview = GLabel::construct(background_splitter); auto* wallpaper_list = new GListView(background_content); wallpaper_list->set_background_color(Color::White); wallpaper_list->set_model(*ItemListModel<AK::String>::create(m_wallpapers)); wallpaper_list->horizontal_scrollbar().set_visible(false); - wallpaper_list->on_selection = [this, wallpaper_preview](auto& index) { + wallpaper_list->on_selection = [this](auto& index) { StringBuilder builder; m_selected_wallpaper = m_wallpapers.at(index.row()); builder.append("/res/wallpapers/"); builder.append(m_selected_wallpaper); - wallpaper_preview->set_icon(load_png(builder.to_string())); - wallpaper_preview->set_should_stretch_icon(true); + m_wallpaper_preview->set_icon(load_png(builder.to_string())); + m_wallpaper_preview->set_should_stretch_icon(true); }; // Let's add the settings tab diff --git a/Applications/DisplayProperties/DisplayProperties.h b/Applications/DisplayProperties/DisplayProperties.h index c8c96988f1..afba1930cc 100644 --- a/Applications/DisplayProperties/DisplayProperties.h +++ b/Applications/DisplayProperties/DisplayProperties.h @@ -7,6 +7,7 @@ #include <LibDraw/Color.h> #include <LibDraw/Size.h> #include <LibGUI/GWidget.h> +#include <LibGUI/GLabel.h> class DisplayPropertiesWidget final { public: @@ -41,6 +42,7 @@ private: GWidget* m_root_widget { nullptr }; Vector<Size> m_resolutions; Vector<String> m_wallpapers; + ObjectPtr<GLabel> m_wallpaper_preview; Size m_selected_resolution; String m_selected_wallpaper; |