Skip to content
Permalink
Browse files

[needs-docs] Make the Digitize with Curve and Streaming Digitize acti…

…ons sit in the same drop down group
  • Loading branch information
nyalldawson committed Mar 11, 2021
1 parent 5260105 commit c5a0d1d4a01146d154b5730349e6d6929bab90ec
Showing with 36 additions and 10 deletions.
  1. +1 −1 src/app/maptools/qgsappmaptools.cpp
  2. +32 −7 src/app/qgisapp.cpp
  3. +2 −0 src/app/qgisapp.h
  4. +1 −2 src/ui/qgisapp.ui
@@ -92,7 +92,7 @@ QgsStreamDigitizingSettingsAction::QgsStreamDigitizingSettingsAction( QWidget *p
mStreamToleranceSpinBox->setClearValue( 2 );
mStreamToleranceSpinBox->setValue( defaultTolerance );

QLabel *label = new QLabel( tr( "Tolerance" ) );
QLabel *label = new QLabel( tr( "Streaming Tolerance" ) );
gLayout->addWidget( label, 1, 0 );
gLayout->addWidget( mStreamToleranceSpinBox, 1, 1 );
connect( mStreamToleranceSpinBox, qgis::overload<int>::of( &QgsSpinBox::valueChanged ), this, [ = ]( int value )
@@ -3209,12 +3209,25 @@ void QgisApp::createToolBars()
static_cast< void ( QgsDoubleSpinBox::* )( double ) >( &QgsDoubleSpinBox::valueChanged ),
this, [ = ]( double v ) { mTracer->setOffset( v ); } );

QToolButton *bt = new QToolButton();
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionStreamDigitize );
bt->addAction( mMapTools->streamDigitizingSettingsAction() );
bt->setDefaultAction( mActionStreamDigitize );
mAdvancedDigitizeToolBar->insertWidget( mAdvancedDigitizeToolBar->actions().at( 0 ), bt );
mDigitizeModeToolButton = new QToolButton();
mDigitizeModeToolButton->setPopupMode( QToolButton::MenuButtonPopup );
QMenu *digitizeMenu = new QMenu();
digitizeMenu->addAction( mActionDigitizeWithCurve );
digitizeMenu->addAction( mActionStreamDigitize );
digitizeMenu->addSeparator();
digitizeMenu->addAction( mMapTools->streamDigitizingSettingsAction() );
mDigitizeModeToolButton->setMenu( digitizeMenu );

switch ( settings.value( QStringLiteral( "UI/digitizeTechnique" ), 0 ).toInt() )
{
case 0:
mDigitizeModeToolButton->setDefaultAction( mActionDigitizeWithCurve );
break;
case 1:
mDigitizeModeToolButton->setDefaultAction( mActionStreamDigitize );
break;
}
mAdvancedDigitizeToolBar->insertWidget( mAdvancedDigitizeToolBar->actions().at( 0 ), mDigitizeModeToolButton );

QList<QAction *> toolbarMenuActions;
// Set action names so that they can be used in customization
@@ -3231,7 +3244,7 @@ void QgisApp::createToolBars()
mToolbarMenu->addActions( toolbarMenuActions );

// advanced selection tool button
bt = new QToolButton( mSelectionToolBar );
QToolButton *bt = new QToolButton( mSelectionToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionSelectByForm );
bt->addAction( mActionSelectByExpression );
@@ -10130,6 +10143,12 @@ void QgisApp::enableDigitizeWithCurve( bool enable )
enableStreamDigitizing( false );
}

if ( enable )
{
mDigitizeModeToolButton->setDefaultAction( mActionDigitizeWithCurve );
QgsSettings().setValue( QStringLiteral( "UI/digitizeTechnique" ), 0 );
}

const QList< QgsMapToolCapture * > captureTools = mMapTools->captureTools();
for ( QgsMapToolCapture *tool : captureTools )
{
@@ -10148,6 +10167,12 @@ void QgisApp::enableStreamDigitizing( bool enable )
enableDigitizeWithCurve( false );
}

if ( enable )
{
mDigitizeModeToolButton->setDefaultAction( mActionStreamDigitize );
QgsSettings().setValue( QStringLiteral( "UI/digitizeTechnique" ), 1 );
}

const QList< QgsMapToolCapture * > captureTools = mMapTools->captureTools();
for ( QgsMapToolCapture *tool : captureTools )
{
@@ -2531,6 +2531,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsDockWidget *mDevToolsDock = nullptr;
QgsDevToolsPanelWidget *mDevToolsWidget = nullptr;

QToolButton *mDigitizeModeToolButton = nullptr;

//! Persistent tile scale slider
QgsTileScaleWidget *mpTileScaleWidget = nullptr;

@@ -521,7 +521,6 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionDigitizeWithCurve"/>
<addaction name="mActionRotateFeature"/>
<addaction name="mActionScaleFeature"/>
<addaction name="mActionSimplifyFeature"/>
@@ -3468,7 +3467,7 @@ Shows placeholders for labels which could not be placed, e.g. due to overlaps wi
<normaloff>:/images/themes/default/mActionDigitizeWithCurve.svg</normaloff>:/images/themes/default/mActionDigitizeWithCurve.svg</iconset>
</property>
<property name="text">
<string>Digitize with curve</string>
<string>Digitize with Curve</string>
</property>
<property name="toolTip">
<string>Digitize with curve</string>

0 comments on commit c5a0d1d

Please sign in to comment.