From 1ad53a354f3770aa5762bc3ef646cdf0b157e7dd Mon Sep 17 00:00:00 2001 From: Derek Christ Date: Mon, 13 Sep 2021 10:34:10 +0200 Subject: [PATCH] Add ability to goto comment by double-clicking time. Also remove some legacy signal-slot connections. --- DRAMSys/traceAnalyzer/businessObjects/commentmodel.cpp | 9 +++++++++ DRAMSys/traceAnalyzer/businessObjects/commentmodel.h | 3 +++ DRAMSys/traceAnalyzer/presentation/tracescroller.cpp | 6 ------ DRAMSys/traceAnalyzer/tracefiletab.cpp | 3 +++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/commentmodel.cpp b/DRAMSys/traceAnalyzer/businessObjects/commentmodel.cpp index 940cd07e..ebe15216 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/commentmodel.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/commentmodel.cpp @@ -280,3 +280,12 @@ bool CommentModel::eventFilter(QObject *object, QEvent *event) return false; } + +void CommentModel::rowDoubleClicked(const QModelIndex &index) +{ + if (!index.isValid()) + return; + + if (static_cast(index.column()) == Column::Time) + Q_EMIT gotoCommentTriggered(index); +} diff --git a/DRAMSys/traceAnalyzer/businessObjects/commentmodel.h b/DRAMSys/traceAnalyzer/businessObjects/commentmodel.h index f540663a..93249781 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/commentmodel.h +++ b/DRAMSys/traceAnalyzer/businessObjects/commentmodel.h @@ -87,6 +87,9 @@ public: QModelIndex hoveredComment(Timespan timespan) const; +public Q_SLOTS: + void rowDoubleClicked(const QModelIndex &index); + protected: bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index ef412d89..feaab60e 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -130,12 +130,6 @@ void TraceScroller::connectNavigatorQ_SIGNALS() { QObject::connect(navigator, SIGNAL(currentTraceTimeChanged()), this, SLOT(currentTraceTimeChanged())); - QObject::connect(navigator, SIGNAL(commentsChanged()), this, - SLOT(commentsChanged())); - QObject::connect(navigator, SIGNAL(selectedCommentsChanged()), this, - SLOT(commentsChanged())); - QObject::connect(navigator, SIGNAL(selectedTransactionsChanged()), this, - SLOT(selectedTransactionsChanged())); } Timespan TraceScroller::GetCurrentTimespan() diff --git a/DRAMSys/traceAnalyzer/tracefiletab.cpp b/DRAMSys/traceAnalyzer/tracefiletab.cpp index bca568d4..324a1a2a 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.cpp +++ b/DRAMSys/traceAnalyzer/tracefiletab.cpp @@ -176,6 +176,9 @@ void TraceFileTab::setUpCommentView() ui->commentView->edit(index); ui->commentView->scrollTo(index); }); + + QObject::connect(ui->commentView, &QTableView::doubleClicked, + commentModel, &CommentModel::rowDoubleClicked); } void TraceFileTab::tracefileChanged()