ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Qt - Protocol dissector

From: Edwin Groothuis <Edwin.Groothuis@xxxxxxxxxxxx>
Date: Tue, 31 May 2016 04:16:31 +0000
On 5/17/16 7:18 AM, Edwin Groothuis wrote:
>> I hope that somebody can give me a quick pointer:
>> In ui/qt/proto_tree.cpp in the ProtoTree class, how can I get access to the
>> current selected protocol? In the below example, TCP.
>> 
>> I’ve stared at various files for a long time but it doesn’t click... Who
>> can help?

> Each protocol tree item has a field_info pointer associated to it via QTreeWidgetItem::setData(0, Qt::UserRole). You can fetch the pointer using QTreeWidgetItem::data. See ProtoTree::contextMenuEvent and ProtoTree::updateSelectionStatus for examples.

Believe it or not, but I managed to get the data via the functions suggested. Thanks!

Edwin