Skip to content

pilot: Add R2DWidget skeleton with pan/zoom (issue #754 PR1)#816

Draft
tigercosmos wants to merge 1 commit into
solvcon:masterfrom
tigercosmos:2d_canvas_754
Draft

pilot: Add R2DWidget skeleton with pan/zoom (issue #754 PR1)#816
tigercosmos wants to merge 1 commit into
solvcon:masterfrom
tigercosmos:2d_canvas_754

Conversation

@tigercosmos
Copy link
Copy Markdown
Collaborator

This is the first of a multi-PR effort to replace the Qt3D-backed "2D" canvas with a truly 2D QWidget + QPainter renderer driven by World<T>. This PR lands the widget-side scaffolding and the math layer that future stages will build on; no geometry is rendered yet and no Python binding is exposed.

The new R2DWidget is a QWidget subclass with paintEvent, mousePressEvent, mouseMoveEvent, mouseReleaseEvent, wheelEvent, and resizeEvent handlers. It draws a placeholder grid with major/minor axes through the world origin so that pan and cursor-anchored zoom are visually observable. The widget is hosted as an MDI subwindow via a new RManager::add2DWidget(). World rendering is intentionally out of scope here and will arrive in a follow-up PR that introduces a Qt-free WorldDraw2d producer in universe/.

The view math lives in a new Qt-free ViewTransform2d<T> so that pan, zoom, cursor-anchored zoom-at, and the math-convention +Y-up flip can be exercised in the test_nopython gtest target without linking Qt. Thirteen tests cover round-trip mappings, the cursor-anchored zoom invariant, repeated-zoom compounding, clamped-zoom boundary behavior, and rejection of non-finite or non-positive inputs. The widget itself is not auto-tested in this PR, matching the existing convention in tests/test_pilot.py (UI is exercised manually and via the Python bindings that PR4 will add).

Related to #754.

This is the first of a multi-PR effort to replace the Qt3D-backed "2D" canvas with a truly 2D `QWidget` + `QPainter` renderer driven by `World<T>`. This PR lands the widget-side scaffolding and the math layer that future stages will build on; no geometry is rendered yet and no Python binding is exposed.

The new `R2DWidget` is a `QWidget` subclass with `paintEvent`, `mousePressEvent`, `mouseMoveEvent`, `mouseReleaseEvent`, `wheelEvent`, and `resizeEvent` handlers. It draws a placeholder grid with major/minor axes through the world origin so that pan and cursor-anchored zoom are visually observable. The widget is hosted as an MDI subwindow via a new `RManager::add2DWidget()`. World rendering is intentionally out of scope here and will arrive in a follow-up PR that introduces a Qt-free `WorldDraw2d` producer in `universe/`.

The view math lives in a new Qt-free `ViewTransform2d<T>` so that pan, zoom, cursor-anchored zoom-at, and the math-convention +Y-up flip can be exercised in the `test_nopython` gtest target without linking Qt. Thirteen tests cover round-trip mappings, the cursor-anchored zoom invariant, repeated-zoom compounding, clamped-zoom boundary behavior, and rejection of non-finite or non-positive inputs. The widget itself is not auto-tested in this PR, matching the existing convention in `tests/test_pilot.py` (UI is exercised manually and via the Python bindings that PR4 will add).

Related to solvcon#754.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant