diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-06-20 12:58:08 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-06-20 12:58:08 +0200 |
commit | 37f7802c6cfb9d9612e595c9914704c5403db9df (patch) | |
tree | 491fcb456e88524adec3eda9be1b918080d2c834 /gui/infotab.cc | |
parent | 7c3593ea5acef05546be8835e25cf5e4b18549ee (diff) | |
parent | 6d2f058f678761e90fc451af48f4e0ed0f504603 (diff) | |
download | nextpnr-37f7802c6cfb9d9612e595c9914704c5403db9df.tar.gz nextpnr-37f7802c6cfb9d9612e595c9914704c5403db9df.tar.bz2 nextpnr-37f7802c6cfb9d9612e595c9914704c5403db9df.zip |
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'gui/infotab.cc')
-rw-r--r-- | gui/infotab.cc | 17 |
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(); }
|