mirror of
https://github.com/pyapp-kit/superqt.git
synced 2026-01-04 11:21:09 +01:00
commit 466fc7c19ace1343d23739e4058758cd21328511 Author: Talley Lambert <talley.lambert@gmail.com> Date: Wed Jun 2 20:22:38 2021 -0400 add deploy cond commit e9965e71490689935b61099225acc7f3bf5c2d48 Author: Talley Lambert <talley.lambert@gmail.com> Date: Wed Jun 2 20:20:45 2021 -0400 more precommit commit b39150b16d7d64a5530ec9a0e29e673e2b6ed0a4 Author: Talley Lambert <talley.lambert@gmail.com> Date: Wed Jun 2 19:52:42 2021 -0400 updating precommit commit d5018b38e7bc59f81cc161cca06fae829e493e3c Author: Talley Lambert <talley.lambert@gmail.com> Date: Wed Jun 2 19:42:32 2021 -0400 big reorg
71 lines
1.7 KiB
Python
71 lines
1.7 KiB
Python
from contextlib import suppress
|
|
from distutils.version import LooseVersion
|
|
from platform import system
|
|
|
|
import pytest
|
|
|
|
from qwidgets.qtcompat import QT_VERSION
|
|
from qwidgets.qtcompat.QtCore import QEvent, QPoint, QPointF, Qt
|
|
from qwidgets.qtcompat.QtGui import QMouseEvent, QWheelEvent
|
|
|
|
QT_VERSION = LooseVersion(QT_VERSION)
|
|
|
|
SYS_DARWIN = system() == "Darwin"
|
|
|
|
skip_on_linux_qt6 = pytest.mark.skipif(
|
|
system() == "Linux" and QT_VERSION >= LooseVersion("6.0"),
|
|
reason="hover events not working on linux pyqt6",
|
|
)
|
|
|
|
|
|
def _mouse_event(pos=QPointF(), type_=QEvent.MouseMove):
|
|
"""Create a mouse event of `type_` at `pos`."""
|
|
return QMouseEvent(type_, QPointF(pos), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
|
|
|
|
|
|
def _wheel_event(arc):
|
|
"""Create a wheel event with `arc`."""
|
|
with suppress(TypeError):
|
|
return QWheelEvent(
|
|
QPointF(),
|
|
QPointF(),
|
|
QPoint(arc, arc),
|
|
QPoint(arc, arc),
|
|
Qt.NoButton,
|
|
Qt.NoModifier,
|
|
Qt.ScrollBegin,
|
|
False,
|
|
Qt.MouseEventSynthesizedByQt,
|
|
)
|
|
with suppress(TypeError):
|
|
return QWheelEvent(
|
|
QPointF(),
|
|
QPointF(),
|
|
QPoint(-arc, -arc),
|
|
QPoint(-arc, -arc),
|
|
1,
|
|
Qt.Vertical,
|
|
Qt.NoButton,
|
|
Qt.NoModifier,
|
|
Qt.ScrollBegin,
|
|
False,
|
|
Qt.MouseEventSynthesizedByQt,
|
|
)
|
|
|
|
return QWheelEvent(
|
|
QPointF(),
|
|
QPointF(),
|
|
QPoint(arc, arc),
|
|
QPoint(arc, arc),
|
|
1,
|
|
Qt.Vertical,
|
|
Qt.NoButton,
|
|
Qt.NoModifier,
|
|
)
|
|
|
|
|
|
def _linspace(start, stop, n):
|
|
h = (stop - start) / (n - 1)
|
|
for i in range(n):
|
|
yield start + h * i
|