mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
[db manager] Allow Rename action for rasters in GPKG with GDAL >=3.10
This commit is contained in:
parent
81c28c4e94
commit
b120bad22d
@ -49,6 +49,8 @@ try:
|
||||
except:
|
||||
isImportVectorAvail = False
|
||||
|
||||
from osgeo import gdal
|
||||
|
||||
|
||||
class TreeItem(QObject):
|
||||
deleted = pyqtSignal()
|
||||
@ -398,7 +400,10 @@ class DBModel(QAbstractItemModel):
|
||||
if index.column() == 0:
|
||||
item = index.internalPointer()
|
||||
|
||||
if isinstance(item, SchemaItem) or isinstance(item, TableItem):
|
||||
if isinstance(item, SchemaItem) \
|
||||
or (isinstance(item, TableItem)
|
||||
and not (self.hasGPKGSupport and item.getItemData().type == Table.RasterType
|
||||
and int(gdal.VersionInfo()) < 3100000)):
|
||||
flags |= Qt.ItemFlag.ItemIsEditable
|
||||
|
||||
if isinstance(item, TableItem):
|
||||
|
@ -25,9 +25,12 @@ from qgis.core import Qgis, QgsProject, QgsMessageLog
|
||||
from qgis.gui import QgsMessageBar, QgsMessageBarItem
|
||||
|
||||
from .db_model import DBModel, PluginItem
|
||||
from .db_plugins.gpkg.plugin import GPKGRasterTable
|
||||
from .db_plugins.plugin import DBPlugin, Schema, Table
|
||||
from .db_plugins.vlayers.plugin import LTable
|
||||
|
||||
from osgeo import gdal
|
||||
|
||||
|
||||
class DBTree(QTreeView):
|
||||
selectedItemChanged = pyqtSignal(object)
|
||||
@ -122,7 +125,8 @@ class DBTree(QTreeView):
|
||||
menu = QMenu(self)
|
||||
|
||||
if isinstance(item, (Table, Schema)) and not isinstance(item, LTable):
|
||||
menu.addAction(QCoreApplication.translate("DBTree", "Rename…"), self.rename)
|
||||
if not (isinstance(item, GPKGRasterTable) and int(gdal.VersionInfo()) < 3100000):
|
||||
menu.addAction(QCoreApplication.translate("DBTree", "Rename…"), self.rename)
|
||||
menu.addAction(QCoreApplication.translate("DBTree", "Delete…"), self.delete)
|
||||
|
||||
if isinstance(item, Table) and item.canBeAddedToCanvas():
|
||||
|
Loading…
x
Reference in New Issue
Block a user