Fix drag & drop of tables onto the structure view

When dragging and dropping a table from one instance of the application
to the other, the tree structure representing the database was broken.
We would show the 'Browsables' and 'All' nodes at the top level instead
of the child nodes of the 'All' node. This happened because after
dropping a table, we would reload the database structure and rebuild the
tree structure but didn't notify the tree view in the main window about
the update. This is fixed by this commit, so the main window's widgets
are always notified about the new tree structure.

See issue #1288.
This commit is contained in:
Martin Kleusberg
2018-01-15 23:10:23 +01:00
parent 39a5460500
commit 012ad9217a
4 changed files with 16 additions and 10 deletions

View File

@@ -15,8 +15,6 @@ public:
explicit DbStructureModel(DBBrowserDB& db, QObject* parent = nullptr);
~DbStructureModel();
void reloadData();
QVariant data(const QModelIndex& index, int role) const;
Qt::ItemFlags flags(const QModelIndex& index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
@@ -38,6 +36,12 @@ public:
ColumnSchema,
};
public slots:
void reloadData();
signals:
void structureUpdated();
private:
DBBrowserDB& m_db;
QTreeWidgetItem* rootItem;