Skip to content

Compute the widget position with signed numbers - #569

Merged
paceholder merged 1 commit into
masterfrom
fix-widget-position-wrap
Nov 29, 2026
Merged

paceholder merged 1 commit into
masterfrom
fix-widget-position-wrap

Conversation

@paceholder

Copy link
Copy Markdown
Owner

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring

Description

widgetPosition() in both default geometries added an unsigned captionHeight to the signed node and widget heights. The whole sum was then unsigned. A widget taller than its node gave a negative sum that wrapped around, and the widget was placed about two billion pixels below the node.

captionHeight is now an int, like the other heights, so the sum is signed. No casts are needed. The reporter of #189 used five casts for the same effect.

When the widget can be taller than its node is a separate question. It is collected in #568.

Testing

  • Qt version tested: 6 (offscreen). CI covers Qt5.
  • Existing tests still pass
  • Added tests for new functionality: a widget made taller than its node is not placed far from the node, in both orientations. The test fails without the fix (y = 2147483474.5).

Not tested: the image node of the reporter. The test shows the wrong position, not the painter errors.

Breaking changes?

No.

Related issue

Fixes #189

A widget taller than its node made the sum unsigned and gave a position of about two billion pixels.

Fixes #189
@paceholder
paceholder force-pushed the fix-widget-position-wrap branch from 1a5fbff to 3571de1 Compare November 29, 2026 20:04
@paceholder
paceholder merged commit ea8718f into master Nov 29, 2026
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.

found and solved one small problem, when zooming the image node, especially with the height and width changing at the same time

1 participant