1 | // Copyright (C) 2016 Tasuku Suzuki <stasuku@gmail.com> |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #include "logviewer.h" |
5 | |
6 | #include <QtGui/QContextMenuEvent> |
7 | #include <QtWidgets/QMenu> |
8 | |
9 | LogViewer::LogViewer(QWidget *parent) |
10 | : QTextBrowser(parent) |
11 | { |
12 | } |
13 | |
14 | void LogViewer::contextMenuEvent(QContextMenuEvent *event) |
15 | { |
16 | QMenu *menu = createStandardContextMenu(); |
17 | QAction *action = menu->addAction(text: tr(s: "Clear")); |
18 | connect(sender: action, signal: &QAction::triggered, context: this, slot: &QTextEdit::clear); |
19 | menu->exec(pos: event->globalPos()); |
20 | delete menu; |
21 | } |
22 |