pilot: Add R2DWidget skeleton with pan/zoom (issue #754 PR1)#816
Draft
tigercosmos wants to merge 1 commit into
Draft
pilot: Add R2DWidget skeleton with pan/zoom (issue #754 PR1)#816tigercosmos wants to merge 1 commit into
tigercosmos wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first of a multi-PR effort to replace the Qt3D-backed "2D" canvas with a truly 2D
QWidget+QPainterrenderer driven byWorld<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
R2DWidgetis aQWidgetsubclass withpaintEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent,wheelEvent, andresizeEventhandlers. 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 newRManager::add2DWidget(). World rendering is intentionally out of scope here and will arrive in a follow-up PR that introduces a Qt-freeWorldDraw2dproducer inuniverse/.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 thetest_nopythongtest 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 intests/test_pilot.py(UI is exercised manually and via the Python bindings that PR4 will add).Related to #754.