mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
[postgres] move also schema item's drag'n'drop handling to gui provider
This commit is contained in:
parent
2a16f3e9db
commit
7ac02ae881
@ -133,6 +133,8 @@ bool QgsPostgresDataItemGuiProvider::acceptDrop( QgsDataItem *item, QgsDataItemG
|
||||
{
|
||||
if ( qobject_cast< QgsPGConnectionItem * >( item ) )
|
||||
return true;
|
||||
if ( qobject_cast< QgsPGSchemaItem * >( item ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -143,6 +145,14 @@ bool QgsPostgresDataItemGuiProvider::handleDrop( QgsDataItem *item, QgsDataItemG
|
||||
{
|
||||
return connItem->handleDrop( data, QString() );
|
||||
}
|
||||
else if ( QgsPGSchemaItem *schemaItem = qobject_cast< QgsPGSchemaItem * >( item ) )
|
||||
{
|
||||
QgsPGConnectionItem *connItem = qobject_cast<QgsPGConnectionItem *>( schemaItem->parent() );
|
||||
if ( !connItem )
|
||||
return false;
|
||||
|
||||
return connItem->handleDrop( data, schemaItem->name() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -502,18 +502,6 @@ QgsPGLayerItem *QgsPGSchemaItem::createLayer( QgsPostgresLayerProperty layerProp
|
||||
return layerItem;
|
||||
}
|
||||
|
||||
bool QgsPGSchemaItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
{
|
||||
QgsPGConnectionItem *conn = qobject_cast<QgsPGConnectionItem *>( parent() );
|
||||
if ( !conn )
|
||||
return false;
|
||||
|
||||
bool result = conn->handleDrop( data, mName );
|
||||
if ( result )
|
||||
refresh();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
QgsPGRootItem::QgsPGRootItem( QgsDataItem *parent, const QString &name, const QString &path )
|
||||
|
@ -81,9 +81,6 @@ class QgsPGSchemaItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
bool acceptDrop() override { return true; }
|
||||
bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
|
||||
QString connectionName() const { return mConnectionName; }
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user