fix: split drag & drop on KDE Plasma (#6147)

This commit is contained in:
pajlada
2025-04-13 14:15:49 +02:00
committed by GitHub
parent 37061dd3bd
commit 1d8a00e892
4 changed files with 35 additions and 1 deletions
+31
View File
@@ -3,6 +3,7 @@
#include "Application.hpp"
#include "common/Channel.hpp"
#include "common/Common.hpp"
#include "common/QLogging.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Fonts.hpp"
@@ -1000,12 +1001,42 @@ void NotebookTab::dragEnterEvent(QDragEnterEvent *event)
return;
}
event->acceptProposedAction();
if (this->notebook_->getAllowUserTabManagement())
{
this->notebook_->select(this->page);
}
}
void NotebookTab::dropEvent(QDropEvent *event)
{
if (!event->mimeData()->hasFormat("chatterino/split"))
{
return;
}
if (!isDraggingSplit())
{
// Ensure dragging a split from a different Chatterino instance doesn't switch tabs around
return;
}
auto *draggedSplit = dynamic_cast<Split *>(event->source());
if (!draggedSplit)
{
qCDebug(chatterinoWidget)
<< "Dropped something that wasn't a split onto a notebook button";
return;
}
if (auto *container = dynamic_cast<SplitContainer *>(this->page))
{
event->acceptProposedAction();
container->insertSplit(draggedSplit);
}
}
void NotebookTab::mouseMoveEvent(QMouseEvent *event)
{
if (getSettings()->showTabCloseButton &&