Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #8176 from VinDuv/handle-open-files
QtGui: Handle file open events
- Loading branch information
Showing
5 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright 2019 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include <QFileOpenEvent> | ||
|
|
||
| #include "DolphinQt/QtUtils/FileOpenEventFilter.h" | ||
|
|
||
| FileOpenEventFilter::FileOpenEventFilter(QObject* event_source) : QObject(event_source) | ||
| { | ||
| event_source->installEventFilter(this); | ||
| } | ||
|
|
||
| bool FileOpenEventFilter::eventFilter(QObject* object, QEvent* event) | ||
| { | ||
| if (event->type() == QEvent::FileOpen) | ||
| { | ||
| auto* openEvent = static_cast<QFileOpenEvent*>(event); | ||
| emit fileOpened(openEvent->file()); | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Copyright 2019 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <QObject> | ||
|
|
||
| class FileOpenEventFilter : public QObject | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| explicit FileOpenEventFilter(QObject* event_source); | ||
|
|
||
| signals: | ||
| void fileOpened(const QString& file_name); | ||
|
|
||
| private: | ||
| bool eventFilter(QObject* object, QEvent* event) override; | ||
| }; |