diff --git a/mainwindow.cpp b/mainwindow.cpp index d7a6ffbee..e2ae424f2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -92,6 +92,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(&proc_jt9, SIGNAL(readyReadStandardError()), this, SLOT(readFromStderr())); + ui->tx5->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->tx5, SIGNAL(customContextMenuRequested(const QPoint&)), + this, SLOT(showMacros(const QPoint&))); + QTimer *guiTimer = new QTimer(this); connect(guiTimer, SIGNAL(timeout()), this, SLOT(guiUpdate())); guiTimer->start(100); //Don't change the 100 ms! @@ -1896,3 +1900,26 @@ void MainWindow::on_actionErase_wsjtx_log_adi_triggered() f.remove(); } } + +void MainWindow::showMacros(const QPoint &pos) +{ + QPoint globalPos = ui->tx5->mapToGlobal(pos); + QMenu popupMenu; + QAction* popup1 = new QAction("5W DIP 73 GL",ui->tx5); + QAction* popup2 = new QAction("TNX 73 GL",ui->tx5); + popupMenu.addAction(popup1); + popupMenu.addAction(popup2); + connect(popup1,SIGNAL(triggered()), this, SLOT(onPopup1())); + connect(popup2,SIGNAL(triggered()), this, SLOT(onPopup2())); + QAction* selectedItem = popupMenu.exec(globalPos); +} + +void MainWindow::onPopup1() +{ + ui->tx5->setText("5W DIP 73 GL"); +} + +void MainWindow::onPopup2() +{ + ui->tx5->setText("TNX 73 GL"); +} diff --git a/mainwindow.h b/mainwindow.h index 85403a0f7..0a2b3bff2 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -108,12 +108,14 @@ private slots: void bumpFqso(int n); void on_actionMonitor_OFF_at_startup_triggered(); void dialFreqChanged2(double f); - void on_actionErase_ALL_TXT_triggered(); - void on_actionErase_wsjtx_log_adi_triggered(); -private: + void showMacros(const QPoint& pos); + void onPopup1(); + void onPopup2(); + + private: Ui::MainWindow *ui; double m_dialFreq;