mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
fix #8488: use QgsMimeDataUtils to decode uris when dropping into db_manager
This commit is contained in:
parent
b460eebde7
commit
b9b8a03905
@ -523,21 +523,7 @@ class DBModel(QAbstractItemModel):
|
||||
added += 1
|
||||
|
||||
if data.hasFormat(self.QGIS_URI_MIME):
|
||||
encodedData = data.data(self.QGIS_URI_MIME)
|
||||
stream = QDataStream(encodedData, QIODevice.ReadOnly)
|
||||
|
||||
while not stream.atEnd():
|
||||
mimeUri = stream.readQString()
|
||||
|
||||
parts = mimeUri.split(":", 3)
|
||||
if len(parts) != 4:
|
||||
# invalid qgis mime uri
|
||||
QMessageBox.warning(None, self.tr("Invalid MIME uri"), self.tr("The dropped object is not a valid layer"))
|
||||
continue
|
||||
|
||||
layerType, providerKey, layerName, uriString = parts
|
||||
|
||||
if self.importLayer( layerType, providerKey, layerName, uriString, parent ):
|
||||
for uri tin qgis.core.QgsMimeDataUtils.decodeUriList( data ):
|
||||
added += 1
|
||||
|
||||
return added > 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user