mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
implement thing again
This commit is contained in:
parent
5a72700a5c
commit
f7a8e53d18
1 changed files with 19 additions and 5 deletions
|
|
@ -350,12 +350,26 @@ void ZoneViewWidget::initStyleOption(QStyleOption *option) const
|
|||
void ZoneViewWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->pos().y() <= 0) {
|
||||
// expand window to full height and width if not currently at full height and width
|
||||
// otherwise shrink window to initial max height
|
||||
if (size().height() < maximumHeight() || size().width() < maximumWidth()) {
|
||||
resize(maximumSize());
|
||||
} else {
|
||||
qreal maxInitialHeight = calcMaxInitialHeight();
|
||||
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().getCardViewExpandedRowsMax());
|
||||
qreal height = rect().height() - extraHeight - 10;
|
||||
qreal maxHeight = maximumHeight() - extraHeight - 10;
|
||||
|
||||
// reset window to initial max height if...
|
||||
bool doResetSize =
|
||||
// current height is less than that
|
||||
(height < maxInitialHeight) ||
|
||||
// current height is at expanded max height
|
||||
(height == maxExpandedHeight) ||
|
||||
// current height is at actual max height, and actual max height is less than expanded max height
|
||||
(height == maxHeight && height > maxInitialHeight && height < maxExpandedHeight);
|
||||
|
||||
if (doResetSize) {
|
||||
resizeToZoneContents(true);
|
||||
} else {
|
||||
// expand/shrink window to expanded max height if current height is anywhere at or between initial max
|
||||
// height and actual max height
|
||||
resize(maximumSize().boundedTo({maximumWidth(), maxExpandedHeight + extraHeight + 10}));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue