8#ifndef KISTOOLSELECTBASE_H
9#define KISTOOLSELECTBASE_H
61template <
class BaseClass>
76 : BaseClass(canvas, cursor)
84 : BaseClass(canvas, cursor, delegateTool)
111 this->action(
"selection_tool_mode_replace")->shortcut());
114 this->action(
"selection_tool_mode_add")->shortcut());
117 this->action(
"selection_tool_mode_subtract")->shortcut());
120 this->action(
"selection_tool_mode_intersect")->shortcut());
124 void activate(
const QSet<KoShape *> &shapes)
override
126 BaseClass::activate(shapes);
129 this->action(
"selection_tool_mode_replace"), SIGNAL(triggered()),
133 this->action(
"selection_tool_mode_add"), SIGNAL(triggered()),
137 this->action(
"selection_tool_mode_subtract"), SIGNAL(triggered()),
141 this->action(
"selection_tool_mode_intersect"), SIGNAL(triggered()),
160 BaseClass::deactivate();
169 this->connect(
this, SIGNAL(isActiveChanged(
bool)), &
m_widgetHelper, SLOT(slotToolActivatedChanged(
bool)));
173 SLOT(resetCursorStyle()));
266 BaseClass::activatePrimaryAction();
272 BaseClass::deactivatePrimaryAction();
330 if (modifiers != Qt::NoModifier)
return 0;
340 QPainterPath samplePath;
341 samplePath.addEllipse(pos, handleRadius, handleRadius);
343 const QPainterPath selectionPath = selection->
outlineCache();
345 if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
347 if (parent && parent->isEditable()) {
362 if (key == Qt::Key_Control || event->modifiers().testFlag(Qt::ControlModifier)) {
365 if (key == Qt::Key_Shift || event->modifiers().testFlag(Qt::ShiftModifier)) {
368 if (key == Qt::Key_Alt || event->modifiers().testFlag(Qt::AltModifier)) {
374 BaseClass::keyPressEvent(event);
391 if (key == Qt::Key_Control || !event->modifiers().testFlag(Qt::ControlModifier)) {
394 if (key == Qt::Key_Shift || !event->modifiers().testFlag(Qt::ShiftModifier)) {
397 if (key == Qt::Key_Alt || !event->modifiers().testFlag(Qt::AltModifier)) {
403 BaseClass::keyReleaseEvent(event);
415 this->resetCursorStyle();
425 BaseClass::mouseMoveEvent(event);
438 const QPainterPath selectionPath = selection->
outlineCache();
440 if (modifiers == Qt::NoModifier) {
443 QPainterPath samplePath;
444 samplePath.addEllipse(pos, handleRadius, handleRadius);
446 if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
451 if (selectionPath.contains(pos)) {
462 BaseClass::beginPrimaryAction(event);
475 BaseClass::beginPrimaryAction(event);
485 const QPointF pos = this->convertToPixelCoord(event->
point);
526 BaseClass::beginPrimaryAction(event);
532 const QPointF pos = this->convertToPixelCoord(event->
point);
540 BaseClass::continuePrimaryAction(event);
546 const QPointF pos = this->convertToPixelCoord(event->
point);
558 BaseClass::endPrimaryAction(event);
569 return BaseClass::popupActionsMenu();
581 return BaseClass::popupWidget();
675 this->resetCursorStyle();
689 this->resetCursorStyle();
692 this->resetCursorStyle();
709 this->resetCursorStyle();
713 this->resetCursorStyle();
720 QTimer::singleShot(100, Qt::CoarseTimer,
730 using BaseClass::canvas;
KisCoordinatesConverter * coordinatesConverter
KisViewManager * viewManager() const
qreal effectiveZoom() const
static QCursor moveSelectionCursor()
static QCursor moveCursor()
static Qt::Key workaroundShiftAltMetaHell(const QKeyEvent *keyEvent)
void updateActionButtonToolTip(SelectionAction action, const QKeySequence &shortcut)
void setModeSectionVisible(bool visible)
void setAdjustmentsSectionVisible(bool visible)
void setReferenceSectionVisible(bool visible)
void addUniqueConnection(Sender sender, Signal signal, Receiver receiver, Method method)
KisSelectionSP selection()
Qt::KeyboardModifiers modifiers() const
QPointF point
The point in document coordinates.
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
static KisSelectionModifierMapper * instance()
SelectionAction map(Qt::KeyboardModifiers m)
bool outlineCacheValid() const
QPainterPath outlineCache() const