48 QWidget *toolWidget =
new QWidget();
50 QGridLayout *layout =
new QGridLayout( toolWidget );
51 layout->setContentsMargins( 0, 0, 0, 0 );
52 toolWidget->setLayout( layout );
54 QLabel *label =
new QLabel( tr(
"Circle #1" ), toolWidget );
55 layout->addWidget( label, 0, 0, 1, 3 );
57 mCircle1Digitize =
new QToolButton( toolWidget );
58 mCircle1Digitize->setCheckable(
true );
59 mCircle1Digitize->setChecked(
false );
61 connect( mCircle1Digitize, &QAbstractButton::toggled,
this, [ = ](
bool checked )
65 mCircle2Digitize->setChecked(
false );
68 layout->addWidget( mCircle1Digitize, 1, 2, 2, 1 );
70 label =
new QLabel( QStringLiteral(
"x" ), toolWidget );
71 layout->addWidget( label, 1, 0 );
74 mCircle1X->setToolTip( tr(
"X coordinate" ) );
75 mCircle1X->setMinimum( std::numeric_limits<double>::lowest() );
76 mCircle1X->setMaximum( std::numeric_limits<double>::max() );
77 mCircle1X->setDecimals(
mCadDockWidget->constraintX()->precision() );
80 layout->addWidget( mCircle1X, 1, 1 );
82 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
83 layout->addWidget( label, 2, 0 );
86 mCircle1Y->setToolTip( tr(
"Y coordinate" ) );
87 mCircle1Y->setMinimum( std::numeric_limits<double>::lowest() );
88 mCircle1Y->setMaximum( std::numeric_limits<double>::max() );
89 mCircle1Y->setDecimals(
mCadDockWidget->constraintY()->precision() );
92 layout->addWidget( mCircle1Y, 2, 1 );
94 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
95 layout->addWidget( label, 3, 0 );
98 mCircle1Distance->setToolTip( tr(
"Distance" ) );
99 mCircle1Distance->setMinimum( 0 );
100 mCircle1Distance->setMaximum( std::numeric_limits<double>::max() );
101 mCircle1Distance->setDecimals(
mCadDockWidget->constraintX()->precision() );
103 layout->addWidget( mCircle1Distance, 3, 1 );
105 label =
new QLabel( tr(
"Circle #2" ), toolWidget );
106 layout->addWidget( label, 4, 0, 1, 3 );
108 mCircle2Digitize =
new QToolButton( toolWidget );
109 mCircle2Digitize->setCheckable(
true );
110 mCircle2Digitize->setChecked(
false );
112 connect( mCircle2Digitize, &QAbstractButton::toggled,
this, [ = ](
bool checked )
116 mCircle1Digitize->setChecked(
false );
119 layout->addWidget( mCircle2Digitize, 5, 2, 2, 1 );
121 label =
new QLabel( QStringLiteral(
"x" ), toolWidget );
122 layout->addWidget( label, 5, 0 );
125 mCircle2X->setToolTip( tr(
"X coordinate" ) );
126 mCircle2X->setMinimum( std::numeric_limits<double>::lowest() );
127 mCircle2X->setMaximum( std::numeric_limits<double>::max() );
128 mCircle2X->setDecimals(
mCadDockWidget->constraintX()->precision() );
131 layout->addWidget( mCircle2X, 5, 1 );
133 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
134 layout->addWidget( label, 6, 0 );
137 mCircle2Y->setToolTip( tr(
"Y coordinate" ) );
138 mCircle2Y->setMinimum( std::numeric_limits<double>::lowest() );
139 mCircle2Y->setMaximum( std::numeric_limits<double>::max() );
140 mCircle2Y->setDecimals(
mCadDockWidget->constraintY()->precision() );
143 layout->addWidget( mCircle2Y, 6, 1 );
145 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
146 layout->addWidget( label, 7, 0 );
149 mCircle1Distance->setToolTip( tr(
"Distance" ) );
150 mCircle2Distance->setMinimum( 0 );
151 mCircle2Distance->setMaximum( std::numeric_limits<double>::max() );
152 mCircle2Distance->setDecimals(
mCadDockWidget->constraintX()->precision() );
153 layout->addWidget( mCircle2Distance, 7, 1 );
155 connect( mCircle1X,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
156 connect( mCircle1Y,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
157 connect( mCircle1Distance,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
158 connect( mCircle2X,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
159 connect( mCircle2Y,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
160 connect( mCircle2Distance,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
163 bool focusOnCircle2 =
false;
175 focusOnCircle2 =
true;
182 if ( focusOnCircle2 )
184 mCircle2Digitize->setChecked(
true );
188 mCircle1Digitize->setChecked(
true );
191 toolWidget->installEventFilter(
this );
193 mToolWidget = toolWidget;