1 /* drag_drop_toolbar.h 2 * 3 * Wireshark - Network traffic analyzer 4 * By Gerald Combs <gerald@wireshark.org> 5 * Copyright 1998 Gerald Combs 6 * 7 * SPDX-License-Identifier: GPL-2.0-or-later 8 */ 9 10 #ifndef DRAG_DROP_TOOLBAR_H 11 #define DRAG_DROP_TOOLBAR_H 12 13 #include <QToolBar> 14 #include <QPoint> 15 16 class WiresharkMimeData; 17 18 class DragDropToolBar : public QToolBar 19 { 20 Q_OBJECT 21 public: 22 explicit DragDropToolBar(const QString &title, QWidget *parent = Q_NULLPTR); 23 explicit DragDropToolBar(QWidget *parent = Q_NULLPTR); 24 ~DragDropToolBar(); 25 26 virtual void clear(); 27 28 Q_SIGNALS: 29 void actionMoved(QAction * action, int oldPos, int newPos); 30 31 void newFilterDropped(QString description, QString filter); 32 33 protected: 34 35 virtual WiresharkMimeData * createMimeData(QString name, int position); 36 37 virtual void childEvent(QChildEvent * event); 38 39 virtual bool eventFilter(QObject * obj, QEvent * ev); 40 virtual void dragEnterEvent(QDragEnterEvent *event); 41 virtual void dragMoveEvent(QDragMoveEvent *event); 42 virtual void dropEvent(QDropEvent *event); 43 44 private: 45 46 QPoint dragStartPosition; 47 int childCounter; 48 49 void setupToolbar(); 50 void moveToolbarItems(int fromPos, int toPos); 51 52 }; 53 54 #endif // DRAG_DROP_TOOLBAR_H 55