mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-02 03:23:56 -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)
|
void ZoneViewWidget::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||||
{
|
{
|
||||||
// We need to manually resize the scroll bar whenever the window gets resized
|
// We need to manually resize the scroll bar whenever the window gets resized
|
||||||
qreal totalZoneHeight = zone->getOptimumRect().height();
|
resizeScrollbar(event->newSize().height() - extraHeight - 10);
|
||||||
qreal newWindowHeight = event->newSize().height();
|
}
|
||||||
qreal newZoneHeight = newWindowHeight - extraHeight - 10;
|
|
||||||
|
|
||||||
|
void ZoneViewWidget::resizeScrollbar(const qreal newZoneHeight)
|
||||||
|
{
|
||||||
|
qreal totalZoneHeight = zone->getOptimumRect().height();
|
||||||
scrollBar->setMaximum(totalZoneHeight - newZoneHeight);
|
scrollBar->setMaximum(totalZoneHeight - newZoneHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,6 +280,7 @@ void ZoneViewWidget::resizeToZoneContents()
|
||||||
qreal initialZoneHeight = qMin(zoneRect.height(), calcMaxInitialHeight());
|
qreal initialZoneHeight = qMin(zoneRect.height(), calcMaxInitialHeight());
|
||||||
QSizeF initialSize(width, initialZoneHeight + extraHeight + 10);
|
QSizeF initialSize(width, initialZoneHeight + extraHeight + 10);
|
||||||
resize(initialSize);
|
resize(initialSize);
|
||||||
|
resizeScrollbar(initialZoneHeight);
|
||||||
|
|
||||||
zone->setGeometry(QRectF(0, -scrollBar->value(), zoneContainer->size().width(), totalZoneHeight));
|
zone->setGeometry(QRectF(0, -scrollBar->value(), zoneContainer->size().width(), totalZoneHeight));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ private:
|
||||||
bool canBeShuffled;
|
bool canBeShuffled;
|
||||||
int extraHeight;
|
int extraHeight;
|
||||||
Player *player;
|
Player *player;
|
||||||
|
|
||||||
|
void resizeScrollbar(qreal newZoneHeight);
|
||||||
signals:
|
signals:
|
||||||
void closePressed(ZoneViewWidget *zv);
|
void closePressed(ZoneViewWidget *zv);
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue