Skip to content

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.

news: add 'Copy Title' button to article detail panel

Abhi Kakadiya72a4a9cef8c6
diff --git a/fincept-qt/src/screens/news/NewsDetailPanel.cpp b/fincept-qt/src/screens/news/NewsDetailPanel.cpp
index 3a5a90897..bb7193e01 100644
--- a/fincept-qt/src/screens/news/NewsDetailPanel.cpp
+++ b/fincept-qt/src/screens/news/NewsDetailPanel.cpp
@@ -162,6 +162,10 @@ QWidget* NewsDetailPanel::build_content_view() {
copy_btn_ = new QPushButton("COPY URL", content);
copy_btn_->setObjectName("newsDetailCopyBtn");
copy_btn_->setFixedHeight(24);
+ copy_title_btn_ = new QPushButton("COPY TITLE", content);
+ copy_title_btn_->setObjectName("newsDetailCopyBtn"); // reuse existing style
+ copy_title_btn_->setFixedHeight(24);
+ copy_title_btn_->setToolTip("Copy article headline to clipboard");
analyze_btn_ = new QPushButton("ANALYZE", content);
analyze_btn_->setObjectName("newsDetailAnalyzeBtn");
analyze_btn_->setFixedHeight(24);
@@ -183,6 +187,7 @@ QWidget* NewsDetailPanel::build_content_view() {
action_layout->addWidget(open_btn_);
action_layout->addWidget(copy_btn_);
+ action_layout->addWidget(copy_title_btn_); // new
action_layout->addWidget(analyze_btn_);
action_layout->addWidget(save_btn_);
action_layout->addWidget(bookmark_btn_);
@@ -197,6 +202,18 @@ QWidget* NewsDetailPanel::build_content_view() {
if (has_article_)
QApplication::clipboard()->setText(current_article_.link);
});
+ connect(copy_title_btn_, &QPushButton::clicked, this, [this]() {
+ if (!has_article_ || current_article_.headline.isEmpty())
+ return;
+ QApplication::clipboard()->setText(current_article_.headline);
+
+ // Brief visual confirmation — flip label for ~1 s, then revert.
+ copy_title_btn_->setText("COPIED");
+ QTimer::singleShot(1000, this, [this]() {
+ if (copy_title_btn_)
+ copy_title_btn_->setText("COPY TITLE");
+ });
+ });
connect(analyze_btn_, &QPushButton::clicked, this, [this]() {
if (!has_article_)
return;
diff --git a/fincept-qt/src/screens/news/NewsDetailPanel.h b/fincept-qt/src/screens/news/NewsDetailPanel.h
index 1448cffcc..9fe02ac9b 100644
--- a/fincept-qt/src/screens/news/NewsDetailPanel.h
+++ b/fincept-qt/src/screens/news/NewsDetailPanel.h
@@ -92,6 +92,7 @@ class NewsDetailPanel : public QWidget {
// Action buttons
QPushButton* open_btn_ = nullptr;
QPushButton* copy_btn_ = nullptr;
+ QPushButton* copy_title_btn_ = nullptr;
QPushButton* save_btn_ = nullptr;
QPushButton* bookmark_btn_ = nullptr;
QPushButton* close_btn_ = nullptr;