Added ROM file drag and drop into Qt main window feature. This will load the ROM into the emulator when dropped.
This commit is contained in:
parent
10f599fd5b
commit
9cdbdb31b0
|
@ -140,6 +140,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
||||||
|
|
||||||
setWindowTitle( tr(FCEU_NAME_AND_VERSION) );
|
setWindowTitle( tr(FCEU_NAME_AND_VERSION) );
|
||||||
setWindowIcon(QIcon(":fceux1.png"));
|
setWindowIcon(QIcon(":fceux1.png"));
|
||||||
|
setAcceptDrops(true);
|
||||||
|
|
||||||
gameTimer = new QTimer( this );
|
gameTimer = new QTimer( this );
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||||
|
@ -616,6 +617,27 @@ void consoleWin_t::keyReleaseEvent(QKeyEvent *event)
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasUrls() )
|
||||||
|
{
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::dropEvent(QDropEvent *event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasUrls() )
|
||||||
|
{
|
||||||
|
QList<QUrl> urls = event->mimeData()->urls();
|
||||||
|
|
||||||
|
fceuWrapperLock();
|
||||||
|
LoadGame( urls[0].path().toStdString().c_str() );
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void consoleWin_t::initHotKeys(void)
|
void consoleWin_t::initHotKeys(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QDragEnterEvent>
|
||||||
|
#include <QDropEvent>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
@ -257,6 +259,8 @@ class consoleWin_t : public QMainWindow
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
void dropEvent(QDropEvent *event);
|
||||||
void syncActionConfig( QAction *act, const char *property );
|
void syncActionConfig( QAction *act, const char *property );
|
||||||
void showErrorMsgWindow(void);
|
void showErrorMsgWindow(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue