Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
DragDropToolBar Class Reference

A customized QToolBar that supports drag-and-drop reordering of its actions and handling external drops. More...

#include <drag_drop_toolbar.h>

Inheritance diagram for DragDropToolBar:
FilterExpressionToolBar

Signals

void actionMoved (QAction *action, int oldPos, int newPos)
 Signal emitted when an action has been moved via drag and drop.
void newFilterDropped (QString description, QString filter)
 Signal emitted when a new filter is dropped onto the toolbar.

Public Member Functions

 DragDropToolBar (const QString &title, QWidget *parent=Q_NULLPTR)
 Constructs a new DragDropToolBar with a specific title.
 DragDropToolBar (QWidget *parent=Q_NULLPTR)
 Constructs a new DragDropToolBar.
 ~DragDropToolBar ()
 Destroys the DragDropToolBar.
virtual void clear ()
 Clears all actions from the toolbar.

Protected Member Functions

virtual WiresharkMimeDatacreateMimeData (QString name, int position)
 Creates MIME data for a specific toolbar item to support drag operations.
virtual void childEvent (QChildEvent *event) override
 Handles child events, such as when widgets are added or removed.
virtual bool eventFilter (QObject *obj, QEvent *ev) override
 Event filter used to intercept mouse events on toolbar child widgets for drag detection.
virtual void dragEnterEvent (QDragEnterEvent *event) override
 Handles drag enter events to accept valid drop targets.
virtual void dragMoveEvent (QDragMoveEvent *event) override
 Handles drag move events for visual feedback during drag operations.
virtual void dropEvent (QDropEvent *event) override
 Handles drop events to finalize reordering or add new items.

Detailed Description

A customized QToolBar that supports drag-and-drop reordering of its actions and handling external drops.

Constructor & Destructor Documentation

◆ DragDropToolBar() [1/2]

DragDropToolBar::DragDropToolBar ( const QString & title,
QWidget * parent = Q_NULLPTR )
explicit

Constructs a new DragDropToolBar with a specific title.

Parameters
titleThe title of the toolbar.
parentThe parent widget, defaults to Q_NULLPTR.

◆ DragDropToolBar() [2/2]

DragDropToolBar::DragDropToolBar ( QWidget * parent = Q_NULLPTR)
explicit

Constructs a new DragDropToolBar.

Parameters
parentThe parent widget, defaults to Q_NULLPTR.

Member Function Documentation

◆ actionMoved

void DragDropToolBar::actionMoved ( QAction * action,
int oldPos,
int newPos )
signal

Signal emitted when an action has been moved via drag and drop.

Parameters
actionPointer to the moved QAction.
oldPosThe original index position of the action.
newPosThe new index position of the action.

◆ childEvent()

void DragDropToolBar::childEvent ( QChildEvent * event)
overrideprotectedvirtual

Handles child events, such as when widgets are added or removed.

Parameters
eventThe child event details.

◆ createMimeData()

WiresharkMimeData * DragDropToolBar::createMimeData ( QString name,
int position )
protectedvirtual

Creates MIME data for a specific toolbar item to support drag operations.

Parameters
nameThe name or description of the item.
positionThe current position index of the item.
Returns
A pointer to the created WiresharkMimeData.

Reimplemented in FilterExpressionToolBar.

◆ dragEnterEvent()

void DragDropToolBar::dragEnterEvent ( QDragEnterEvent * event)
overrideprotectedvirtual

Handles drag enter events to accept valid drop targets.

Parameters
eventThe drag enter event details.

◆ dragMoveEvent()

void DragDropToolBar::dragMoveEvent ( QDragMoveEvent * event)
overrideprotectedvirtual

Handles drag move events for visual feedback during drag operations.

Parameters
eventThe drag move event details.

◆ dropEvent()

void DragDropToolBar::dropEvent ( QDropEvent * event)
overrideprotectedvirtual

Handles drop events to finalize reordering or add new items.

Parameters
eventThe drop event details.

◆ eventFilter()

bool DragDropToolBar::eventFilter ( QObject * obj,
QEvent * ev )
overrideprotectedvirtual

Event filter used to intercept mouse events on toolbar child widgets for drag detection.

Parameters
objThe object receiving the event.
evThe event being intercepted.
Returns
True if the event was filtered out, false otherwise.

Reimplemented in FilterExpressionToolBar.

◆ newFilterDropped

void DragDropToolBar::newFilterDropped ( QString description,
QString filter )
signal

Signal emitted when a new filter is dropped onto the toolbar.

Parameters
descriptionThe description of the dropped filter.
filterThe filter string itself.

The documentation for this class was generated from the following files: