Skip to content

Commit

Permalink
[api] Add QgsLayoutDesignerInterface.layoutExported signal
Browse files Browse the repository at this point in the history
Emitted whenever the layout is exported from the designer
  • Loading branch information
nyalldawson committed Jun 9, 2021
1 parent e627144 commit 6bd24e5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in
Expand Up @@ -457,6 +457,16 @@ Toggles whether or not the rulers should be ``visible`` in the designer.
.. versionadded:: 3.4
%End

signals:

void layoutExported();
%Docstring
Emitted whenever a layout is exported from the layout designer.

The results of the export can be retrieved by calling :py:func:`~QgsLayoutDesignerInterface.lastExportResults`.

.. versionadded:: 3.20
%End

};

Expand Down
6 changes: 5 additions & 1 deletion src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -113,7 +113,9 @@ bool QgsLayoutDesignerDialog::sInitializedRegistry = false;
QgsAppLayoutDesignerInterface::QgsAppLayoutDesignerInterface( QgsLayoutDesignerDialog *dialog )
: QgsLayoutDesignerInterface( dialog )
, mDesigner( dialog )
{}
{
connect( mDesigner, &QgsLayoutDesignerDialog::layoutExported, this, &QgsLayoutDesignerInterface::layoutExported );
}

QWidget *QgsAppLayoutDesignerInterface::window()
{
Expand Down Expand Up @@ -4904,6 +4906,8 @@ void QgsLayoutDesignerDialog::storeExportResults( QgsLayoutExporter::ExportResul
qDeleteAll( mLastExportLabelingResults );
mLastExportLabelingResults.clear();
}

emit layoutExported();
}

void QgsLayoutDesignerDialog::selectItems( const QList<QgsLayoutItem *> &items )
Expand Down
6 changes: 6 additions & 0 deletions src/app/layout/qgslayoutdesignerdialog.h
Expand Up @@ -338,6 +338,12 @@ class QgsLayoutDesignerDialog: public QMainWindow, public Ui::QgsLayoutDesignerB
*/
void aboutToClose();

/**
* Emitted whenever a layout is exported from the layout designer.
*
*/
void layoutExported();

protected:

void closeEvent( QCloseEvent * ) override;
Expand Down
10 changes: 10 additions & 0 deletions src/gui/layout/qgslayoutdesignerinterface.h
Expand Up @@ -398,6 +398,16 @@ class GUI_EXPORT QgsLayoutDesignerInterface: public QObject
*/
virtual void showRulers( bool visible ) = 0;

signals:

/**
* Emitted whenever a layout is exported from the layout designer.
*
* The results of the export can be retrieved by calling lastExportResults().
*
* \since QGIS 3.20
*/
void layoutExported();

};

Expand Down

0 comments on commit 6bd24e5

Please sign in to comment.