fix bug with scrollbar resizing (#5263)

This commit is contained in:
RickyRister 2024-12-17 21:16:47 -08:00 committed by GitHub
parent b894b75e6a
commit 27e5d21b6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -247,10 +247,12 @@ void ZoneViewWidget::moveEvent(QGraphicsSceneMoveEvent * /* event */)
void ZoneViewWidget::resizeEvent(QGraphicsSceneResizeEvent *event)
{
// We need to manually resize the scroll bar whenever the window gets resized
qreal totalZoneHeight = zone->getOptimumRect().height();
qreal newWindowHeight = event->newSize().height();
qreal newZoneHeight = newWindowHeight - extraHeight - 10;
resizeScrollbar(event->newSize().height() - extraHeight - 10);
}
void ZoneViewWidget::resizeScrollbar(const qreal newZoneHeight)
{
qreal totalZoneHeight = zone->getOptimumRect().height();
scrollBar->setMaximum(totalZoneHeight - newZoneHeight);
}
@ -278,6 +280,7 @@ void ZoneViewWidget::resizeToZoneContents()
qreal initialZoneHeight = qMin(zoneRect.height(), calcMaxInitialHeight());
QSizeF initialSize(width, initialZoneHeight + extraHeight + 10);
resize(initialSize);
resizeScrollbar(initialZoneHeight);
zone->setGeometry(QRectF(0, -scrollBar->value(), zoneContainer->size().width(), totalZoneHeight));

View file

@ -55,6 +55,8 @@ private:
bool canBeShuffled;
int extraHeight;
Player *player;
void resizeScrollbar(qreal newZoneHeight);
signals:
void closePressed(ZoneViewWidget *zv);
private slots: