diff --git a/cockatrice/src/game_graphics/game_view.cpp b/cockatrice/src/game_graphics/game_view.cpp index 4ab45272d..f2dde4dd9 100644 --- a/cockatrice/src/game_graphics/game_view.cpp +++ b/cockatrice/src/game_graphics/game_view.cpp @@ -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(); } diff --git a/cockatrice/src/game_graphics/player/player_graphics_item.cpp b/cockatrice/src/game_graphics/player/player_graphics_item.cpp index 729df75be..0bce9750c 100644 --- a/cockatrice/src/game_graphics/player/player_graphics_item.cpp +++ b/cockatrice/src/game_graphics/player/player_graphics_item.cpp @@ -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 = diff --git a/cockatrice/src/game_graphics/zones/table_zone.h b/cockatrice/src/game_graphics/zones/table_zone.h index dbb2ed28d..92915a2ed 100644 --- a/cockatrice/src/game_graphics/zones/table_zone.h +++ b/cockatrice/src/game_graphics/zones/table_zone.h @@ -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(_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 {