9#ifndef KISTOOLSELECTBASE_H
10#define KISTOOLSELECTBASE_H
73template <
class BaseClass>
88 : BaseClass(canvas, cursor)
96 : BaseClass(canvas, cursor, delegateTool)
124 this->action(
"selection_tool_mode_replace")->shortcut());
127 this->action(
"selection_tool_mode_add")->shortcut());
130 this->action(
"selection_tool_mode_subtract")->shortcut());
133 this->action(
"selection_tool_mode_intersect")->shortcut());
137 void activate(
const QSet<KoShape *> &shapes)
override
139 BaseClass::activate(shapes);
142 this->action(
"selection_tool_mode_replace"), SIGNAL(triggered()),
146 this->action(
"selection_tool_mode_add"), SIGNAL(triggered()),
150 this->action(
"selection_tool_mode_subtract"), SIGNAL(triggered()),
154 this->action(
"selection_tool_mode_intersect"), SIGNAL(triggered()),
173 BaseClass::deactivate();
182 this->connect(
this, SIGNAL(isActiveChanged(
bool)), &
m_widgetHelper, SLOT(slotToolActivatedChanged(
bool)));
186 SLOT(resetCursorStyle()));
281 BaseClass::activatePrimaryAction();
287 BaseClass::deactivatePrimaryAction();
350 if (modifiers != Qt::NoModifier)
return 0;
360 QPainterPath samplePath;
361 samplePath.addEllipse(pos, handleRadius, handleRadius);
363 const QPainterPath selectionPath = selection->
outlineCache();
365 if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
367 if (parent && parent->isEditable()) {
388 if (key == Qt::Key_Control || event->modifiers().testFlag(Qt::ControlModifier)) {
391 if (key == Qt::Key_Shift || event->modifiers().testFlag(Qt::ShiftModifier)) {
394 if (key == Qt::Key_Alt || event->modifiers().testFlag(Qt::AltModifier)) {
400 BaseClass::keyPressEvent(event);
414 if (key == Qt::Key_Control || !event->modifiers().testFlag(Qt::ControlModifier)) {
417 if (key == Qt::Key_Shift || !event->modifiers().testFlag(Qt::ShiftModifier)) {
420 if (key == Qt::Key_Alt || !event->modifiers().testFlag(Qt::AltModifier)) {
426 BaseClass::keyReleaseEvent(event);
438 this->resetCursorStyle();
453 BaseClass::mouseMoveEvent(event);
471 const QPainterPath selectionPath = selection->
outlineCache();
473 if (modifiers == Qt::NoModifier) {
476 QPainterPath samplePath;
477 samplePath.addEllipse(pos, handleRadius, handleRadius);
479 if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
484 if (selectionPath.contains(pos)) {
495 BaseClass::beginPrimaryAction(event);
508 BaseClass::beginPrimaryAction(event);
518 const QPointF pos = this->convertToPixelCoord(event->
point);
559 BaseClass::beginPrimaryAction(event);
565 const QPointF pos = this->convertToPixelCoord(event->
point);
573 BaseClass::continuePrimaryAction(event);
579 const QPointF pos = this->convertToPixelCoord(event->
point);
591 BaseClass::endPrimaryAction(event);
602 return BaseClass::popupActionsMenu();
614 return BaseClass::popupWidget();
713 this->resetCursorStyle();
717 this->resetCursorStyle();
728 this->resetCursorStyle();
731 this->resetCursorStyle();
735 this->resetCursorStyle();
740 this->resetCursorStyle();
749 this->resetCursorStyle();
753 this->resetCursorStyle();
760 QTimer::singleShot(100, Qt::CoarseTimer,
770 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