mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-11 22:49:56 +00:00
Qt: Handle display surface Drag & Drop events
This commit is contained in:
committed by
lightningterror
parent
4209900351
commit
4d1afb9fdd
@@ -365,6 +365,16 @@ bool DisplaySurface::event(QEvent* event)
|
||||
return true;
|
||||
}
|
||||
|
||||
case QEvent::DragEnter:
|
||||
QWindow::event(event);
|
||||
emit dragEnterEvent(static_cast<QDragEnterEvent*>(event));
|
||||
return event->isAccepted();
|
||||
|
||||
case QEvent::Drop:
|
||||
QWindow::event(event);
|
||||
emit dropEvent(static_cast<QDropEvent*>(event));
|
||||
return event->isAccepted();
|
||||
|
||||
case QEvent::Move:
|
||||
{
|
||||
updateCenterPos();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "common/WindowInfo.h"
|
||||
#include <QtGui/QDragMoveEvent>
|
||||
#include <QtGui/QWindow>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
@@ -32,6 +33,9 @@ Q_SIGNALS:
|
||||
void windowResizedEvent(int width, int height, float scale);
|
||||
void windowRestoredEvent();
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
|
||||
protected:
|
||||
void handleCloseEvent(QCloseEvent* event);
|
||||
void handleKeyInputEvent(QEvent* event);
|
||||
|
||||
@@ -2441,6 +2441,10 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main)
|
||||
m_ui.mainContainer->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
// Attatch drag and drop signals
|
||||
connect(m_display_surface, &DisplaySurface::dragEnterEvent, this, &MainWindow::dragEnterEvent);
|
||||
connect(m_display_surface, &DisplaySurface::dropEvent, this, &MainWindow::dropEvent);
|
||||
|
||||
updateDisplayRelatedActions(true, render_to_main, fullscreen);
|
||||
|
||||
// We need the surface visible.
|
||||
|
||||
Reference in New Issue
Block a user