Repository: pyqtgraph/pyqtgraph

Issue:
Right click on DockLabel and mouse move raises AttributeError: 'DockLabel' object has no attribute 'pressPos'
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->

As title says, a right click on a DockLabel followed by moving a mouse with a right button pressed raises 

> AttributeError: 'DockLabel' object has no attribute 'pressPos'.

It only happens if a DockLabel was not clicked before.

### Code to reproduce

```
from pyqtgraph.dockarea import DockArea, Dock
from pyqtgraph.Qt import QtGui

app = QtGui.QApplication([])
dock_area = DockArea()
dock = Dock('Dock label')
dock_area.addDock(dock)
dock_area.show()
QtGui.QApplication.exec_()

# Then move mouse over a label 'Dock label', press right button and move mouse
```

### Expected behavior

I assume, nothing should happen.

### Real behavior

Program crashes with the following:

> Traceback (most recent call last):
>   File "C:\...\pyqtgraph\dockarea\Dock.py", line 338, in mouseMoveEvent
>     if not self.startedDrag and (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance():
> AttributeError: 'DockLabel' object has no attribute 'pressPos'

### Tested environment(s)

 * PyQtGraph version: 0.10.0
 * Qt Python binding: PyQt5 5.14.1 Qt 5.14.0
 * Python version: 3.7.6
 * NumPy version: 1.18.1
 * Operating system: Windows 10
 * Installation method: pip install



Discussion:
### Why it happens

In short, it happens because `DockLabel.mouseMoveEvent` method does not check the condition `ev.button() == QtCore.Qt.LeftButton`

An attribute `DockLabel.pressPos` is initialized in `DockLabel.mousePressEvent` method only if the condition above is satisfied (`ev.button() == QtCore.Qt.LeftButton`). So on a right click this method does not initialize `DockLabel.pressPos`. Hovewer, `DockLabel.mouseMoveEvent` immediately checks a different condition:
`if not self.startedDrag and (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance():`
and uses `DockLabel.pressPos` attribute which may not be initialized yet.

### Possible simplest solution

Add if statement 
`if ev.button() == QtCore.Qt.LeftButton:`
to `DockLabel.mouseMoveEvent` method.

Can I work on this issue?
@elijose55 by all means please do, I would recommend you first check if this is an issue still with 0.11rc0 (or the current develop branch).

Resolving patch:
diff --git a/pyqtgraph/dockarea/Dock.py b/pyqtgraph/dockarea/Dock.py
--- a/pyqtgraph/dockarea/Dock.py
+++ b/pyqtgraph/dockarea/Dock.py
@@ -267,7 +267,7 @@ def __init__(self, text, dock, showCloseButton):
         self.dock = dock
         self.updateStyle()
         self.setAutoFillBackground(False)
-        self.startedDrag = False
+        self.mouseMoved = False
 
         self.closeButton = None
         if showCloseButton:
@@ -325,21 +325,23 @@ def setOrientation(self, o):
         self.updateStyle()
 
     def mousePressEvent(self, ev):
-        if ev.button() == QtCore.Qt.LeftButton:
-            self.pressPos = ev.pos()
-            self.startedDrag = False
-            ev.accept()
+        self.pressPos = ev.pos()
+        self.mouseMoved = False
+        ev.accept()
 
     def mouseMoveEvent(self, ev):
-        if not self.startedDrag and (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance():
+        if not self.mouseMoved:
+            self.mouseMoved = (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance()
+
+        if self.mouseMoved and ev.buttons() == QtCore.Qt.LeftButton:
             self.dock.startDrag()
         ev.accept()
 
     def mouseReleaseEvent(self, ev):
         ev.accept()
-        if not self.startedDrag:
+        if not self.mouseMoved:
             self.sigClicked.emit(self, ev)
-        
+
     def mouseDoubleClickEvent(self, ev):
         if ev.button() == QtCore.Qt.LeftButton:
             self.dock.float()


Test patch: