mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
make card view window max initial height configurable (#5236)
This commit is contained in:
parent
0463a6fd70
commit
a0f74134bb
7 changed files with 41 additions and 1 deletions
|
|
@ -254,6 +254,16 @@ void ZoneViewWidget::resizeEvent(QGraphicsSceneResizeEvent *event)
|
|||
scrollBar->setMaximum(totalZoneHeight - newZoneHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the max initial height from the settings.
|
||||
* The max initial height setting is given as number of rows, so we need to map it to a height.
|
||||
**/
|
||||
static qreal calcMaxInitialHeight()
|
||||
{
|
||||
const qreal cardsHeight = (SettingsCache::instance().getCardViewInitialRowsMax() + 1) * (CARD_HEIGHT / 3);
|
||||
return cardsHeight + 5; // +5 padding to make the cutoff look nicer
|
||||
}
|
||||
|
||||
void ZoneViewWidget::resizeToZoneContents()
|
||||
{
|
||||
QRectF zoneRect = zone->getOptimumRect();
|
||||
|
|
@ -265,7 +275,7 @@ void ZoneViewWidget::resizeToZoneContents()
|
|||
QSizeF maxSize(width, zoneRect.height() + extraHeight + 10);
|
||||
setMaximumSize(maxSize);
|
||||
|
||||
qreal initialZoneHeight = qMin(zoneRect.height(), 500.0);
|
||||
qreal initialZoneHeight = qMin(zoneRect.height(), calcMaxInitialHeight());
|
||||
QSizeF initialSize(width, initialZoneHeight + extraHeight + 10);
|
||||
resize(initialSize);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue