Skip to content

Fix PlotWidget moveTo/position resolving to empty EventInterface stubs#629

Merged
highperformancecoder merged 1 commit intohighperformancecoder:masterfrom
primesoftnz:fix/plotwidget-moveto-position
Mar 21, 2026
Merged

Fix PlotWidget moveTo/position resolving to empty EventInterface stubs#629
highperformancecoder merged 1 commit intohighperformancecoder:masterfrom
primesoftnz:fix/plotwidget-moveto-position

Conversation

@primesoftnz
Copy link
Contributor

@primesoftnz primesoftnz commented Mar 20, 2026

Summary

PlotWidget::moveTo() and PlotWidget::position() called via the REST API resolve to EventInterface's empty implementations instead of Item's working ones, due to diamond inheritance in PlotWidgetSuper.

This makes it impossible to programmatically position PlotWidgets — moveTo() silently no-ops and position() always returns {0,0}.

Fix

Add explicit overrides in PlotWidget that delegate to Item::moveTo() and Item::x()/Item::y(), following the existing disambiguation pattern already used for width() and height():

void moveTo(float x, float y) override {Item::moveTo(x,y);}
std::vector<float> position() const override {return {Item::x(), Item::y()};}

Root Cause

PlotWidgetSuper (plotWidget.h:41) inherits from both ItemT<PlotWidget> and RenderNativeWindow:

EventInterface                    Item
  moveTo() {}  [empty]              moveTo()  [sets m_x, m_y]
  position() {0,0}  [stub]         x(), y()  [reads m_x, m_y]
       |                                |
RenderNativeWindow              ItemT<PlotWidget>
       |                                |
       +------- PlotWidgetSuper --------+

classdesc resolves to EventInterface::moveTo (empty stub) rather than Item::moveTo.

Only PlotWidget is affected — variables/operations inherit from ItemT<> only, with no RenderNativeWindow in the chain.

Fixes tickets:#1918


This change is Reviewable

Summary by CodeRabbit

  • Bug Fixes
    • Resolved positioning ambiguity for plot widgets, ensuring consistent and reliable widget placement and position retrieval.

PlotWidgetSuper inherits from both ItemT<PlotWidget> (via Item) and
RenderNativeWindow (via EventInterface). Both chains define moveTo()
and position(), but classdesc resolves to EventInterface's empty
implementations rather than Item's working ones.

This makes PlotWidget::moveTo() silently no-op via the REST API, and
position() always returns {0,0} — preventing programmatic positioning
of plot widgets.

Add explicit overrides in PlotWidget that delegate to Item::moveTo()
and Item::x()/y(), following the existing disambiguation pattern used
for width() and height().

Fixes tickets:#1918
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83f07399-39d3-4998-af5c-7f6bc6315a08

📥 Commits

Reviewing files that changed from the base of the PR and between 3a8601c and bee0ec2.

📒 Files selected for processing (1)
  • model/plotWidget.h

📝 Walkthrough

Walkthrough

Added explicit method overrides to PlotWidget for moveTo() and position() to disambiguate base-class behavior. The overrides delegate to Item coordinates, preventing classdesc from binding to EventInterface-provided empty stubs.

Changes

Cohort / File(s) Summary
Position Handling Overrides
model/plotWidget.h
Added explicit moveTo(float, float) override that delegates to Item::moveTo(), and position() const override returning {Item::x(), Item::y()} to resolve method binding ambiguity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A widget once lost in the bind,
Now finds its true place, redesigned,
Two overrides clear as can be,
The Item's position, finally free!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: adding explicit overrides to resolve moveTo/position methods to Item implementations instead of empty EventInterface stubs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@highperformancecoder
Copy link
Owner

@rebase

@highperformancecoder highperformancecoder merged commit 21994a2 into highperformancecoder:master Mar 21, 2026
3 of 5 checks passed
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.

2 participants