fix bug with scrollbar resizing

This commit is contained in:
RickyRister 2024-12-17 20:42:13 -08:00
parent b894b75e6a
commit befccd26ca
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: