diff options
author | David Shah <davey1576@gmail.com> | 2018-06-20 13:01:30 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-20 13:01:30 +0200 |
commit | c667f640d50b8b6ac7c3c3a25f0990c1ba522ae3 (patch) | |
tree | 99d69744331bbfed7627c2bd792abe0a0251b7da /gui/pythontab.cc | |
parent | 4648d3bc839f1c8458d3b96bc572774600eaa33f (diff) | |
parent | 37f7802c6cfb9d9612e595c9914704c5403db9df (diff) | |
download | nextpnr-c667f640d50b8b6ac7c3c3a25f0990c1ba522ae3.tar.gz nextpnr-c667f640d50b8b6ac7c3c3a25f0990c1ba522ae3.tar.bz2 nextpnr-c667f640d50b8b6ac7c3c3a25f0990c1ba522ae3.zip |
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'gui/pythontab.cc')
-rw-r--r-- | gui/pythontab.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gui/pythontab.cc b/gui/pythontab.cc index 04db056d..96a6c4b9 100644 --- a/gui/pythontab.cc +++ b/gui/pythontab.cc @@ -15,6 +15,16 @@ PythonTab::PythonTab(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)));
+
lineEdit = new LineEditor();
lineEdit->setMinimumHeight(30);
lineEdit->setMaximumHeight(30);
@@ -98,3 +108,10 @@ void PythonTab::editLineReturnPressed(QString text) print(std::string(">>> " + input + "\n"));
int error = executePython(input);
}
+
+void PythonTab::showContextMenu(const QPoint &pt)
+{
+ contextMenu->exec(mapToGlobal(pt));
+}
+
+void PythonTab::clearBuffer() { plainTextEdit->clear(); }
\ No newline at end of file |