SongEditor and BBEditor: Accept drops in toolbar

This commit is contained in:
Lukas W
2015-01-13 17:29:19 +01:00
parent 85fb0aca82
commit f640769ff0
5 changed files with 50 additions and 4 deletions

View File

@@ -32,6 +32,8 @@
#include "TimeLineWidget.h"
#include "ToolButton.h"
class DropToolBar;
/// \brief Superclass for editors with a toolbar.
///
/// Those editors include the Song Editor, the Automation Editor, B&B Editor,
@@ -63,7 +65,7 @@ protected:
virtual ~Editor();
QToolBar* m_toolBar;
DropToolBar* m_toolBar;
QAction* m_playAction;
QAction* m_recordAction;
@@ -72,4 +74,21 @@ protected:
};
/// Small helper class: A QToolBar that accepts and exposes drop events as signals
class DropToolBar : public QToolBar
{
Q_OBJECT
public:
DropToolBar(QWidget* parent=0);
signals:
void dragEntered(QDragEnterEvent* event);
void dropped(QDropEvent* event);
protected:
void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event);
};
#endif

View File

@@ -124,6 +124,8 @@ public slots:
void createTrackView( Track * _t );
void deleteTrackView( TrackView * _tv );
virtual void dropEvent( QDropEvent * _de );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
protected:
static const int DEFAULT_PIXELS_PER_TACT = 16;
@@ -133,8 +135,6 @@ protected:
return( m_trackViews );
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );