mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 08:52: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)
|
void ZoneViewWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->pos().y() <= 0) {
|
if (event->pos().y() <= 0) {
|
||||||
// expand window to full height and width if not currently at full height and width
|
qreal maxInitialHeight = calcMaxInitialHeight();
|
||||||
// otherwise shrink window to initial max height
|
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().getCardViewExpandedRowsMax());
|
||||||
if (size().height() < maximumHeight() || size().width() < maximumWidth()) {
|
qreal height = rect().height() - extraHeight - 10;
|
||||||
resize(maximumSize());
|
qreal maxHeight = maximumHeight() - extraHeight - 10;
|
||||||
} else {
|
|
||||||
|
// 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);
|
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