Try something else

Took 17 minutes
This commit is contained in:
Lukas Brübach 2026-08-14 09:15:58 +02:00
parent 37bb1786cd
commit d458ef7efa
3 changed files with 19 additions and 13 deletions

View file

@ -129,14 +129,13 @@ void GameView::resizeRubberBand(const QPointF &cursorPoint, int selectedCount)
QPoint cursor = cursorPoint.toPoint();
QRect rect = QRect(mapFromScene(selectionOrigin), cursor).normalized();
// Explicitly repaint the strip the band just vacated. When the band is a
// child widget, the viewport does not reliably receive the exposed region
// on all platforms (notably macOS), which would leave stale band pixels on
// screen until the next unrelated repaint.
const QRect previousGeometry = rubberBand->geometry();
rubberBand->setGeometry(rect);
if (viewport()) {
viewport()->update(previousGeometry.united(rect));
// Repaint the whole viewport rather than just the band's old area: the
// vacated strip of a child widget is not reliably invalidated on all
// platforms (notably macOS), leaving stale pixels — including black
// scene background where the playmat should show — under the selection.
viewport()->update();
}
if (!SettingsCache::instance().userInterface().getShowDragSelectionCount()) {
@ -180,13 +179,12 @@ void GameView::stopRubberBand()
return;
}
// Same rationale as resizeRubberBand. Make sure the area under the band is
// repainted, since some platforms skip the exposed-region update of a
// hidden child widget.
const QRect bandGeometry = rubberBand->geometry();
// Same rationale as resizeRubberBand: make sure the whole viewport is
// repainted once the band is gone, since some platforms skip the exposed
// region update of a hidden child widget.
rubberBand->hide();
if (viewport()) {
viewport()->update(bandGeometry);
viewport()->update();
}
dragCountLabel->hide();
}

View file

@ -124,7 +124,6 @@ void PlayerGraphicsItem::initializeZones()
rfgZoneGraphicsItem->setPos(base + QPointF(0, 2 * h + h2 + 10));
tableZoneGraphicsItem = new TableZone(player->getTableZone(), mirrored, this);
connect(tableZoneGraphicsItem, &TableZone::sizeChanged, this, &PlayerGraphicsItem::updateBoundingRect);
connect(this, &PlayerGraphicsItem::mirroredChanged, tableZoneGraphicsItem, &TableZone::setMirrored);
stackZoneGraphicsItem =

View file

@ -188,8 +188,17 @@ public:
}
void setWidth(qreal _width)
{
// The width is stored as an int; truncate to match the previous implicit conversion.
const int newWidth = static_cast<int>(_width);
if (width == newWidth) {
return;
}
prepareGeometryChange();
width = _width;
width = newWidth;
// The parent player item's boundingRect (which clips the playmat painting) is
// derived from this zone's size. Without this signal the playmat is cut off at
// the stale boundingRect edge whenever the scene is resized wider.
emit sizeChanged();
}
[[nodiscard]] qreal getWidth() const
{