diff options
author | Hüseyin ASLITÜRK <asliturk@hotmail.com> | 2020-06-13 01:25:01 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-18 16:35:57 +0200 |
commit | 56e82a2c07a0ad429d9bb08776c3b5cc11108f94 (patch) | |
tree | 829524c946b6986bba87175ae0f4d188714c2724 /Libraries/LibGUI | |
parent | 02eb268c3edd9c4ee3bffa43cb768f5f533aa043 (diff) | |
download | serenity-56e82a2c07a0ad429d9bb08776c3b5cc11108f94.zip |
FilePicker: Replace Label with Image component to show icons
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/FilePicker.cpp | 10 | ||||
-rw-r--r-- | Libraries/LibGUI/FilePicker.h | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Libraries/LibGUI/FilePicker.cpp b/Libraries/LibGUI/FilePicker.cpp index 591699d4bb..d9582dd681 100644 --- a/Libraries/LibGUI/FilePicker.cpp +++ b/Libraries/LibGUI/FilePicker.cpp @@ -248,8 +248,8 @@ FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView& preview_container.set_layout<VerticalBoxLayout>(); preview_container.layout()->set_margins({ 8, 8, 8, 8 }); - m_preview_image_label = preview_container.add<Label>(); - m_preview_image_label->set_should_stretch_icon(true); + m_preview_image_label = preview_container.add<Image>(); + m_preview_image_label->set_should_stretch(true); m_preview_image_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed); m_preview_image_label->set_preferred_size(160, 160); @@ -278,14 +278,14 @@ void FilePicker::set_preview(const LexicalPath& path) bool should_stretch = bitmap->width() > m_preview_image_label->width() || bitmap->height() > m_preview_image_label->height(); m_preview_name_label->set_text(path.basename()); m_preview_geometry_label->set_text(bitmap->size().to_string()); - m_preview_image_label->set_should_stretch_icon(should_stretch); - m_preview_image_label->set_icon(move(bitmap)); + m_preview_image_label->set_should_stretch(should_stretch); + m_preview_image_label->set_bitmap(move(bitmap)); } } void FilePicker::clear_preview() { - m_preview_image_label->set_icon(nullptr); + m_preview_image_label->set_bitmap(nullptr); m_preview_name_label->set_text(String::empty()); m_preview_geometry_label->set_text(String::empty()); } diff --git a/Libraries/LibGUI/FilePicker.h b/Libraries/LibGUI/FilePicker.h index bdcbfa9aa6..3bdf78cafd 100644 --- a/Libraries/LibGUI/FilePicker.h +++ b/Libraries/LibGUI/FilePicker.h @@ -30,6 +30,7 @@ #include <AK/Optional.h> #include <LibCore/StandardPaths.h> #include <LibGUI/Dialog.h> +#include <LibGUI/Image.h> namespace GUI { @@ -73,7 +74,7 @@ private: LexicalPath m_selected_file; RefPtr<TextBox> m_filename_textbox; - RefPtr<Label> m_preview_image_label; + RefPtr<Image> m_preview_image_label; RefPtr<Label> m_preview_name_label; RefPtr<Label> m_preview_geometry_label; Mode m_mode { Mode::Open }; |