Engauge Digitizer  2
DigitizeStateSelect.h
1 #ifndef DIGITIZE_STATE_SELECT_H
2 #define DIGITIZE_STATE_SELECT_H
3 
4 #include "DigitizeStateAbstractBase.h"
5 
8 {
9 public:
12  virtual ~DigitizeStateSelect();
13 
14  virtual QString activeCurve () const;
15  virtual void begin(DigitizeState previousState);
16  virtual QCursor cursor () const;
17  virtual void end();
18  virtual void handleCurveChange();
19  virtual void handleKeyPress (Qt::Key key,
20  bool atLeastOneSelectedItem);
21  virtual void handleMouseMove (QPointF posScreen);
22  virtual void handleMousePress (QPointF posScreen);
23  virtual void handleMouseRelease (QPointF posScreen);
24  virtual QString state() const;
25  virtual void updateModelDigitizeCurve (const DocumentModelDigitizeCurve &modelDigitizeCurve);
26  virtual void updateModelSegments(const DocumentModelSegments &modelSegments);
27 
28 private:
30 
31  void keyPressArrow (Qt::Key key);
32  QString moveTextFromDeltaScreen (const QPointF &deltaScreen);
33  void setCursorForPoints();
34  void unsetCursorForPoints();
35  double zoomedToUnzoomedScreenX () const;
36  double zoomedToUnzoomedScreenY () const;
37 
38  // Click and drag cases are:
39  // 1) rubber band selection
40  // Result = selection of any items inside the rubber band but no movement
41  // 2) selection and moving with no initially selected items.
42  // Result = selection and movement of item under cursor
43  // 3) selection and moving with only item under cursor initially selected
44  // Result = same result as case #2
45  // 4) selection and moving with item under cursor not initially selected but other item(s) selected
46  // Result = other items get unselected so the result is the same as case #2 but with some items now unselected
47  // 5) selection and moving with item under cursor initially selected along with other selected items
48  // Result = all selected items get moved
49  // Originally, determining if any object was under the cursor during mousePressEvent was done with various hit tests, but
50  // none were 100% consistent with the internal hit test done by the QGraphicsView. The solution was to simply:
51  // 1) Mark all items as unmoved when the mousePressEvent occurs
52  // 2) Mark items that undergo QGraphicsItem::ItemScaleHasChanged as having moved
53  // 3) Harvest the results when the mouseReleaseEvent occurs
54  // All moved items then have the currentCursorPosition - m_movingStart translation applied to them
55  QPointF m_movingStart;
56 };
57 
58 #endif // DIGITIZE_STATE_SELECT_H
virtual QCursor cursor() const
Returns the state-specific cursor shape.
virtual void handleMousePress(QPointF posScreen)
Handle a mouse press that was intercepted earlier.
virtual void handleCurveChange()
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void handleMouseRelease(QPointF posScreen)
Handle a mouse release that was intercepted earlier.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
virtual void handleKeyPress(Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Digitizing state for selecting one or more Points in the Document.
virtual void updateModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual void begin(DigitizeState previousState)
Method that is called at the exact moment a state is entered.
Model for DlgSettingsSegments and CmdSettingsSegments.
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
virtual QString state() const
State name for debugging.
virtual void handleMouseMove(QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...