QGIS API Documentation  3.21.0-Master (5b68dc587e)
Public Member Functions | List of all members
QgsCustomProjectOpenHandler Class Referenceabstract

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

#include <qgscustomprojectopenhandler.h>

Inheritance diagram for QgsCustomProjectOpenHandler:
Inheritance graph
[legend]

Public Member Functions

virtual bool createDocumentThumbnailAfterOpen () const
 Returns true if a document thumbnail should automatically be created after opening the project. More...
 
virtual QStringList filters () const =0
 Returns file filters associated with this handler, e.g. More...
 
virtual bool handleProjectOpen (const QString &file)=0
 Called when the specified project file has been opened within QGIS. More...
 
virtual QIcon icon () const
 Returns a custom icon used to represent this handler. More...
 

Detailed Description

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.

Since
QGIS 3.14

Definition at line 37 of file qgscustomprojectopenhandler.h.

Member Function Documentation

◆ createDocumentThumbnailAfterOpen()

bool QgsCustomProjectOpenHandler::createDocumentThumbnailAfterOpen ( ) const
virtual

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

The default behavior is to return false.

Definition at line 19 of file qgscustomprojectopenhandler.cpp.

◆ filters()

virtual QStringList QgsCustomProjectOpenHandler::filters ( ) const
pure virtual

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.

◆ handleProjectOpen()

virtual bool QgsCustomProjectOpenHandler::handleProjectOpen ( const QString &  file)
pure virtual

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.

◆ icon()

QIcon QgsCustomProjectOpenHandler::icon ( ) const
virtual

Returns a custom icon used to represent this handler.

Definition at line 24 of file qgscustomprojectopenhandler.cpp.


The documentation for this class was generated from the following files: