Class: QgsCustomProjectOpenHandler¶
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.
Added in version 3.14.
Class Hierarchy¶
Base classes¶
Methods
Returns |
|
Returns file filters associated with this handler, e.g. "MXD Documents (.mxd)", "MapInfo Workspaces (.wor)". |
|
Called when the specified project file has been opened within QGIS. |
|
Returns a custom icon used to represent this handler. |
- class qgis.gui.QgsCustomProjectOpenHandler[source]¶
Bases:
QObject- createDocumentThumbnailAfterOpen(self) bool[source]¶
Returns
Trueif a document thumbnail should automatically be created after opening the project.The default behavior is to return
False.- Return type:
bool
- filters(self) List[str][source]¶
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 | None) bool[source]¶
Called when the specified project
filehas been opened within QGIS. IfTrueis returned, then the handler has accepted this file and it should not be further processed (e.g. by otherQgsCustomProjectOpenHandler).It it is the subclasses’ responsibility to ignore file types it cannot handle by returning
Falsefor these.The base class implementation does nothing.
- Parameters:
file (Optional[str])
- Return type:
bool