Skip to content

Right click on DockLabel and mouse move raises AttributeError: 'DockLabel' object has no attribute 'pressPos' #1122

@StarostinV

Description

@StarostinV

Short description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions