mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Ladybird/Qt: Implement pasting Web data to the clipboard
This commit is contained in:
parent
9421ffd4ec
commit
6732a38cf8
Notes:
sideshowbarker
2024-07-17 08:45:34 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/6732a38cf8 Pull-request: https://github.com/SerenityOS/serenity/pull/21878
1 changed files with 11 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeData>
|
||||
#include <QPainter>
|
||||
#include <QPoint>
|
||||
#include <QResizeEvent>
|
||||
|
@ -289,6 +290,16 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
|||
m_inspector_widget->set_accessibility_json(accessibility_tree);
|
||||
};
|
||||
|
||||
view().on_insert_clipboard_entry = [](auto const& data, auto const&, auto const& mime_type) {
|
||||
QByteArray qdata { data.bytes_as_string_view().characters_without_null_termination(), static_cast<qsizetype>(data.bytes_as_string_view().length()) };
|
||||
|
||||
auto* mime_data = new QMimeData();
|
||||
mime_data->setData(qstring_from_ak_string(mime_type), qdata);
|
||||
|
||||
auto* clipboard = QGuiApplication::clipboard();
|
||||
clipboard->setMimeData(mime_data);
|
||||
};
|
||||
|
||||
auto* search_selected_text_action = new QAction("&Search for <query>", this);
|
||||
search_selected_text_action->setIcon(load_icon_from_uri("resource://icons/16x16/find.png"sv));
|
||||
QObject::connect(search_selected_text_action, &QAction::triggered, this, [this]() {
|
||||
|
|
Loading…
Reference in a new issue