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() );
78 layout->addWidget( mCircle1X, 1, 1 );
80 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
81 layout->addWidget( label, 2, 0 );
84 mCircle1Y->setToolTip( tr(
"Y coordinate" ) );
85 mCircle1Y->setMinimum( std::numeric_limits<double>::lowest() );
86 mCircle1Y->setMaximum( std::numeric_limits<double>::max() );
89 layout->addWidget( mCircle1Y, 2, 1 );
91 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
92 layout->addWidget( label, 3, 0 );
95 mCircle1Distance->setToolTip( tr(
"Distance" ) );
96 mCircle1Distance->setMinimum( 0 );
97 mCircle1Distance->setMaximum( std::numeric_limits<double>::max() );
99 layout->addWidget( mCircle1Distance, 3, 1 );
101 label =
new QLabel( tr(
"Circle #2" ), toolWidget );
102 layout->addWidget( label, 4, 0, 1, 3 );
104 mCircle2Digitize =
new QToolButton( toolWidget );
105 mCircle2Digitize->setCheckable(
true );
106 mCircle2Digitize->setChecked(
false );
108 connect( mCircle2Digitize, &QAbstractButton::toggled,
this, [ = ](
bool checked )
112 mCircle1Digitize->setChecked(
false );
115 layout->addWidget( mCircle2Digitize, 5, 2, 2, 1 );
117 label =
new QLabel( QStringLiteral(
"x" ), toolWidget );
118 layout->addWidget( label, 5, 0 );
121 mCircle2X->setToolTip( tr(
"X coordinate" ) );
122 mCircle2X->setMinimum( std::numeric_limits<double>::lowest() );
123 mCircle2X->setMaximum( std::numeric_limits<double>::max() );
126 layout->addWidget( mCircle2X, 5, 1 );
128 label =
new QLabel( QStringLiteral(
"y" ), toolWidget );
129 layout->addWidget( label, 6, 0 );
132 mCircle2Y->setToolTip( tr(
"Y coordinate" ) );
133 mCircle2Y->setMinimum( std::numeric_limits<double>::lowest() );
134 mCircle2Y->setMaximum( std::numeric_limits<double>::max() );
137 layout->addWidget( mCircle2Y, 6, 1 );
139 label =
new QLabel( QStringLiteral(
"d" ), toolWidget );
140 layout->addWidget( label, 7, 0 );
143 mCircle1Distance->setToolTip( tr(
"Distance" ) );
144 mCircle2Distance->setMinimum( 0 );
145 mCircle2Distance->setMaximum( std::numeric_limits<double>::max() );
146 layout->addWidget( mCircle2Distance, 7, 1 );
148 connect( mCircle1X,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
149 connect( mCircle1Y,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
150 connect( mCircle1Distance,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
151 connect( mCircle2X,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
152 connect( mCircle2Y,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
153 connect( mCircle2Distance,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double ) { processParameters(); } );
156 bool focusOnCircle2 =
false;
168 focusOnCircle2 =
true;
175 if ( focusOnCircle2 )
177 mCircle2Digitize->setChecked(
true );
181 mCircle1Digitize->setChecked(
true );
184 toolWidget->installEventFilter(
this );
186 mToolWidget = toolWidget;