Skip to content

Commit 448b450

Browse files
committed
[layouts] Expose designer enable atlas preview and show item options to
stable API
1 parent ab5c4fc commit 448b450

File tree

4 files changed

+100
-1
lines changed

4 files changed

+100
-1
lines changed

python/gui/auto_generated/layout/qgslayoutdesignerinterface.sip.in

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,35 @@ Returns the designer's message bar.
6262
Selects the specified ``items``.
6363
%End
6464

65+
virtual void setAtlasPreviewEnabled( bool enabled ) = 0;
66+
%Docstring
67+
Toggles whether the atlas preview mode should be ``enabled`` in the designer.
68+
69+
.. seealso:: :py:func:`atlasPreviewModeEnabled`
70+
71+
.. versionadded:: 3.4
72+
%End
73+
74+
virtual bool atlasPreviewEnabled() const = 0;
75+
%Docstring
76+
Returns whether the atlas preview mode is enabled in the designer.
77+
78+
.. seealso:: :py:func:`setAtlasPreviewEnabled`
79+
80+
.. versionadded:: 3.4
81+
%End
82+
83+
virtual void showItemOptions( QgsLayoutItem *item, bool bringPanelToFront = true ) = 0;
84+
%Docstring
85+
Shows the configuration widget for the specified layout ``item``.
86+
87+
If ``bringPanelToFront`` is true, then the item properties panel will be automatically
88+
shown and raised to the top of the interface.
89+
90+
.. versionadded:: 3.4
91+
%End
92+
93+
6594
public slots:
6695

6796
virtual void close() = 0;

src/app/layout/qgslayoutdesignerdialog.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,21 @@ void QgsAppLayoutDesignerInterface::selectItems( const QList<QgsLayoutItem *> &i
127127
mDesigner->selectItems( items );
128128
}
129129

130+
void QgsAppLayoutDesignerInterface::setAtlasPreviewEnabled( bool enabled )
131+
{
132+
mDesigner->setAtlasPreviewEnabled( enabled );
133+
}
134+
135+
bool QgsAppLayoutDesignerInterface::atlasPreviewEnabled() const
136+
{
137+
return mDesigner->atlasPreviewEnabled();
138+
}
139+
140+
void QgsAppLayoutDesignerInterface::showItemOptions( QgsLayoutItem *item, bool bringPanelToFront )
141+
{
142+
mDesigner->showItemOptions( item, bringPanelToFront );
143+
}
144+
130145
void QgsAppLayoutDesignerInterface::close()
131146
{
132147
mDesigner->close();
@@ -4315,6 +4330,17 @@ QgsMessageBar *QgsLayoutDesignerDialog::messageBar()
43154330
return mMessageBar;
43164331
}
43174332

4333+
void QgsLayoutDesignerDialog::setAtlasPreviewEnabled( bool enabled )
4334+
{
4335+
whileBlocking( mActionAtlasPreview )->setChecked( enabled );
4336+
atlasPreviewTriggered( enabled );
4337+
}
4338+
4339+
bool QgsLayoutDesignerDialog::atlasPreviewEnabled() const
4340+
{
4341+
return mActionAtlasPreview->isChecked();
4342+
}
4343+
43184344
void QgsLayoutDesignerDialog::setAtlasFeature( QgsMapLayer *layer, const QgsFeature &feat )
43194345
{
43204346
QgsLayoutAtlas *layoutAtlas = atlas();

src/app/layout/qgslayoutdesignerdialog.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ class QgsAppLayoutDesignerInterface : public QgsLayoutDesignerInterface
6060
QgsLayoutView *view() override;
6161
QgsMessageBar *messageBar() override;
6262
void selectItems( const QList< QgsLayoutItem * > &items ) override;
63-
63+
void setAtlasPreviewEnabled( bool enabled ) override;
64+
bool atlasPreviewEnabled() const override;
65+
void showItemOptions( QgsLayoutItem *item, bool bringPanelToFront = true ) override;
6466
public slots:
6567

6668
void close() override;
@@ -139,6 +141,21 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
139141
*/
140142
QgsMessageBar *messageBar();
141143

144+
145+
/**
146+
* Toggles whether the atlas preview mode should be \a enabled in the designer.
147+
*
148+
* \see atlasPreviewModeEnabled()
149+
*/
150+
void setAtlasPreviewEnabled( bool enabled );
151+
152+
/**
153+
* Returns whether the atlas preview mode is enabled in the designer.
154+
*
155+
* \see setAtlasPreviewEnabled()
156+
*/
157+
bool atlasPreviewEnabled() const;
158+
142159
/**
143160
* Sets the specified feature as the current atlas feature
144161
*/

src/gui/layout/qgslayoutdesignerinterface.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,33 @@ class GUI_EXPORT QgsLayoutDesignerInterface: public QObject
7878
*/
7979
virtual void selectItems( const QList< QgsLayoutItem * > &items ) = 0;
8080

81+
/**
82+
* Toggles whether the atlas preview mode should be \a enabled in the designer.
83+
*
84+
* \see atlasPreviewModeEnabled()
85+
* \since QGIS 3.4
86+
*/
87+
virtual void setAtlasPreviewEnabled( bool enabled ) = 0;
88+
89+
/**
90+
* Returns whether the atlas preview mode is enabled in the designer.
91+
*
92+
* \see setAtlasPreviewEnabled()
93+
* \since QGIS 3.4
94+
*/
95+
virtual bool atlasPreviewEnabled() const = 0;
96+
97+
/**
98+
* Shows the configuration widget for the specified layout \a item.
99+
*
100+
* If \a bringPanelToFront is true, then the item properties panel will be automatically
101+
* shown and raised to the top of the interface.
102+
*
103+
* \since QGIS 3.4
104+
*/
105+
virtual void showItemOptions( QgsLayoutItem *item, bool bringPanelToFront = true ) = 0;
106+
107+
81108
public slots:
82109

83110
/**

0 commit comments

Comments
 (0)