aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--ui/qt/tcp_stream_dialog.cpp23
-rw-r--r--ui/qt/tcp_stream_dialog.h12
2 files changed, 32 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
diff --git a/ui/qt/tcp_stream_dialog.h b/ui/qt/tcp_stream_dialog.h
index edd6133a15..6cd5bb4fec 100644
--- a/ui/qt/tcp_stream_dialog.h
+++ b/ui/qt/tcp_stream_dialog.h
@@ -29,8 +29,20 @@
namespace Ui {
class TCPStreamDialog;
+class QCPErrorBarsNotSelectable;
}
+class QCPErrorBarsNotSelectable : public QCPErrorBars
+{
+ Q_OBJECT
+
+public:
+ explicit QCPErrorBarsNotSelectable(QCPAxis *keyAxis, QCPAxis *valueAxis);
+ virtual ~QCPErrorBarsNotSelectable();
+
+ virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE;
+};
+
class TCPStreamDialog : public GeometryStateDialog
{
Q_OBJECT