Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE][API] Allow plugins to register custom "Project Open" handlers
These allow plugins to extend the "Open Project" dialog by adding in support for new file filters, which appear in the formats drop down list alongside the existing "QGS Projects" entry. Custom project open handlers then get first chance at loading project files. This allows plugins to extend QGIS support by adding integrated support for opening projects from non QGS/QGZ formats, e.g. allowing users to open ArcGIS MXD documents or MapInfo WOR Workspaces direct from the project open dialog. These non-native projects are also added to the recent projects list and welcome screen, giving them a truly first-class experience within QGIS. Sponsored by SLYR
- Loading branch information
1 parent
8fa6338
commit 2716415
Showing
11 changed files
with
275 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
python/gui/auto_generated/qgscustomprojectopenhandler.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgscustomprojectopenhandler.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsCustomProjectOpenHandler : QObject | ||
{ | ||
%Docstring | ||
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. | ||
|
||
.. versionadded:: 3.14 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgscustomprojectopenhandler.h" | ||
%End | ||
public: | ||
|
||
virtual bool handleProjectOpen( const QString &file ) = 0; | ||
%Docstring | ||
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' responsiblity to ignore file types it cannot handle | ||
by returning ``False`` for these. | ||
|
||
The base class implementation does nothing. | ||
%End | ||
|
||
virtual QStringList filters() const = 0; | ||
%Docstring | ||
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. | ||
%End | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgscustomprojectopenhandler.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*************************************************************************** | ||
qgscustomprojectopenhandler.h | ||
--------------------- | ||
begin : April 2020 | ||
copyright : (C) 2020 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgscustomprojectopenhandler.h" |
Oops, something went wrong.