Commit 751db983 authored by Volker Krause's avatar Volker Krause

Allow to copy values

parent 606ec242
......@@ -35,6 +35,7 @@
#include <QtCharts/QChart>
#include <QClipboard>
#include <QFile>
#include <QFileDialog>
#include <QImage>
......@@ -129,6 +130,15 @@ AnalyticsView::AnalyticsView(QWidget* parent) :
aggr->setSingularTime(value);
ui->timeLabel->setText(aggr->singularAggregationModel()->index(0, 0).data(TimeAggregationModel::TimeDisplayRole).toString());
});
connect(ui->dataView, &QWidget::customContextMenuRequested, this, [this](QPoint pos) {
QMenu menu;
menu.addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), [this, pos]() {
const auto idx = ui->dataView->indexAt(pos);
QGuiApplication::clipboard()->setText(idx.data().toString());
});
menu.exec(ui->dataView->viewport()->mapToGlobal(pos));
});
}
AnalyticsView::~AnalyticsView()
......
......@@ -119,7 +119,11 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTableView" name="dataView"/>
<widget class="QTableView" name="dataView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment