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

@@ -50,6 +50,11 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
setWindowTitle( tr( "Beat+Bassline Editor" ) );
setCentralWidget(m_trackContainerView);
setAcceptDrops(true);
m_toolBar->setAcceptDrops(true);
connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_trackContainerView, SLOT(dragEnterEvent(QDragEnterEvent*)));
connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_trackContainerView, SLOT(dropEvent(QDropEvent*)));
// TODO: Use style sheet
if( ConfigManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )

View File

@@ -51,7 +51,7 @@ void Editor::togglePlayStop()
}
Editor::Editor(bool record) :
m_toolBar(new QToolBar(this)),
m_toolBar(new DropToolBar(this)),
m_playAction(nullptr),
m_recordAction(nullptr),
m_recordAccompanyAction(nullptr),
@@ -96,3 +96,21 @@ Editor::~Editor()
{
}
DropToolBar::DropToolBar(QWidget* parent) : QToolBar(parent)
{
setAcceptDrops(true);
}
void DropToolBar::dragEnterEvent(QDragEnterEvent* event)
{
dragEntered(event);
}
void DropToolBar::dropEvent(QDropEvent* event)
{
dropped(event);
}

View File

@@ -626,6 +626,10 @@ SongEditorWindow::SongEditorWindow(Song* song) :
setWindowIcon( embed::getIconPixmap( "songeditor" ) );
setCentralWidget(m_editor);
setAcceptDrops(true);
m_toolBar->setAcceptDrops(true);
connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_editor, SLOT(dragEnterEvent(QDragEnterEvent*)));
connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_editor, SLOT(dropEvent(QDropEvent*)));
// Set up buttons
m_playAction->setToolTip(tr("Play song (Space)"));