mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
Qt: add "clear" option to tty log contextmenu
This commit is contained in:
parent
b3efa75206
commit
34a6085cc0
2 changed files with 12 additions and 0 deletions
|
@ -112,6 +112,7 @@ log_frame::log_frame(std::shared_ptr<gui_settings> guiSettings, QWidget *parent)
|
|||
m_tty = new QTextEdit(tabWidget);
|
||||
m_tty->setObjectName("tty_frame");
|
||||
m_tty->setReadOnly(true);
|
||||
m_tty->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
tabWidget->addTab(m_log, tr("Log"));
|
||||
tabWidget->addTab(m_tty, tr("TTY"));
|
||||
|
@ -199,6 +200,9 @@ void log_frame::CreateAndConnectActions()
|
|||
m_clearAct = new QAction(tr("Clear"), this);
|
||||
connect(m_clearAct, &QAction::triggered, m_log, &QTextEdit::clear);
|
||||
|
||||
m_clearTTYAct = new QAction(tr("Clear"), this);
|
||||
connect(m_clearTTYAct, &QAction::triggered, m_tty, &QTextEdit::clear);
|
||||
|
||||
// Action groups make these actions mutually exclusive.
|
||||
m_logLevels = new QActionGroup(this);
|
||||
m_nothingAct = new QAction(tr("Nothing"), m_logLevels);
|
||||
|
@ -248,6 +252,13 @@ void log_frame::CreateAndConnectActions()
|
|||
menu->exec(mapToGlobal(pos));
|
||||
});
|
||||
|
||||
connect(m_tty, &QWidget::customContextMenuRequested, [=](const QPoint& pos)
|
||||
{
|
||||
QMenu* menu = m_tty->createStandardContextMenu();
|
||||
menu->addAction(m_clearTTYAct);
|
||||
menu->exec(mapToGlobal(pos));
|
||||
});
|
||||
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ private:
|
|||
fs::file m_tty_file;
|
||||
|
||||
QAction* m_clearAct;
|
||||
QAction* m_clearTTYAct;
|
||||
|
||||
QActionGroup* m_logLevels;
|
||||
QAction* m_nothingAct;
|
||||
|
|
Loading…
Add table
Reference in a new issue