8#ifndef KISTOOLSELECTBASE_H
9#define KISTOOLSELECTBASE_H
60template <
class BaseClass>
75 : BaseClass(canvas, cursor)
83 : BaseClass(canvas, cursor, delegateTool)
102 this->action(
"selection_tool_mode_replace")->shortcut());
105 this->action(
"selection_tool_mode_add")->shortcut());
108 this->action(
"selection_tool_mode_subtract")->shortcut());
111 this->action(
"selection_tool_mode_intersect")->shortcut());
115 void activate(
const QSet<KoShape *> &shapes)
override
117 BaseClass::activate(shapes);
120 this->action(
"selection_tool_mode_replace"), SIGNAL(triggered()),
124 this->action(
"selection_tool_mode_add"), SIGNAL(triggered()),
128 this->action(
"selection_tool_mode_subtract"), SIGNAL(triggered()),
132 this->action(
"selection_tool_mode_intersect"), SIGNAL(triggered()),
150 BaseClass::deactivate();
159 this->
connect(
this, SIGNAL(isActiveChanged(
bool)), &
m_widgetHelper, SLOT(slotToolActivatedChanged(
bool)));
163 SLOT(resetCursorStyle()));
251 BaseClass::activatePrimaryAction();
257 BaseClass::deactivatePrimaryAction();
282 if (modifiers != Qt::NoModifier)
return 0;
292 QPainterPath samplePath;
293 samplePath.addEllipse(pos, handleRadius, handleRadius);
295 const QPainterPath selectionPath = selection->
outlineCache();
297 if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
299 if (parent && parent->isEditable()) {
314 if (key == Qt::Key_Control || event->modifiers().testFlag(Qt::ControlModifier)) {
317 if (key == Qt::Key_Shift || event->modifiers().testFlag(Qt::ShiftModifier)) {
320 if (key == Qt::Key_Alt || event->modifiers().testFlag(Qt::AltModifier)) {
326 BaseClass::keyPressEvent(event);
334 this->resetCursorStyle();
343 if (key == Qt::Key_Control || !event->modifiers().testFlag(Qt::ControlModifier)) {
346 if (key == Qt::Key_Shift || !event->modifiers().testFlag(Qt::ShiftModifier)) {
349 if (key == Qt::Key_Alt || !event->modifiers().testFlag(Qt::AltModifier)) {
355 BaseClass::keyReleaseEvent(event);
368 this->resetCursorStyle();
371 this->resetCursorStyle();
380 BaseClass::mouseMoveEvent(event);
392 this->resetCursorStyle();
399 BaseClass::beginPrimaryAction(event);
406 const QPointF pos = this->convertToPixelCoord(event->
point);
422 BaseClass::beginPrimaryAction(event);
428 const QPointF pos = this->convertToPixelCoord(event->
point);
435 BaseClass::continuePrimaryAction(event);
447 BaseClass::endPrimaryAction(event);
458 return BaseClass::popupActionsMenu();
470 return BaseClass::popupWidget();
519 QTimer::singleShot(100, Qt::CoarseTimer,
527 this->resetCursorStyle();
534 using BaseClass::canvas;
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisCoordinatesConverter * coordinatesConverter
KisViewManager * viewManager() const
qreal effectiveZoom() const
static QCursor moveSelectionCursor()
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