47 QWidget *toolWidget =
new QWidget();
49 QGridLayout *layout =
new QGridLayout( toolWidget );
50 layout->setContentsMargins( 0, 0, 0, 0 );
51 toolWidget->setLayout( layout );
53 QLabel *label =
new QLabel( tr(
"Circle #1" ), toolWidget );
54 layout->addWidget( label, 0, 0, 1, 3 );
56 mCircle1Digitize =
new QToolButton( toolWidget );
57 mCircle1Digitize->setCheckable(
true );
58 mCircle1Digitize->setChecked(
false );
60 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 )
115 mCircle1Digitize->setChecked(
false );
118 layout->addWidget( mCircle2Digitize, 5, 2, 2, 1 );
120 label =
new QLabel( QStringLiteral(
"x" ), toolWidget );
121 layout->addWidget( label, 5, 0 );
124 mCircle2X->setToolTip( tr(
"X coordinate" ) );
125 mCircle2X->setMinimum( std::numeric_limits<double>::lowest() );
126 mCircle2X->setMaximum( std::numeric_limits<double>::max() );
127 mCircle2X->setDecimals(
mCadDockWidget->constraintX()->precision() );
130 layout->addWidget( mCircle2X, 5, 1 );
132 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
133 layout->addWidget( label, 6, 0 );
136 mCircle2Y->setToolTip( tr(
"Y coordinate" ) );
137 mCircle2Y->setMinimum( std::numeric_limits<double>::lowest() );
138 mCircle2Y->setMaximum( std::numeric_limits<double>::max() );
139 mCircle2Y->setDecimals(
mCadDockWidget->constraintY()->precision() );
142 layout->addWidget( mCircle2Y, 6, 1 );
144 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
145 layout->addWidget( label, 7, 0 );
148 mCircle1Distance->setToolTip( tr(
"Distance" ) );
149 mCircle2Distance->setMinimum( 0 );
150 mCircle2Distance->setMaximum( std::numeric_limits<double>::max() );
151 mCircle2Distance->setDecimals(
mCadDockWidget->constraintX()->precision() );
152 layout->addWidget( mCircle2Distance, 7, 1 );
154 connect( mCircle1X,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
155 connect( mCircle1Y,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
156 connect( mCircle1Distance,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
157 connect( mCircle2X,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
158 connect( mCircle2Y,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
159 connect( mCircle2Distance,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
162 bool focusOnCircle2 =
false;
174 focusOnCircle2 =
true;
181 if ( focusOnCircle2 )
183 mCircle2Digitize->setChecked(
true );
187 mCircle1Digitize->setChecked(
true );
190 toolWidget->installEventFilter(
this );
192 mToolWidget = toolWidget;