Class: QgsCustomProjectOpenHandler

class qgis.gui.QgsCustomProjectOpenHandler

Bases: PyQt5.QtCore.QObject

Abstract base class that may be implemented to handle new project file types within the QGIS application.

This interface allows extending the QGIS interface by adding support for opening additional (non QGS/QGZ) project files, e.g. allowing plugins to add support for opening other vendor project formats (such as ArcGIS MXD documents or MapInfo WOR workspaces).

Handler implementations should indicate the file types they support via their filters() implementation, and then implement handleProjectOpen() to open the associated files.

New in version 3.14:

Methods

childEvent

connectNotify

createDocumentThumbnailAfterOpen

Returns True if a document thumbnail should automatically be created after opening the project.

customEvent

disconnectNotify

filters

Returns file filters associated with this handler, e.g.

handleProjectOpen

Called when the specified project file has been opened within QGIS.

icon

Returns a custom icon used to represent this handler.

isSignalConnected

receivers

sender

senderSignalIndex

timerEvent

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createDocumentThumbnailAfterOpen(self) bool

Returns True if a document thumbnail should automatically be created after opening the project.

The default behavior is to return False.

Return type:

bool

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
filters(self) List[str]

Returns file filters associated with this handler, e.g. “MXD Documents (.mxd)”, “MapInfo Workspaces (.wor)”.

Each individual filter should be reflected as one entry in the returned list.

Return type:

List[str]

handleProjectOpen(self, file: str) bool

Called when the specified project file has been opened within QGIS. If True is returned, then the handler has accepted this file and it should not be further processed (e.g. by other QgsCustomProjectOpenHandler).

It it is the subclasses’ responsibility to ignore file types it cannot handle by returning False for these.

The base class implementation does nothing.

Parameters:

file (str) –

Return type:

bool

icon(self) QIcon

Returns a custom icon used to represent this handler.

Return type:

QIcon

isSignalConnected(self, QMetaMethod) bool
receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)