[Tab Bar] Accept proposed action only ontop of a tab

You cannot drop a file/folder onto the empty area of the tab bar,
so show the appropriate "not allowed" cursor.
This commit is contained in:
Kai Uwe Broulik 2022-01-20 12:38:47 +01:00
parent b81d3fbbbb
commit d832216159

View file

@ -36,7 +36,13 @@ void DolphinTabBar::dragEnterEvent(QDragEnterEvent* event)
const int index = tabAt(event->pos());
if (mimeData->hasUrls()) {
event->acceptProposedAction();
if (index >= 0) {
event->acceptProposedAction();
} else {
event->setDropAction(Qt::IgnoreAction);
// Still need to accept it to receive dragMoveEvent
event->accept();
}
updateAutoActivationTimer(index);
}
@ -56,6 +62,11 @@ void DolphinTabBar::dragMoveEvent(QDragMoveEvent* event)
const int index = tabAt(event->pos());
if (mimeData->hasUrls()) {
if (index >= 0) {
event->acceptProposedAction();
} else {
event->setDropAction(Qt::IgnoreAction);
}
updateAutoActivationTimer(index);
}