Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[layouts] Expose designer enable atlas preview and show item options to
stable API
  • Loading branch information
nyalldawson committed Oct 12, 2018
1 parent ab5c4fc commit 448b450
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 1 deletion.
29 changes: 29 additions & 0 deletions python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in
Expand Up @@ -62,6 +62,35 @@ Returns the designer's message bar.
Selects the specified ``items``.
%End

virtual void setAtlasPreviewEnabled( bool enabled ) = 0;
%Docstring
Toggles whether the atlas preview mode should be ``enabled`` in the designer.

.. seealso:: :py:func:`atlasPreviewModeEnabled`

.. versionadded:: 3.4
%End

virtual bool atlasPreviewEnabled() const = 0;
%Docstring
Returns whether the atlas preview mode is enabled in the designer.

.. seealso:: :py:func:`setAtlasPreviewEnabled`

.. versionadded:: 3.4
%End

virtual void showItemOptions( QgsLayoutItem *item, bool bringPanelToFront = true ) = 0;
%Docstring
Shows the configuration widget for the specified layout ``item``.

If ``bringPanelToFront`` is true, then the item properties panel will be automatically
shown and raised to the top of the interface.

.. versionadded:: 3.4
%End


public slots:

virtual void close() = 0;
Expand Down
26 changes: 26 additions & 0 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -127,6 +127,21 @@ void QgsAppLayoutDesignerInterface::selectItems( const QList<QgsLayoutItem *> &i
mDesigner->selectItems( items );
}

void QgsAppLayoutDesignerInterface::setAtlasPreviewEnabled( bool enabled )
{
mDesigner->setAtlasPreviewEnabled( enabled );
}

bool QgsAppLayoutDesignerInterface::atlasPreviewEnabled() const
{
return mDesigner->atlasPreviewEnabled();
}

void QgsAppLayoutDesignerInterface::showItemOptions( QgsLayoutItem *item, bool bringPanelToFront )
{
mDesigner->showItemOptions( item, bringPanelToFront );
}

void QgsAppLayoutDesignerInterface::close()
{
mDesigner->close();
Expand Down Expand Up @@ -4315,6 +4330,17 @@ QgsMessageBar *QgsLayoutDesignerDialog::messageBar()
return mMessageBar;
}

void QgsLayoutDesignerDialog::setAtlasPreviewEnabled( bool enabled )
{
whileBlocking( mActionAtlasPreview )->setChecked( enabled );
atlasPreviewTriggered( enabled );
}

bool QgsLayoutDesignerDialog::atlasPreviewEnabled() const
{
return mActionAtlasPreview->isChecked();
}

void QgsLayoutDesignerDialog::setAtlasFeature( QgsMapLayer *layer, const QgsFeature &feat )
{
QgsLayoutAtlas *layoutAtlas = atlas();
Expand Down
19 changes: 18 additions & 1 deletion src/app/layout/qgslayoutdesignerdialog.h
Expand Up @@ -60,7 +60,9 @@ class QgsAppLayoutDesignerInterface : public QgsLayoutDesignerInterface
QgsLayoutView *view() override;
QgsMessageBar *messageBar() override;
void selectItems( const QList< QgsLayoutItem * > &items ) override;

void setAtlasPreviewEnabled( bool enabled ) override;
bool atlasPreviewEnabled() const override;
void showItemOptions( QgsLayoutItem *item, bool bringPanelToFront = true ) override;
public slots:

void close() override;
Expand Down Expand Up @@ -139,6 +141,21 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
*/
QgsMessageBar *messageBar();


/**
* Toggles whether the atlas preview mode should be \a enabled in the designer.
*
* \see atlasPreviewModeEnabled()
*/
void setAtlasPreviewEnabled( bool enabled );

/**
* Returns whether the atlas preview mode is enabled in the designer.
*
* \see setAtlasPreviewEnabled()
*/
bool atlasPreviewEnabled() const;

/**
* Sets the specified feature as the current atlas feature
*/
Expand Down
27 changes: 27 additions & 0 deletions src/gui/layout/qgslayoutdesignerinterface.h
Expand Up @@ -78,6 +78,33 @@ class GUI_EXPORT QgsLayoutDesignerInterface: public QObject
*/
virtual void selectItems( const QList< QgsLayoutItem * > &items ) = 0;

/**
* Toggles whether the atlas preview mode should be \a enabled in the designer.
*
* \see atlasPreviewModeEnabled()
* \since QGIS 3.4
*/
virtual void setAtlasPreviewEnabled( bool enabled ) = 0;

/**
* Returns whether the atlas preview mode is enabled in the designer.
*
* \see setAtlasPreviewEnabled()
* \since QGIS 3.4
*/
virtual bool atlasPreviewEnabled() const = 0;

/**
* Shows the configuration widget for the specified layout \a item.
*
* If \a bringPanelToFront is true, then the item properties panel will be automatically
* shown and raised to the top of the interface.
*
* \since QGIS 3.4
*/
virtual void showItemOptions( QgsLayoutItem *item, bool bringPanelToFront = true ) = 0;


public slots:

/**
Expand Down

0 comments on commit 448b450

Please sign in to comment.