aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/packet_list.cpp
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-06-16 12:02:37 +0200
committerRoland Knall <rknall@gmail.com>2019-06-16 21:07:21 +0000
commite4713e8745859ea5b8a8ca27a699dec1288c211b (patch)
tree7e4b2a8c98376bd7cf5d8006058be36aa6e151d2 /ui/qt/packet_list.cpp
parentb4cd7bcf625cd2eb2039add5238fc6c367eb24cb (diff)
Qt: Fix drag-and-drop from packet list
Only initiate drag-and-drop when the left mousebutton has been clicked, and also add the filter as plain text, so to enable dragging to external applications. Change-Id: I2f6ac7f9c543d003070c2a6c0ce671ed5a215669 Reviewed-on: https://code.wireshark.org/review/33620 Petri-Dish: Roland Knall <rknall@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/packet_list.cpp')
-rw-r--r--ui/qt/packet_list.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 16e1538099..e8d0039717 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -651,30 +651,35 @@ void PacketList::mousePressEvent (QMouseEvent *event)
setAutoScroll(false);
QTreeView::mousePressEvent(event);
setAutoScroll(true);
+}
- QModelIndex curIndex = indexAt(event->pos());
- ctx_column_ = curIndex.column();
- QString filter = getFilterFromRowAndColumn();
- if ( ! filter.isEmpty() )
+void PacketList::mouseMoveEvent (QMouseEvent *event)
+{
+ if ( event->buttons() & Qt::LeftButton )
{
- QString abbrev = filter.left(filter.indexOf(' '));
- QString name = model()->headerData(ctx_column_, header()->orientation()).toString();
-
- DisplayFilterMimeData * dfmd =
- new DisplayFilterMimeData(name, abbrev, filter);
- QDrag * drag = new QDrag(this);
- drag->setMimeData(dfmd);
-
- DragLabel * content = new DragLabel(dfmd->labelText(), this);
- qreal dpr = window()->windowHandle()->devicePixelRatio();
- QPixmap pixmap(content->size() * dpr);
- pixmap.setDevicePixelRatio(dpr);
- content->render(&pixmap);
- drag->setPixmap(pixmap);
-
- drag->exec(Qt::CopyAction);
+ QModelIndex curIndex = indexAt(event->pos());
+ ctx_column_ = curIndex.column();
+ QString filter = getFilterFromRowAndColumn();
+ if ( ! filter.isEmpty() )
+ {
+ QString abbrev = filter.left(filter.indexOf(' '));
+ QString name = model()->headerData(ctx_column_, header()->orientation()).toString();
+
+ DisplayFilterMimeData * dfmd =
+ new DisplayFilterMimeData(name, abbrev, filter);
+ QDrag * drag = new QDrag(this);
+ drag->setMimeData(dfmd);
+
+ DragLabel * content = new DragLabel(dfmd->labelText(), this);
+ qreal dpr = window()->windowHandle()->devicePixelRatio();
+ QPixmap pixmap(content->size() * dpr);
+ pixmap.setDevicePixelRatio(dpr);
+ content->render(&pixmap);
+ drag->setPixmap(pixmap);
+
+ drag->exec(Qt::CopyAction);
+ }
}
-
}
void PacketList::resizeEvent(QResizeEvent *event)