hydrogen 1.2.6
Selection.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2025 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef SELECTION_H
24#define SELECTION_H
25
26#include <QtGui>
27#include <QWidget>
28#include <QMouseEvent>
29#include <QApplication>
30#include <QScrollArea>
31#include <vector>
32#include <set>
33#include <QDebug>
34#include <cassert>
35#include <memory>
36
37#include <core/config.h>
40
46
48template <class Elem>
50public:
51
52 typedef Elem SelectionIndex;
53
56 virtual std::vector<SelectionIndex> elementsIntersecting( QRect r ) = 0;
57
59 virtual bool canDragElements() { return true; }
60
62 virtual QRect getKeyboardCursorRect() = 0;
63
65 virtual void validateSelection() = 0;
66
69 virtual void updateWidget() = 0;
70
72 virtual bool checkDeselectElements( std::vector<SelectionIndex> &elements ) {
73 return true;
74 }
75
76
87 virtual void mouseClickEvent( QMouseEvent *ev ) = 0;
88 virtual void mouseDragStartEvent( QMouseEvent *ev ) = 0;
89 virtual void mouseDragUpdateEvent( QMouseEvent *ev ) = 0;
90 virtual void mouseDragEndEvent( QMouseEvent *ev ) = 0;
91 virtual void selectionMoveUpdateEvent( QMouseEvent *ev ) {};
92 virtual void selectionMoveEndEvent( QInputEvent *ev ) = 0;
93 virtual void selectionMoveCancelEvent() {};
95
99 virtual void startMouseLasso( QMouseEvent *ev ) {}
100 virtual void startMouseMove( QMouseEvent *ev ) {}
101 virtual void endMouseGesture() {}
103
106 virtual QScrollArea *findScrollArea() {
107 QWidget *pThisWidget = dynamic_cast< QWidget *>( this );
108 if ( pThisWidget ) {
109 QWidget *pParent = dynamic_cast< QWidget *>( pThisWidget->parent() );
110 if ( pParent ) {
111 QScrollArea *pScrollArea = dynamic_cast< QScrollArea *>( pParent->parent() );
112 if ( pScrollArea ) {
113 return pScrollArea;
114 }
115 }
116 }
117 return nullptr;
118 }
119
120};
121
122
128
129class DragScroller : public QObject {
130 Q_OBJECT
131 QTimer *m_pTimer;
132 QScrollArea *m_pScrollArea;
133 const int m_nInterval = 20; // ms
134
135public:
136 DragScroller( QScrollArea *pScrollArea ) {
137 m_pTimer = nullptr;
138 m_pScrollArea = pScrollArea;
139 }
140
142 if ( m_pTimer != nullptr) {
143 delete m_pTimer;
144 }
145 }
146
147 void startDrag() {
148 if ( m_pTimer == nullptr ) {
149 m_pTimer = new QTimer( this );
150 m_pTimer->setInterval( m_nInterval );
151 connect( m_pTimer, &QTimer::timeout, this, &DragScroller::timeout );
152 }
153 m_pTimer->start();
154 }
155
156 void endDrag() {
157 m_pTimer->stop();
158 }
159
160public slots:
161 void timeout( void ) {
162 QWidget *pWidget = m_pScrollArea->widget();
163 QPoint pos = pWidget->mapFromGlobal( QCursor::pos() );
164 m_pScrollArea->ensureVisible( pos.x(), pos.y(), 1, 1 );
165 }
166};
167
191
193template<class Elem>
195
199 std::set<Elem> m_selectedElements;
200 std::set< SelectionWidget<Elem> *> m_selectionWidgets;
201 };
202
203 std::shared_ptr< SelectionGroup > m_pSelectionGroup;
205
206
207private:
209
229 Qt::MouseButton m_mouseButton;
230 QMouseEvent *m_pClickEvent;
232
233
256
257 QRect m_lasso;
261
265
268
269
270public:
271
273
274 m_pWidget = w;
275 m_mouseButton = Qt::NoButton;
277 m_pClickEvent = nullptr;
279 m_pSelectionGroup = std::make_shared< SelectionGroup >();
280 m_pSelectionGroup->m_selectionWidgets.insert( w );
281 m_pDragScroller = nullptr;
282
283 }
284
288 void merge( Selection *pOther ) {
289 if ( pOther != this ) {
290 pOther->m_pSelectionGroup->m_selectionWidgets.insert
291 ( m_pSelectionGroup->m_selectionWidgets.begin(),
292 m_pSelectionGroup->m_selectionWidgets.end() );
293 }
295 }
296
297 void dump() {
298
299 qDebug() << "Mouse state: " << ( m_mouseState == Up ? "Up" :
300 m_mouseState == Down ? "Down" :
301 m_mouseState == Dragging ? "Dragging" : "-" )
302 << "\n"
303 << "button: " << m_mouseButton << "\n"
304 << "Selection state: " << ( m_selectionState == Idle ? "Idle" :
305 m_selectionState == MouseLasso ? "MouseLasso" :
306 m_selectionState == MouseMoving ? "MouseMoving" :
307 m_selectionState == KeyboardLasso ? "KeyboardLasso" :
308 m_selectionState == KeyboardMoving ? "KeyboardMoving" :
309 "-")
310 << "";
311
312 }
313
314
316 bool isMoving() const {
318 }
319
321 bool isMouseGesture() const {
323 }
324
327 QPoint movingOffset() const {
328 return m_movingOffset;
329 }
330
332 bool isLasso() const {
334 }
335
337 bool isSelected( Elem e ) const {
338 return m_pSelectionGroup->m_selectedElements.find( e ) != m_pSelectionGroup->m_selectedElements.end();
339 }
340
341 void removeFromSelection( Elem e, bool bCheck = true ) {
342 std::vector<Elem> v { e };
343 if ( !bCheck || m_pWidget->checkDeselectElements( v ) ) {
344 m_pSelectionGroup->m_selectedElements.erase( e );
345 }
346 }
347
348 void addToSelection( Elem e ) {
349 m_pSelectionGroup->m_selectedElements.insert( e );
350 }
351
352 void clearSelection( bool bCheck = true ) {
353 std::vector<Elem> v ( m_pSelectionGroup->m_selectedElements.begin(),
354 m_pSelectionGroup->m_selectedElements.end() );
355 if ( !bCheck || m_pWidget->checkDeselectElements( v ) ) {
356 m_pSelectionGroup->m_selectedElements.clear();
357 }
358 }
359
370 typedef typename std::set<Elem>::iterator iterator;
371
372 iterator begin() { return m_pSelectionGroup->m_selectedElements.begin(); }
373 iterator end() { return m_pSelectionGroup->m_selectedElements.end(); }
375
378 for ( auto pW : m_pSelectionGroup->m_selectionWidgets ) {
379 pW->updateWidget();
380 }
381 }
382
385 if ( m_mouseState == Dragging ) {
386 mouseDragEnd();
387 }
389 if ( m_pClickEvent ) {
390 delete m_pClickEvent;
391 m_pClickEvent = nullptr;
392 }
394 m_pWidget->endMouseGesture();
395 m_pWidget->selectionMoveCancelEvent();
396 }
399 }
400
401 // -------------------------------------------------------------------------------------------------------
411
412 void mousePressEvent( QMouseEvent *ev ) {
413
414 // macOS ctrl+left-click is reported as a
415 // right-click. However, only the 'press' event is reported,
416 // there are no move or release events. This is enough for
417 // opening context menus, but not enough for drag gestures.
418 if ( m_mouseState == Up
419 && ev->button() == Qt::RightButton
420 && ev->buttons() == Qt::LeftButton
421 && ev->modifiers() & Qt::MetaModifier) {
422 // Deliver the event as a transient click with no effect on state
423 mouseClick( ev );
424 return;
425 }
426
427 // Check for inconsistent state. If there was a gesture in progress, abandon it.
428 if ( !( m_mouseButton & ev->buttons() ) && m_mouseState != Up ) {
429 delete m_pClickEvent;
430 m_pClickEvent = nullptr;
432 }
433
434 // Detect start of click or drag event
435 if ( m_mouseState == Up ) {
437 m_mouseButton = ev->button();
438 assert( m_pClickEvent == nullptr );
439
440 auto pEv = static_cast<MouseEvent*>( ev );
441
442#ifdef H2CORE_HAVE_QT6
443 m_pClickEvent = new QMouseEvent(
444 QEvent::MouseButtonPress,
445 pEv->position(), pEv->scenePosition(), pEv->globalPosition(),
446 m_mouseButton, ev->buttons(), ev->modifiers(),
447 Qt::MouseEventSynthesizedByApplication);
448#elif (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
449 m_pClickEvent = new QMouseEvent(
450 QEvent::MouseButtonPress,
451 ev->localPos(), ev->windowPos(), ev->screenPos(),
452 m_mouseButton, ev->buttons(), ev->modifiers(),
453 Qt::MouseEventSynthesizedByApplication);
454#else
455 m_pClickEvent = new QMouseEvent(
456 QEvent::MouseButtonPress,
457 ev->localPos(), ev->windowPos(), ev->screenPos(),
458 m_mouseButton, ev->buttons(), ev->modifiers());
459#endif
460 m_pClickEvent->setTimestamp( ev->timestamp() );
461 }
462 }
463
464 void mouseMoveEvent( QMouseEvent *ev ) {
465
466 auto pEv = static_cast<MouseEvent*>( ev );
467 auto pClickEv = static_cast<MouseEvent*>( m_pClickEvent );
468
469 if ( m_mouseState == Down ) {
470 if ( (pEv->position() - pClickEv->position() ).manhattanLength() > QApplication::startDragDistance()
471 || (ev->timestamp() - m_pClickEvent->timestamp()) > QApplication::startDragTime() ) {
472 // Mouse has moved far enough to consider this a drag rather than a click.
475 }
476 } else if ( m_mouseState == Dragging ) {
477 mouseDragUpdate( ev );
478 }
479 }
480
481 void mouseReleaseEvent( QMouseEvent *ev ) {
482 if ( m_mouseState != Up && !( ev->buttons() & m_mouseButton) ) {
483 if ( m_mouseState == Down ) {
484 mouseClick( ev );
485 } else if ( m_mouseState == Dragging ) {
486 mouseDragEnd( ev );
487 }
489 delete m_pClickEvent;
490 m_pClickEvent = nullptr;
491
492 } else {
493 // Other mouse buttons may have been pressed since the
494 // last click was started, and may have been released to
495 // cause this event.
496 }
497 }
498
500
501
503 void paintSelection( QPainter *painter ) {
505 QPen pen( H2Core::Preferences::get_instance()->getColorTheme()
506 ->m_selectionHighlightColor );
507 pen.setStyle( Qt::DotLine );
508 pen.setWidth(2);
509 painter->setPen( pen );
510 painter->setBrush( Qt::NoBrush );
511
512 painter->drawRect( m_lasso );
513 }
514 }
515
516
517 // -------------------------------------------------------------------------------------------------------
523
524 void mouseClick( QMouseEvent *ev ) {
525 auto pEv = static_cast<MouseEvent*>( ev );
526
527 if ( ev->modifiers() & Qt::ControlModifier ) {
528 // Ctrl+click to add or remove element from selection.
529 QRect r = QRect( pEv->position().toPoint(),
530 pEv->position().toPoint() );
531 std::vector<Elem> elems = m_pWidget->elementsIntersecting( r );
532 for ( Elem e : elems) {
533 if ( m_pSelectionGroup->m_selectedElements.find( e )
534 == m_pSelectionGroup->m_selectedElements.end() ) {
535 addToSelection( e );
536 } else {
538 }
539 }
541 } else {
542 if ( ev->button() != Qt::RightButton && !m_pSelectionGroup->m_selectedElements.empty() ) {
543 // Click without control or right button, and
544 // non-empty selection, will just clear selection
547 } else if ( ev->button() == Qt::RightButton && m_pSelectionGroup->m_selectedElements.empty() ) {
548 // Right-clicking with an empty selection will first attempt to select anything at the click
549 // position before passing the click through to the client.
550 QRect r = QRect( pEv->position().toPoint(),
551 pEv->position().toPoint() );
552 std::vector<Elem> elems = m_pWidget->elementsIntersecting( r );
553 for ( Elem e : elems) {
554 addToSelection( e );
555 }
556 m_pWidget->mouseClickEvent( ev );
557 } else {
558 m_pWidget->mouseClickEvent( ev );
559 }
560 }
561 }
562
563 void mouseDragStart( QMouseEvent *ev ) {
564
565 if ( m_pDragScroller == nullptr ) {
566 m_pDragScroller = new DragScroller( m_pWidget->findScrollArea() );
567 }
568 m_pDragScroller->startDrag();
569
570 auto pEv = static_cast<MouseEvent*>( ev );
571 auto pClickEv = static_cast<MouseEvent*>( m_pClickEvent );
572
573 if ( ev->button() == Qt::LeftButton) {
574 QRect r = QRect( pClickEv->position().toPoint(),
575 pEv->position().toPoint() );
576 std::vector<Elem> elems = m_pWidget->elementsIntersecting( r );
577
578 /* Did the user start dragging a selected element, or an unselected element?
579 */
580 bool bHitSelected = false, bHitAny = false;
581 for ( Elem elem : elems ) {
582 bHitAny = true;
583 if ( isSelected( elem ) ) {
584 bHitSelected = true;
585 break;
586 }
587 }
588
589 if ( bHitSelected ) {
590 /* Move selection */
591 if ( bHitSelected ) {
593 m_movingOffset = pEv->position().toPoint() -
594 pClickEv->position().toPoint();
595 m_pWidget->startMouseMove( ev );
596 }
597 } else if ( bHitAny && m_pWidget->canDragElements() ) {
598 // Allow mouseDragStartEvent to handle anything
599
600 } else {
601 // Didn't hit anything. Start new selection drag.
604 m_lasso.setTopLeft( pClickEv->position().toPoint() );
605 m_lasso.setBottomRight( pEv->position().toPoint() );
606 m_pWidget->startMouseLasso( ev );
607 m_pWidget->updateWidget();
608
609 }
610
611 }
612 m_pWidget->mouseDragStartEvent( ev );
613 }
614
615 void mouseDragUpdate( QMouseEvent *ev ) {
616
617 auto pEv = static_cast<MouseEvent*>( ev );
618 auto pClickEv = static_cast<MouseEvent*>( m_pClickEvent );
619
621 m_lasso.setBottomRight( pEv->position().toPoint() );
622
623 if ( ev->modifiers() & Qt::ControlModifier ) {
624 // Start with previously selected elements
626 } else {
627 // Clear and rebuild selection
630 }
631 auto selected = m_pWidget->elementsIntersecting( m_lasso );
632 for ( auto s : selected ) {
634 addToSelection( s );
635 }
636 }
638
639 } else if ( m_selectionState == MouseMoving ) {
640 m_movingOffset = pEv->position().toPoint() -
641 pClickEv->position().toPoint();
642 m_pWidget->selectionMoveUpdateEvent( ev );
644
645 } else {
646 // Pass drag update to widget
647 m_pWidget->mouseDragUpdateEvent( ev );
648 }
649 }
650
651 void mouseDragEnd( QMouseEvent *ev = nullptr ) {
652
653 m_pDragScroller->endDrag();
654
658 m_pWidget->endMouseGesture();
660
661 } else if ( m_selectionState == MouseMoving ) {
663 m_pWidget->endMouseGesture();
664 m_pWidget->selectionMoveEndEvent( ev );
666
667 } else {
668 // Pass drag end to widget
669 m_pWidget->mouseDragEndEvent( ev );
670 }
671 }
672
673
674
675
676 // -------------------------------------------------------------------------------------------------------
679
687
688 bool keyPressEvent( QKeyEvent *ev ) {
689
690 if ( ev->matches( QKeySequence::SelectNextChar )
691 || ev->matches( QKeySequence::SelectPreviousChar )
692 || ev->matches( QKeySequence::SelectNextLine )
693 || ev->matches( QKeySequence::SelectPreviousLine )
694 || ev->matches( QKeySequence::SelectStartOfLine)
695 || ev->matches( QKeySequence::SelectEndOfLine )
696 || ev->matches( QKeySequence::SelectStartOfDocument )
697 || ev->matches( QKeySequence::SelectEndOfDocument ) ) {
698 // Selection keys will start or continue a selection lasso
699
701 // Already in keyboard lasso state, just moving the
702 // current selection. Wait for Widget to update
703 // keyboard cursor position before updating lasso
704 // dimensions.
705 } else {
706 // Begin keyboard cursor lasso.
708 m_keyboardCursorStart = m_pWidget->getKeyboardCursorRect();
710 }
711
712 } else if ( ev->key() == Qt::Key_Enter || ev->key() == Qt::Key_Return ) {
713
714 // Key: Enter/Return: start or end a move or copy
715 if ( m_selectionState == Idle ) {
716
717 bool bHitselected = false;
718 for ( Elem e : m_pWidget->elementsIntersecting( m_pWidget->getKeyboardCursorRect() ) ) {
719 if ( m_pSelectionGroup->m_selectedElements.find( e )
720 != m_pSelectionGroup->m_selectedElements.end() ) {
721 bHitselected = true;
722 break;
723 }
724 }
725 if ( bHitselected ) {
726 // Hit "Enter" over a selected element. Begin move.
727 m_keyboardCursorStart = m_pWidget->getKeyboardCursorRect();
730 return true;
731 }
732
733 } else if ( m_selectionState == KeyboardLasso ) {
734 // If we hit 'Enter' from lasso mode, go directly to move
735 m_keyboardCursorStart = m_pWidget->getKeyboardCursorRect();
738 return true;
739
740 } else if ( m_selectionState == KeyboardMoving ) {
741 // End keyboard move
743 m_pWidget->selectionMoveEndEvent( ev );
744 return true;
745
746 } else if ( m_selectionState == KeyboardLasso ) {
747 // end keyboard lasso
749 return true;
750 }
751
752 } else if ( ev->key() == Qt::Key_Escape ) {
753
754 // Key: Escape: cancel any lasso or move/copy in progress; or clear any selection.
755 if ( m_selectionState == Idle ) {
756 if ( !m_pSelectionGroup->m_selectedElements.empty() ) {
759 return true;
760 }
761 } else {
763 m_pWidget->endMouseGesture();
764 m_pWidget->selectionMoveCancelEvent();
765 }
768 return true;
769 }
770
771 } else {
772 // Other keys should probably also cancel lasso, but not move?
776 }
777 }
778 return false;
779 }
780
781
785 void updateKeyboardCursorPosition( QRect cursor ) {
787 m_lasso = m_keyboardCursorStart.united( m_pWidget->getKeyboardCursorRect() );
788
789 // Clear and rebuild selection
791 auto selected = m_pWidget->elementsIntersecting( m_lasso );
792 for ( auto s : selected ) {
793 m_pSelectionGroup->m_selectedElements.insert( s );
794 }
795
796 } else if ( m_selectionState == KeyboardMoving ) {
797 QRect cursorPosition = m_pWidget->getKeyboardCursorRect();
798 m_movingOffset = cursorPosition.topLeft() - m_keyboardCursorStart.topLeft();
799
800 }
801 }
802
804
805};
806
807#endif // SELECTION_H
Drag scroller object.
Definition Selection.h:129
const int m_nInterval
Definition Selection.h:133
QTimer * m_pTimer
Definition Selection.h:131
QScrollArea * m_pScrollArea
Definition Selection.h:132
void startDrag()
Definition Selection.h:147
DragScroller(QScrollArea *pScrollArea)
Definition Selection.h:136
void timeout(void)
Definition Selection.h:161
void endDrag()
Definition Selection.h:156
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
Compatibility class to support QMouseEvent more esily in Qt5 and Qt6.
Definition MouseEvent.h:35
SelectionWidget defines the interface used by the Selection manager to communicate with a widget impl...
Definition Selection.h:49
virtual void startMouseLasso(QMouseEvent *ev)
Definition Selection.h:99
virtual void mouseDragUpdateEvent(QMouseEvent *ev)=0
virtual void mouseDragEndEvent(QMouseEvent *ev)=0
Elem SelectionIndex
Definition Selection.h:52
virtual void updateWidget()=0
Selection or selection-related visual elements have changed, widget needs to be updated.
virtual void endMouseGesture()
Definition Selection.h:101
virtual void mouseDragStartEvent(QMouseEvent *ev)=0
virtual bool canDragElements()
Can elements be dragged as well as being selected? This may change to suit widget's current state.
Definition Selection.h:59
virtual std::vector< SelectionIndex > elementsIntersecting(QRect r)=0
Find list of elements which intersect a rectangular area.
virtual QRect getKeyboardCursorRect()=0
Calculate screen space occupied by keyboard cursor.
virtual QScrollArea * findScrollArea()
Find the QScrollArea, if any, which contains the widget.
Definition Selection.h:106
virtual void startMouseMove(QMouseEvent *ev)
Definition Selection.h:100
virtual void selectionMoveUpdateEvent(QMouseEvent *ev)
Definition Selection.h:91
virtual void validateSelection()=0
Ensure that the Selection contains only valid elements.
virtual void selectionMoveEndEvent(QInputEvent *ev)=0
virtual bool checkDeselectElements(std::vector< SelectionIndex > &elements)
Inform the client that we're deselecting elements.
Definition Selection.h:72
virtual void selectionMoveCancelEvent()
Definition Selection.h:93
virtual void mouseClickEvent(QMouseEvent *ev)=0
void paintSelection(QPainter *painter)
Paint selection-related elements (ie lasso)
Definition Selection.h:503
bool isLasso() const
Is there an ongoing lasso gesture?
Definition Selection.h:332
void addToSelection(Elem e)
Definition Selection.h:348
void mouseReleaseEvent(QMouseEvent *ev)
Definition Selection.h:481
void mouseClick(QMouseEvent *ev)
Definition Selection.h:524
QMouseEvent * m_pClickEvent
Mouse event to deliver as 'click' or 'drag' events.
Definition Selection.h:230
Qt::MouseButton m_mouseButton
Mouse button that began the gesture.
Definition Selection.h:229
std::set< Elem >::iterator iterator
Definition Selection.h:370
void removeFromSelection(Elem e, bool bCheck=true)
Definition Selection.h:341
void updateWidgetGroup()
Update any widgets in this selection group.
Definition Selection.h:377
QPoint m_movingOffset
Offset that a selection has been moved by.
Definition Selection.h:258
void mouseDragUpdate(QMouseEvent *ev)
Definition Selection.h:615
enum Selection::MouseState m_mouseState
enum Selection::SelectionState m_selectionState
void clearSelection(bool bCheck=true)
Definition Selection.h:352
void merge(Selection *pOther)
Merge the selection groups of two Selection widgets.
Definition Selection.h:288
DragScroller * m_pDragScroller
Scroller to use while dragging selections.
Definition Selection.h:267
void cancelGesture()
Cancel any selection gesture (lasso, move, with keyboard or mouse) in progress.
Definition Selection.h:384
QRect m_keyboardCursorStart
Keyboard cursor position at the start of a keyboard gesture.
Definition Selection.h:259
bool keyPressEvent(QKeyEvent *ev)
Key press event filter.
Definition Selection.h:688
bool isMouseGesture() const
Is there a mouse gesture in progress?
Definition Selection.h:321
Selection(SelectionWidget< Elem > *w)
Definition Selection.h:272
void updateKeyboardCursorPosition(QRect cursor)
Update the keyboard cursor.
Definition Selection.h:785
bool isSelected(Elem e) const
Is an element in the set of currently selected elements?
Definition Selection.h:337
std::shared_ptr< SelectionGroup > m_pSelectionGroup
Definition Selection.h:203
void mousePressEvent(QMouseEvent *ev)
Definition Selection.h:412
void mouseDragEnd(QMouseEvent *ev=nullptr)
Definition Selection.h:651
@ KeyboardMoving
Definition Selection.h:255
@ KeyboardLasso
Definition Selection.h:255
bool isMoving() const
Is there an ongoing (and incomplete) selection movement gesture?
Definition Selection.h:316
QPoint movingOffset() const
During a selection "move" gesture, return the current movement position relative to the start positio...
Definition Selection.h:327
iterator end()
Definition Selection.h:373
void dump()
Definition Selection.h:297
iterator begin()
Definition Selection.h:372
void mouseDragStart(QMouseEvent *ev)
Definition Selection.h:563
std::set< Elem > m_checkpointSelectedElements
For gestures modifying a selection, store the initial selection set as a checkpoint to restore when r...
Definition Selection.h:264
SelectionWidget< Elem > * m_pWidget
Definition Selection.h:208
QRect m_lasso
Dimensions of a current selection lasso.
Definition Selection.h:257
void mouseMoveEvent(QMouseEvent *ev)
Definition Selection.h:464
Group of SelectionWidget objects sharing the same selection set.
Definition Selection.h:198
std::set< Elem > m_selectedElements
Definition Selection.h:199
std::set< SelectionWidget< Elem > * > m_selectionWidgets
Definition Selection.h:200