1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:48:11 +00:00

QuickShow: Allow copying the current bitmap to the clipboard :^)

This commit is contained in:
Andreas Kling 2020-09-05 16:53:30 +02:00
parent 158f3b9362
commit 00bdb74c84

View file

@ -32,6 +32,7 @@
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Clipboard.h>
#include <LibGUI/Desktop.h>
#include <LibGUI/FilePicker.h>
#include <LibGUI/Label.h>
@ -249,6 +250,11 @@ int main(int argc, char** argv)
GUI::AboutDialog::show("QuickShow", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-image.png"), window);
});
auto copy_action = GUI::CommonActions::make_copy_action([&](auto&) {
if (widget.bitmap())
GUI::Clipboard::the().set_bitmap(*widget.bitmap());
});
main_toolbar.add_action(open_action);
main_toolbar.add_action(delete_action);
main_toolbar.add_separator();