[layouts] Expose designer enable atlas preview and show item options to

stable API
This commit is contained in:
Nyall Dawson 2018-10-12 09:37:31 +10:00
parent ab5c4fc8ef
commit 448b4505bb
4 changed files with 100 additions and 1 deletions

View File

@ -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;

View File

@ -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();
@ -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();

View File

@ -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;
@ -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
*/

View File

@ -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:
/**