aboutsummaryrefslogtreecommitdiffstats
path: root/gui/infotab.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gui/infotab.cc')
-rw-r--r--gui/infotab.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/gui/infotab.cc b/gui/infotab.cc
index a5659569..7690b83c 100644
--- a/gui/infotab.cc
+++ b/gui/infotab.cc
@@ -9,6 +9,16 @@ InfoTab::InfoTab(QWidget *parent) : QWidget(parent)
f.setStyleHint(QFont::Monospace);
plainTextEdit->setFont(f);
+ plainTextEdit->setContextMenuPolicy(Qt::CustomContextMenu);
+ QAction *clearAction = new QAction("Clear &buffer", this);
+ clearAction->setStatusTip("Clears display buffer");
+ connect(clearAction, SIGNAL(triggered()), this, SLOT(clearBuffer()));
+ contextMenu = plainTextEdit->createStandardContextMenu();
+ contextMenu->addSeparator();
+ contextMenu->addAction(clearAction);
+ connect(plainTextEdit, SIGNAL(customContextMenuRequested(const QPoint)),
+ this, SLOT(showContextMenu(const QPoint)));
+
QGridLayout *mainLayout = new QGridLayout();
mainLayout->addWidget(plainTextEdit);
setLayout(mainLayout);
@@ -20,3 +30,10 @@ void InfoTab::info(std::string str)
plainTextEdit->insertPlainText(str.c_str());
plainTextEdit->moveCursor(QTextCursor::End);
}
+
+void InfoTab::showContextMenu(const QPoint &pt)
+{
+ contextMenu->exec(mapToGlobal(pt));
+}
+
+void InfoTab::clearBuffer() { plainTextEdit->clear(); }