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 ) {
64 mCircle2Digitize->setChecked(
false );
67 layout->addWidget( mCircle1Digitize, 1, 2, 2, 1 );
69 label =
new QLabel( QStringLiteral(
"x" ), toolWidget );
70 layout->addWidget( label, 1, 0 );
73 mCircle1X->setToolTip( tr(
"X coordinate" ) );
74 mCircle1X->setMinimum( std::numeric_limits<double>::lowest() );
75 mCircle1X->setMaximum( std::numeric_limits<double>::max() );
76 mCircle1X->setDecimals(
mCadDockWidget->constraintX()->precision() );
79 layout->addWidget( mCircle1X, 1, 1 );
81 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
82 layout->addWidget( label, 2, 0 );
85 mCircle1Y->setToolTip( tr(
"Y coordinate" ) );
86 mCircle1Y->setMinimum( std::numeric_limits<double>::lowest() );
87 mCircle1Y->setMaximum( std::numeric_limits<double>::max() );
88 mCircle1Y->setDecimals(
mCadDockWidget->constraintY()->precision() );
91 layout->addWidget( mCircle1Y, 2, 1 );
93 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
94 layout->addWidget( label, 3, 0 );
97 mCircle1Distance->setToolTip( tr(
"Distance" ) );
98 mCircle1Distance->setMinimum( 0 );
99 mCircle1Distance->setMaximum( std::numeric_limits<double>::max() );
100 mCircle1Distance->setDecimals(
mCadDockWidget->constraintX()->precision() );
102 layout->addWidget( mCircle1Distance, 3, 1 );
104 label =
new QLabel( tr(
"Circle #2" ), toolWidget );
105 layout->addWidget( label, 4, 0, 1, 3 );
107 mCircle2Digitize =
new QToolButton( toolWidget );
108 mCircle2Digitize->setCheckable(
true );
109 mCircle2Digitize->setChecked(
false );
111 connect( mCircle2Digitize, &QAbstractButton::toggled,
this, [=](
bool checked ) {
114 mCircle1Digitize->setChecked(
false );
117 layout->addWidget( mCircle2Digitize, 5, 2, 2, 1 );
119 label =
new QLabel( QStringLiteral(
"x" ), toolWidget );
120 layout->addWidget( label, 5, 0 );
123 mCircle2X->setToolTip( tr(
"X coordinate" ) );
124 mCircle2X->setMinimum( std::numeric_limits<double>::lowest() );
125 mCircle2X->setMaximum( std::numeric_limits<double>::max() );
126 mCircle2X->setDecimals(
mCadDockWidget->constraintX()->precision() );
129 layout->addWidget( mCircle2X, 5, 1 );
131 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
132 layout->addWidget( label, 6, 0 );
135 mCircle2Y->setToolTip( tr(
"Y coordinate" ) );
136 mCircle2Y->setMinimum( std::numeric_limits<double>::lowest() );
137 mCircle2Y->setMaximum( std::numeric_limits<double>::max() );
138 mCircle2Y->setDecimals(
mCadDockWidget->constraintY()->precision() );
141 layout->addWidget( mCircle2Y, 6, 1 );
143 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
144 layout->addWidget( label, 7, 0 );
147 mCircle1Distance->setToolTip( tr(
"Distance" ) );
148 mCircle2Distance->setMinimum( 0 );
149 mCircle2Distance->setMaximum( std::numeric_limits<double>::max() );
150 mCircle2Distance->setDecimals(
mCadDockWidget->constraintX()->precision() );
151 layout->addWidget( mCircle2Distance, 7, 1 );
153 connect( mCircle1X,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { processParameters(); } );
154 connect( mCircle1Y,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { processParameters(); } );
155 connect( mCircle1Distance,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { processParameters(); } );
156 connect( mCircle2X,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { processParameters(); } );
157 connect( mCircle2Y,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { processParameters(); } );
158 connect( mCircle2Distance,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double ) { processParameters(); } );
161 bool focusOnCircle2 =
false;
173 focusOnCircle2 =
true;
180 if ( focusOnCircle2 )
182 mCircle2Digitize->setChecked(
true );
186 mCircle1Digitize->setChecked(
true );
189 toolWidget->installEventFilter(
this );
191 mToolWidget = toolWidget;