diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-07-21 00:37:15 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-07-22 13:41:41 +0000 |
commit | 2c38a05d0154697ac5438eadf98750a600e68cbb (patch) | |
tree | 90ae705985065ce11f82d2993600739e550c55d9 /ui | |
parent | 0903568bf3a784da935507851a3088a8b17ef91c (diff) |
Qt: Add hovered byte lock on left-click
Allows marking/unmarking a single byte in the bytes view pane.
Ping-Bug: 11547
Change-Id: I574ad7c6218eb08018094ea92ba79b69dbe4b45d
Reviewed-on: https://code.wireshark.org/review/16563
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/byte_view_text.cpp | 10 | ||||
-rw-r--r-- | ui/qt/byte_view_text.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/ui/qt/byte_view_text.cpp b/ui/qt/byte_view_text.cpp index 78dee3826d..884ef961e4 100644 --- a/ui/qt/byte_view_text.cpp +++ b/ui/qt/byte_view_text.cpp @@ -60,6 +60,7 @@ ByteViewText::ByteViewText(QWidget *parent, tvbuff_t *tvb, proto_tree *tree, QTr encoding_actions_(new QActionGroup(this)), encoding_(encoding), hovered_byte_offset(-1), + hovered_byte_lock(false), p_bound_(0, 0), f_bound_(0, 0), fa_bound_(0, 0), @@ -249,6 +250,7 @@ void ByteViewText::mousePressEvent (QMouseEvent *event) { return; } + hovered_byte_lock = !hovered_byte_lock; QPoint pos = event->pos(); field_info *fi = fieldAtPixel(pos); @@ -268,6 +270,10 @@ void ByteViewText::mousePressEvent (QMouseEvent *event) { void ByteViewText::mouseMoveEvent(QMouseEvent *event) { + if (hovered_byte_lock) { + return; + } + QString field_str; // XXX can the event really be NULL? if (!event) { @@ -309,7 +315,9 @@ void ByteViewText::leaveEvent(QEvent *event) { QString empty; emit byteFieldHovered(empty); - hovered_byte_offset = -1; + if (!hovered_byte_lock) { + hovered_byte_offset = -1; + } p_bound_ = p_bound_save_; f_bound_ = f_bound_save_; fa_bound_ = fa_bound_save_; diff --git a/ui/qt/byte_view_text.h b/ui/qt/byte_view_text.h index 29ddc2372c..4fa0d4e7c0 100644 --- a/ui/qt/byte_view_text.h +++ b/ui/qt/byte_view_text.h @@ -110,6 +110,7 @@ private: // Data highlight guint hovered_byte_offset; + bool hovered_byte_lock; QPair<guint,guint> p_bound_; QPair<guint,guint> f_bound_; QPair<guint,guint> fa_bound_; |