The following works with Reaper and Ableton, but not Bitwig. Also I can drag from the app to an explorer window, and from the explorer window into Bitwig, but not directly into Bitwig. (Are there any drag and drop experts here?)
Code: Select all
def mousePressEvent(self,e):
if e.button() == Qt.LeftButton:
drag = QDrag(self)
with tempfile.NamedTemporaryFile(suffix=".mid",delete=False) as f:
fn = f.name
f.write(mid) # mid is the midi data, for now just read from a file known to be valid smf
temp_filenames.append(fn)
mimeData = QMimeData()
mimeData.setData("audio/midi",QByteArray(""))
urls = [ QUrl.fromLocalFile(fn) ]
imeData.setUrls(urls)
drag.setMimeData(mimeData)
dropAction = drag.exec(Qt.CopyAction)