- feature: drop files to devcpp to open them
This commit is contained in:
parent
ca9f144444
commit
a1fe8c38b1
|
@ -13,6 +13,7 @@
|
|||
#include <QCloseEvent>
|
||||
#include <QComboBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
|
@ -59,6 +60,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->EditorTabsRight,
|
||||
ui->splitterEditorPanel,
|
||||
ui->EditorPanel);
|
||||
setAcceptDrops(true);
|
||||
setupActions();
|
||||
ui->EditorTabsRight->setVisible(false);
|
||||
|
||||
|
@ -1514,6 +1516,24 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (event->mimeData()->hasUrls()){
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
foreach(const QUrl& url, event->mimeData()->urls()){
|
||||
if (!url.isLocalFile())
|
||||
continue;
|
||||
openFile(url.toLocalFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSave_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
|
|
|
@ -354,6 +354,11 @@ private:
|
|||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
};
|
||||
|
||||
extern MainWindow* pMainWindow;
|
||||
|
|
Loading…
Reference in New Issue