mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-25 13:29:35 -06:00
merge extendedmainform with mainwindow
why was the drag and drop support even separated like this???
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <QTextStream>
|
||||
#include <QWhatsThis>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
|
||||
#include "createtableform.h"
|
||||
#include "createindexform.h"
|
||||
@@ -249,6 +250,7 @@ mainForm::mainForm(QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
setAcceptDrops(true);
|
||||
|
||||
(void)statusBar();
|
||||
init();
|
||||
@@ -1559,3 +1561,22 @@ void mainForm::setCurrentFile(const QString &fileName)
|
||||
mainWin->updateRecentFileActions();
|
||||
}
|
||||
}
|
||||
|
||||
void mainForm::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if( event->mimeData()->hasFormat("text/uri-list") )
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void mainForm::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
|
||||
if( urls.isEmpty() )
|
||||
return;
|
||||
|
||||
QString fileName = urls.first().toLocalFile();
|
||||
|
||||
if( !fileName.isEmpty() && fileName.endsWith("db") )
|
||||
fileOpen(fileName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user