Changeset View
Changeset View
Standalone View
Standalone View
lib/redeyereduction/redeyereductiontool.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | 175 | if (event->buttons() != Qt::LeftButton) { | |||
---|---|---|---|---|---|
177 | return; | 177 | return; | ||
178 | } | 178 | } | ||
179 | event->accept(); | 179 | event->accept(); | ||
180 | d->mToolWidget->mainDialogButtonBox->accepted(); | 180 | d->mToolWidget->mainDialogButtonBox->accepted(); | ||
181 | } | 181 | } | ||
182 | 182 | | |||
183 | void RedEyeReductionTool::keyPressEvent(QKeyEvent* event) | 183 | void RedEyeReductionTool::keyPressEvent(QKeyEvent* event) | ||
184 | { | 184 | { | ||
185 | QDialogButtonBox *buttons = d->mToolWidget->mainDialogButtonBox; | 185 | QDialogButtonBox *buttons; | ||
186 | if (d->mStatus == Adjusting) { | ||||
187 | buttons = d->mToolWidget->mainDialogButtonBox; | ||||
188 | } else { | ||||
189 | buttons = d->mToolWidget->helpDialogButtonBox; | ||||
190 | } | ||||
191 | | ||||
186 | switch (event->key()) { | 192 | switch (event->key()) { | ||
187 | case Qt::Key_Escape: | 193 | case Qt::Key_Escape: | ||
188 | event->accept(); | 194 | event->accept(); | ||
189 | buttons->rejected(); | 195 | buttons->rejected(); | ||
190 | break; | 196 | break; | ||
191 | case Qt::Key_Return: | 197 | case Qt::Key_Return: | ||
192 | case Qt::Key_Enter: { | 198 | case Qt::Key_Enter: { | ||
193 | event->accept(); | 199 | event->accept(); | ||
194 | auto focusButton = static_cast<QPushButton*>(buttons->focusWidget()); | 200 | auto focusButton = static_cast<QPushButton*>(buttons->focusWidget()); | ||
195 | if (focusButton && buttons->buttonRole(focusButton) == QDialogButtonBox::RejectRole) { | 201 | if (focusButton && buttons->buttonRole(focusButton) == QDialogButtonBox::RejectRole) { | ||
196 | buttons->rejected(); | 202 | buttons->rejected(); | ||
197 | } else if (d->mStatus == Adjusting) { | 203 | } else { | ||
198 | buttons->accepted(); | 204 | buttons->accepted(); | ||
199 | } | 205 | } | ||
200 | break; | 206 | break; | ||
201 | } | 207 | } | ||
202 | default: | 208 | default: | ||
203 | break; | 209 | break; | ||
204 | } | 210 | } | ||
205 | } | 211 | } | ||
Show All 32 Lines |