mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
implement feature
This commit is contained in:
parent
959a268f91
commit
0dfb88ba99
2 changed files with 17 additions and 3 deletions
|
|
@ -282,7 +282,7 @@ static qreal determineNewZoneHeight(qreal oldZoneHeight)
|
||||||
return calcMaxInitialHeight();
|
return calcMaxInitialHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewWidget::resizeToZoneContents()
|
void ZoneViewWidget::resizeToZoneContents(bool forceInitialHeight)
|
||||||
{
|
{
|
||||||
QRectF zoneRect = zone->getOptimumRect();
|
QRectF zoneRect = zone->getOptimumRect();
|
||||||
qreal totalZoneHeight = zoneRect.height();
|
qreal totalZoneHeight = zoneRect.height();
|
||||||
|
|
@ -293,7 +293,7 @@ void ZoneViewWidget::resizeToZoneContents()
|
||||||
QSizeF maxSize(width, zoneRect.height() + extraHeight + 10);
|
QSizeF maxSize(width, zoneRect.height() + extraHeight + 10);
|
||||||
|
|
||||||
qreal currentZoneHeight = rect().height() - extraHeight - 10;
|
qreal currentZoneHeight = rect().height() - extraHeight - 10;
|
||||||
qreal newZoneHeight = determineNewZoneHeight(currentZoneHeight);
|
qreal newZoneHeight = forceInitialHeight ? calcMaxInitialHeight() : determineNewZoneHeight(currentZoneHeight);
|
||||||
|
|
||||||
QSizeF initialSize(width, newZoneHeight + extraHeight + 10);
|
QSizeF initialSize(width, newZoneHeight + extraHeight + 10);
|
||||||
|
|
||||||
|
|
@ -335,3 +335,16 @@ void ZoneViewWidget::initStyleOption(QStyleOption *option) const
|
||||||
if (titleBar)
|
if (titleBar)
|
||||||
titleBar->icon = QPixmap("theme:cockatrice");
|
titleBar->icon = QPixmap("theme:cockatrice");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
resizeToZoneContents(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ private slots:
|
||||||
void processGroupBy(int value);
|
void processGroupBy(int value);
|
||||||
void processSortBy(int value);
|
void processSortBy(int value);
|
||||||
void processSetPileView(QT_STATE_CHANGED_T value);
|
void processSetPileView(QT_STATE_CHANGED_T value);
|
||||||
void resizeToZoneContents();
|
void resizeToZoneContents(bool forceInitialHeight = false);
|
||||||
void handleScrollBarChange(int value);
|
void handleScrollBarChange(int value);
|
||||||
void zoneDeleted();
|
void zoneDeleted();
|
||||||
void moveEvent(QGraphicsSceneMoveEvent * /* event */) override;
|
void moveEvent(QGraphicsSceneMoveEvent * /* event */) override;
|
||||||
|
|
@ -90,6 +90,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
void initStyleOption(QStyleOption *option) const override;
|
void initStyleOption(QStyleOption *option) const override;
|
||||||
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue