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
Notes: sideshowbarker 2024-07-19 02:54:33 +09:00

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();