forked from osmocom/wireshark
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>
This commit is contained in:
parent
d87bce7c4f
commit
eb7774e4c1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue