@@ -110,15 +110,16 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas *
110
110
QActionGroup *angleButtonGroup = new QActionGroup ( menu ); // actions are exclusive for common angles
111
111
mCommonAngleActions = QMap<QAction *, double >();
112
112
QList< QPair< double , QString > > commonAngles;
113
- commonAngles << QPair<double , QString>( 0 , tr ( " Do not snap to common angles" ) );
114
- commonAngles << QPair<double , QString>( 5 , tr ( " Snap to 5° angles" ) );
115
- commonAngles << QPair<double , QString>( 10 , tr ( " Snap to 10° angles" ) );
116
- commonAngles << QPair<double , QString>( 15 , tr ( " Snap to 15° angles" ) );
117
- commonAngles << QPair<double , QString>( 18 , tr ( " Snap to 18° angles" ) );
118
- commonAngles << QPair<double , QString>( 22.5 , tr ( " Snap to 22.5° angles" ) );
119
- commonAngles << QPair<double , QString>( 30 , tr ( " Snap to 30° angles" ) );
120
- commonAngles << QPair<double , QString>( 45 , tr ( " Snap to 45° angles" ) );
121
- commonAngles << QPair<double , QString>( 90 , tr ( " Snap to 90° angles" ) );
113
+ QString menuText;
114
+ QList<double > anglesDouble ( { 0.0 , 5.0 , 10.0 , 15.0 , 18.0 , 22.5 , 30.0 , 45.0 , 90.0 } );
115
+ for ( QList<double >::const_iterator it = anglesDouble.constBegin (); it != anglesDouble.constEnd (); ++it )
116
+ {
117
+ if ( *it == 0 )
118
+ menuText = tr ( " Do not snap to common angles" );
119
+ else
120
+ menuText = QString ( tr ( " %1, %2, %3, %4°..." ) ).arg ( *it, 0 , ' f' , 1 ).arg ( *it * 2 , 0 , ' f' , 1 ).arg ( *it * 3 , 0 , ' f' , 1 ).arg ( *it * 4 , 0 , ' f' , 1 );
121
+ commonAngles << QPair<double , QString>( *it, menuText );
122
+ }
122
123
for ( QList< QPair<double , QString > >::const_iterator it = commonAngles.constBegin (); it != commonAngles.constEnd (); ++it )
123
124
{
124
125
QAction *action = new QAction ( it->second , menu );
0 commit comments