mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
refactor
This commit is contained in:
parent
0dfb88ba99
commit
6cb99415cc
1 changed files with 13 additions and 2 deletions
|
|
@ -258,14 +258,25 @@ void ZoneViewWidget::resizeScrollbar(const qreal newZoneHeight)
|
|||
scrollBar->setMaximum(newMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a height that is given as number of rows of cards to the actual height, given in pixels.
|
||||
*
|
||||
* @param rows Rows of cards
|
||||
* @return The height in pixels
|
||||
*/
|
||||
static qreal rowsToHeight(int rows)
|
||||
{
|
||||
const qreal cardsHeight = (rows + 1) * (CARD_HEIGHT / 3);
|
||||
return cardsHeight + 5; // +5 padding to make the cutoff look nicer
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
return rowsToHeight(SettingsCache::instance().getCardViewInitialRowsMax());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue