Changeset View
Changeset View
Standalone View
Standalone View
lib/crop/croptool.cpp
Show All 20 Lines | |||||
21 | // Self | 21 | // Self | ||
22 | #include "croptool.h" | 22 | #include "croptool.h" | ||
23 | 23 | | |||
24 | // Qt | 24 | // Qt | ||
25 | #include <QtMath> | 25 | #include <QtMath> | ||
26 | #include <QDialogButtonBox> | 26 | #include <QDialogButtonBox> | ||
27 | #include <QGraphicsSceneMouseEvent> | 27 | #include <QGraphicsSceneMouseEvent> | ||
28 | #include <QPainter> | 28 | #include <QPainter> | ||
29 | #include <QPushButton> | ||||
29 | #include <QRect> | 30 | #include <QRect> | ||
30 | #include <QDebug> | 31 | #include <QDebug> | ||
31 | 32 | | |||
32 | // KDE | 33 | // KDE | ||
33 | 34 | | |||
34 | // Local | 35 | // Local | ||
35 | #include <lib/documentview/rasterimageview.h> | 36 | #include <lib/documentview/rasterimageview.h> | ||
36 | #include "cropimageoperation.h" | 37 | #include "cropimageoperation.h" | ||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Line(s) | 415 | { | |||
419 | 420 | | |||
420 | QDialogButtonBox *buttons = d->mCropWidget->findChild<QDialogButtonBox *>(); | 421 | QDialogButtonBox *buttons = d->mCropWidget->findChild<QDialogButtonBox *>(); | ||
421 | switch (event->key()) { | 422 | switch (event->key()) { | ||
422 | case Qt::Key_Escape: | 423 | case Qt::Key_Escape: | ||
423 | event->accept(); | 424 | event->accept(); | ||
424 | buttons->rejected(); | 425 | buttons->rejected(); | ||
425 | break; | 426 | break; | ||
426 | case Qt::Key_Return: | 427 | case Qt::Key_Return: | ||
427 | case Qt::Key_Enter: | 428 | case Qt::Key_Enter: { | ||
428 | event->accept(); | 429 | event->accept(); | ||
430 | auto focusButton = static_cast<QPushButton*>(buttons->focusWidget()); | ||||
431 | if (focusButton && buttons->buttonRole(focusButton) == QDialogButtonBox::RejectRole) { | ||||
432 | buttons->rejected(); | ||||
433 | } else { | ||||
429 | buttons->accepted(); | 434 | buttons->accepted(); | ||
435 | } | ||||
430 | break; | 436 | break; | ||
437 | } | ||||
431 | default: | 438 | default: | ||
432 | break; | 439 | break; | ||
433 | } | 440 | } | ||
434 | } | 441 | } | ||
435 | 442 | | |||
436 | void CropTool::toolActivated() | 443 | void CropTool::toolActivated() | ||
437 | { | 444 | { | ||
438 | d->mCropWidget->setAdvancedSettingsEnabled(GwenviewConfig::cropAdvancedSettingsEnabled()); | 445 | d->mCropWidget->setAdvancedSettingsEnabled(GwenviewConfig::cropAdvancedSettingsEnabled()); | ||
Show All 35 Lines |