FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
markets: copy symbol to clipboard from row context menu
Sujallukhi04c49764711189
diff --git a/fincept-qt/src/screens/markets/MarketPanel.cpp b/fincept-qt/src/screens/markets/MarketPanel.cppindex cdf364aba..b5fa76518 100644--- a/fincept-qt/src/screens/markets/MarketPanel.cpp+++ b/fincept-qt/src/screens/markets/MarketPanel.cpp@@ -7,6 +7,8 @@# include "datahub/DataHub.h"# include "datahub/DataHubMetaTypes.h"+#include <QApplication>+#include <QClipboard>#include <QHBoxLayout>#include <QHeaderView>#include <QMenu>@@ -96,6 +98,11 @@ void MarketPanel::build_ui() {// causing the first panel in each column to grab disproportionate space.table_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored);setup_table_columns();++ table_->setContextMenuPolicy(Qt::CustomContextMenu);+ connect(table_, &QTableWidget::customContextMenuRequested,+ this, &MarketPanel::show_row_context_menu);+table_->setVisible(false); // hidden until first data arrivesbl->addWidget(table_);@@ -474,4 +481,19 @@ void MarketPanel::refresh_theme() {}}+void MarketPanel::show_row_context_menu(const QPoint& pos) {+ auto* it = table_->itemAt(pos);+ if (!it) return;++ QMenu menu(this);+ QAction* copy_act = menu.addAction("Copy Symbol");+ connect(copy_act, &QAction::triggered, this, [this, it]() {+ auto* sym_item = table_->item(it->row(), 0);+ if (sym_item) {+ QApplication::clipboard()->setText(sym_item->text());+ }+ });+ menu.exec(table_->viewport()->mapToGlobal(pos));+}+} // namespace fincept::screensdiff --git a/fincept-qt/src/screens/markets/MarketPanel.h b/fincept-qt/src/screens/markets/MarketPanel.hindex 635a7f9a7..0c7929586 100644--- a/fincept-qt/src/screens/markets/MarketPanel.h+++ b/fincept-qt/src/screens/markets/MarketPanel.h@@ -57,6 +57,7 @@ class MarketPanel : public QWidget {void tick_loading_anim();void refresh_theme();void open_cols_dropdown();+ void show_row_context_menu(const QPoint& pos);void hub_resubscribe();void hub_unsubscribe_all();