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

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Wed, 18 May 2016 09:38:00 +0900
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.