Skip to content

Commit

Permalink
Add a manual refresh button in profile toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 27, 2023
1 parent 7f03ce6 commit ce17f59
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/gui/layout/qgslayoutelevationprofilewidget.cpp
Expand Up @@ -51,6 +51,16 @@ QgsLayoutElevationProfileWidget::QgsLayoutElevationProfileWidget( QgsLayoutItemE
sBuildCopyMenuFunction( this, mCopyFromDockMenu );
} );

connect( mActionRefresh, &QAction::triggered, this, [ = ]
{
if ( !mProfile )
{
return;
}
mProfile->invalidateCache();
mProfile->refresh();
} );

QToolButton *copyFromDockButton = new QToolButton();
copyFromDockButton->setAutoRaise( true );
copyFromDockButton->setToolTip( tr( "Copy From Profile" ) );
Expand Down
17 changes: 16 additions & 1 deletion src/ui/layout/qgslayoutelevationprofilewidgetbase.ui
Expand Up @@ -62,6 +62,7 @@
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="mActionRefresh"/>
</widget>
</item>
<item>
Expand Down Expand Up @@ -729,6 +730,18 @@
</widget>
</item>
</layout>
<action name="mActionRefresh">
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mActionRefresh.svg</normaloff>:/images/themes/default/mActionRefresh.svg</iconset>
</property>
<property name="text">
<string>Refresh Elevation Profile</string>
</property>
<property name="toolTip">
<string>Refresh Elevation Profile</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down Expand Up @@ -768,6 +781,8 @@
<tabstops>
<tabstop>scrollArea</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit ce17f59

Please sign in to comment.