From a093dd7293d93fc59ba01b5904a5e91ee347a923 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 23 Oct 2018 09:29:56 +1000 Subject: [PATCH] [layouts] Add api to retrieve window from designer dialog interface --- .../layout/qgslayoutdesignerinterface.sip.in | 7 +++++++ src/app/layout/qgslayoutdesignerdialog.cpp | 5 +++++ src/app/layout/qgslayoutdesignerdialog.h | 1 + src/gui/layout/qgslayoutdesignerinterface.h | 7 +++++++ 4 files changed, 20 insertions(+) diff --git a/python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in b/python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in index ef5632b63b8..1c5dcea9c95 100644 --- a/python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in +++ b/python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in @@ -61,6 +61,13 @@ Returns the current layout displayed in the designer. Returns the master layout displayed in the designer. .. seealso:: :py:func:`layout` +%End + + virtual QWidget *window() = 0; +%Docstring +Returns a pointer to the designer window. + +.. versionadded:: 3.4 %End virtual QgsLayoutView *view() = 0; diff --git a/src/app/layout/qgslayoutdesignerdialog.cpp b/src/app/layout/qgslayoutdesignerdialog.cpp index 1efb7c4679d..ee370379250 100644 --- a/src/app/layout/qgslayoutdesignerdialog.cpp +++ b/src/app/layout/qgslayoutdesignerdialog.cpp @@ -102,6 +102,11 @@ QgsAppLayoutDesignerInterface::QgsAppLayoutDesignerInterface( QgsLayoutDesignerD , mDesigner( dialog ) {} +QWidget *QgsAppLayoutDesignerInterface::window() +{ + return mDesigner; +} + QgsLayout *QgsAppLayoutDesignerInterface::layout() { return mDesigner->currentLayout(); diff --git a/src/app/layout/qgslayoutdesignerdialog.h b/src/app/layout/qgslayoutdesignerdialog.h index 2ff12833c9a..1fc4ed275b1 100644 --- a/src/app/layout/qgslayoutdesignerdialog.h +++ b/src/app/layout/qgslayoutdesignerdialog.h @@ -55,6 +55,7 @@ class QgsAppLayoutDesignerInterface : public QgsLayoutDesignerInterface public: QgsAppLayoutDesignerInterface( QgsLayoutDesignerDialog *dialog ); + QWidget *window() override; QgsLayout *layout() override; QgsMasterLayoutInterface *masterLayout() override; QgsLayoutView *view() override; diff --git a/src/gui/layout/qgslayoutdesignerinterface.h b/src/gui/layout/qgslayoutdesignerinterface.h index db86a662b39..715017336a8 100644 --- a/src/gui/layout/qgslayoutdesignerinterface.h +++ b/src/gui/layout/qgslayoutdesignerinterface.h @@ -85,6 +85,13 @@ class GUI_EXPORT QgsLayoutDesignerInterface: public QObject */ virtual QgsMasterLayoutInterface *masterLayout() = 0; + /** + * Returns a pointer to the designer window. + * + * \since QGIS 3.4 + */ + virtual QWidget *window() = 0; + /** * Returns the layout view utilized by the designer. * \see layout()