32#include "moc_qgsmaptoolselect.cpp"
44 mSelectionHandler = std::make_unique<QgsMapToolSelectionHandler>(
canvas );
51 mSelectionHandler->setSelectionMode( selectionMode );
60 mSelectionHandler->canvasPressEvent( e );
65 mSelectionHandler->canvasMoveEvent( e );
70 mSelectionHandler->canvasReleaseEvent( e );
75 if ( !e->isAutoRepeat() )
85 e->modifiers() & Qt::ControlModifier || e->key() == Qt::Key_Control,
86 e->modifiers() & Qt::ShiftModifier || e->key() == Qt::Key_Shift,
87 e->modifiers() & Qt::AltModifier || e->key() == Qt::Key_Alt || ( e->modifiers() & Qt::ControlModifier && e->modifiers() & Qt::ShiftModifier && e->key() == Qt::Key_Meta )
101 if ( mSelectionHandler->keyReleaseEvent( e ) )
104 if ( !e->isAutoRepeat() )
109 case Qt::Key_Control:
113 e->modifiers() & Qt::ControlModifier && e->key() != Qt::Key_Control,
114 e->modifiers() & Qt::ShiftModifier && e->key() != Qt::Key_Shift,
115 e->modifiers() & Qt::AltModifier && e->key() != Qt::Key_Alt && !( e->modifiers() & Qt::ControlModifier && e->modifiers() & Qt::ShiftModifier && e->key() == Qt::Key_Meta )
129 mSelectionHandler->deactivate();
135 switch ( mSelectionHandler->selectionMode() )
162 menu->addSeparator();
164 Qt::KeyboardModifiers modifiers = Qt::NoModifier;
168 modifiers =
event->modifiers();
169 mapPoint =
event->mapPoint();
172 if ( modifiers & Qt::ShiftModifier && modifiers & Qt::ControlModifier )
174 else if ( modifiers & Qt::ShiftModifier )
176 else if ( modifiers & Qt::ControlModifier )
190void QgsMapToolSelect::selectFeatures( Qt::KeyboardModifiers modifiers )
202void QgsMapToolSelect::modifiersChanged(
bool ctrlModifier,
bool shiftModifier,
bool altModifier )
204 if ( !ctrlModifier && !shiftModifier && !altModifier )
206 else if ( !ctrlModifier && !shiftModifier && altModifier )
208 else if ( !ctrlModifier && shiftModifier && !altModifier )
210 else if ( !ctrlModifier && shiftModifier && altModifier )
212 else if ( ctrlModifier && !shiftModifier && !altModifier )
214 else if ( ctrlModifier && !shiftModifier && altModifier )
216 else if ( ctrlModifier && shiftModifier && !altModifier )
218 else if ( ctrlModifier && shiftModifier && altModifier )
SelectBehavior
Specifies how a selection should be applied.
@ SetSelection
Set selection, removing any existing selection.
@ AddToSelection
Add selection to current selection.
@ IntersectSelection
Modify current selection to include only select features which match.
@ RemoveFromSelection
Remove from current selection.
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
@ Select
Select a rectangle.
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
Base class for all map layer types.
A mouse event which is the result of a user interaction with a QgsMapCanvas.
A rectangle specified with double values.
Represents a vector layer which manages a vector based dataset.
bool isSpatial() const final
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
QgsMapToolSelect(QgsMapCanvas *canvas)
A map tool for selecting features on a map canvas.