mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
fix bug with scrollbar resizing (#5263)
This commit is contained in:
parent
b894b75e6a
commit
27e5d21b6b
2 changed files with 8 additions and 3 deletions
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ private:
|
|||
bool canBeShuffled;
|
||||
int extraHeight;
|
||||
Player *player;
|
||||
|
||||
void resizeScrollbar(qreal newZoneHeight);
|
||||
signals:
|
||||
void closePressed(ZoneViewWidget *zv);
|
||||
private slots:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue