mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Source trigger patch file drop (#1236)
* Add Signal if File dropped * Check if Index is valid Send Signal and return if Index is invalid and File was dropped * Connect Dropsignal to fileopen
This commit is contained in:
committed by
Martin Kleusberg
parent
09e170f75d
commit
0a995423fa
@@ -543,6 +543,14 @@ void ExtendedTableWidget::dragMoveEvent(QDragMoveEvent* event)
|
||||
void ExtendedTableWidget::dropEvent(QDropEvent* event)
|
||||
{
|
||||
QModelIndex index = indexAt(event->pos());
|
||||
|
||||
if (!index.isValid())
|
||||
{
|
||||
if (event->mimeData()->hasUrls() && event->mimeData()->urls().first().isLocalFile())
|
||||
emit openFileFromDropEvent(event->mimeData()->urls().first().toLocalFile());
|
||||
return;
|
||||
}
|
||||
|
||||
model()->dropMimeData(event->mimeData(), Qt::CopyAction, index.row(), index.column(), QModelIndex());
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public slots:
|
||||
signals:
|
||||
void foreignKeyClicked(const sqlb::ObjectIdentifier& table, const QString& column, const QByteArray& value);
|
||||
void switchTable(bool next); // 'next' parameter is set to true if next table should be selected and to false if previous table should be selected
|
||||
void openFileFromDropEvent(QString);
|
||||
|
||||
private:
|
||||
void copy(const bool withHeaders = false);
|
||||
|
||||
@@ -252,6 +252,7 @@ void MainWindow::init()
|
||||
connect(ui->dbTreeWidget->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(changeTreeSelection()));
|
||||
connect(ui->dataTable->horizontalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDataColumnPopupMenu(QPoint)));
|
||||
connect(ui->dataTable->verticalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showRecordPopupMenu(QPoint)));
|
||||
connect(ui->dataTable, SIGNAL(openFileFromDropEvent(QString)), this, SLOT(fileOpen(QString)));
|
||||
connect(ui->dockEdit, SIGNAL(visibilityChanged(bool)), this, SLOT(toggleEditDock(bool)));
|
||||
connect(m_remoteDb, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString)));
|
||||
connect(m_remoteDb, &RemoteDatabase::gotCurrentVersion, this, &MainWindow::checkNewVersion);
|
||||
|
||||
Reference in New Issue
Block a user