aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/tcp_stream_dialog.cpp
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2020-03-14 15:08:52 +0100
committerAnders Broman <a.broman58@gmail.com>2020-03-16 05:05:48 +0000
commiteb7774e4c12e636c47049fdb1add80507311d2a2 (patch)
tree3f1b864da8d62b0dab4c4d430d40cb0a4d9daec9 /ui/qt/tcp_stream_dialog.cpp
parentd87bce7c4fc3da44ecea3b1486b34c24d30adbdb (diff)
Qt: Improve tcptrace graph drag responsiveness
Subclass QCPErrorBars with implementation that never accepts clicks. This prevents a lot of square root computations in QCustomPlot mousePressEvent handle and results in usable tcptrace graph. An alternative solution to the poor performance problem could be using QCP::srmCustom SelectionRectMode. I don't know how to implement graph drag with QCP::srmCustom, and thus I went with simple subclass approach. Bug: 16281 Change-Id: Id4178e59bdbd2222db4669d0635ff741ebde839f Reviewed-on: https://code.wireshark.org/review/36413 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/tcp_stream_dialog.cpp')
-rw-r--r--ui/qt/tcp_stream_dialog.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index 9c761158c8..5c64180c69 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -74,6 +74,23 @@ const QString sequence_number_label_ = QObject::tr("Sequence Number (B)");
const QString time_s_label_ = QObject::tr("Time (s)");
const QString window_size_label_ = QObject::tr("Window Size (B)");
+QCPErrorBarsNotSelectable::QCPErrorBarsNotSelectable(QCPAxis *keyAxis, QCPAxis *valueAxis) :
+ QCPErrorBars(keyAxis, valueAxis)
+{
+}
+
+QCPErrorBarsNotSelectable::~QCPErrorBarsNotSelectable()
+{
+}
+
+double QCPErrorBarsNotSelectable::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const
+{
+ Q_UNUSED(pos);
+ Q_UNUSED(onlySelectable);
+ Q_UNUSED(details);
+ return -1.0;
+}
+
TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_type graph_type) :
GeometryStateDialog(parent),
ui(new Ui::TCPStreamDialog),
@@ -247,7 +264,7 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
seg_graph_ = sp->addGraph();
seg_graph_->setLineStyle(QCPGraph::lsNone);
seg_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
- seg_eb_ = new QCPErrorBars(sp->xAxis, sp->yAxis);
+ seg_eb_ = new QCPErrorBarsNotSelectable(sp->xAxis, sp->yAxis);
seg_eb_->setErrorType(QCPErrorBars::etValueError);
seg_eb_->setPen(QPen(QBrush(graph_color_1), pen_width));
seg_eb_->setSymbolGap(0.0); // draw error spine as single line
@@ -264,7 +281,7 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
sack_graph_ = sp->addGraph();
sack_graph_->setLineStyle(QCPGraph::lsNone);
sack_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
- sack_eb_ = new QCPErrorBars(sp->xAxis, sp->yAxis);
+ sack_eb_ = new QCPErrorBarsNotSelectable(sp->xAxis, sp->yAxis);
sack_eb_->setErrorType(QCPErrorBars::etValueError);
sack_eb_->setPen(QPen(QBrush(graph_color_4), pen_width));
sack_eb_->setSymbolGap(0.0); // draw error spine as single line
@@ -276,7 +293,7 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
sack2_graph_ = sp->addGraph();
sack2_graph_->setLineStyle(QCPGraph::lsNone);
sack2_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
- sack2_eb_ = new QCPErrorBars(sp->xAxis, sp->yAxis);
+ sack2_eb_ = new QCPErrorBarsNotSelectable(sp->xAxis, sp->yAxis);
sack2_eb_->setErrorType(QCPErrorBars::etValueError);
sack2_eb_->setPen(QPen(QBrush(graph_color_5), pen_width));
sack2_eb_->setSymbolGap(0.0); // draw error spine as single line