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
+1
View File
@@ -16,6 +16,7 @@
- Bugfix: Fixed message contents being cleared when using the close button for replies. (#6145)
- Bugfix: Handle <kbd>CMD</kbd> + <kbd>BACKSPACE</kbd> behavior explicitly in main chat dialog input for macOS. (#6111)
- Bugfix: Fixed a small typo in the settings page. (#6134)
- Bugfix: Fixed an issue where Splits could get lost by dragging it onto your Recycle Bin. (#6147)
- Bugfix: Fixed some Twitch commands not getting tab-completed correctly. (#6143)
- Bugfix: Fixed shared chat badges displaying pixelated when Chatterino is scaled too much. (#6146)
- Dev: Mini refactor of Split. (#6148)
+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 &&
+1
View File
@@ -103,6 +103,7 @@ protected:
void leaveEvent(QEvent *) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
+2 -1
View File
@@ -1656,7 +1656,8 @@ void Split::drag()
drag->setMimeData(mimeData);
// drag->exec is a blocking action
if (drag->exec(Qt::MoveAction) == Qt::IgnoreAction)
auto dragRes = drag->exec(Qt::MoveAction);
if (dragRes != Qt::MoveAction || drag->target() == nullptr)
{
// The split wasn't dropped in a valid spot, return it to its original position
container->insertSplit(this, {.position = originalLocation});