mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-04 12:33:55 -07:00
Lint.
This commit is contained in:
parent
d2f57ce309
commit
2f25f2c7d5
1 changed files with 8 additions and 8 deletions
|
|
@ -793,20 +793,20 @@ void UserListWidget::positionPopup(const QString &userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *vp = userTree->viewport();
|
QWidget *vp = userTree->viewport();
|
||||||
const QRect itemR = userTree->visualItemRect(item);
|
const QRect itemR = userTree->visualItemRect(item);
|
||||||
const QPoint itemTL = vp->mapToGlobal(itemR.topLeft());
|
const QPoint itemTL = vp->mapToGlobal(itemR.topLeft());
|
||||||
const QPoint vpTL = vp->mapToGlobal(vp->rect().topLeft());
|
const QPoint vpTL = vp->mapToGlobal(vp->rect().topLeft());
|
||||||
const QPoint vpTR = vp->mapToGlobal(vp->rect().topRight());
|
const QPoint vpTR = vp->mapToGlobal(vp->rect().topRight());
|
||||||
|
|
||||||
m_userInfoPopup->adjustSize();
|
m_userInfoPopup->adjustSize();
|
||||||
const int popW = m_userInfoPopup->width();
|
const int popW = m_userInfoPopup->width();
|
||||||
const int popH = m_userInfoPopup->height();
|
const int popH = m_userInfoPopup->height();
|
||||||
const int margin = 12;
|
const int margin = 12;
|
||||||
|
|
||||||
const QRect screen = QGuiApplication::primaryScreen()->availableGeometry();
|
const QRect screen = QGuiApplication::primaryScreen()->availableGeometry();
|
||||||
|
|
||||||
// ── X: prefer the side with more space ───────────────────────────────────
|
// ── X: prefer the side with more space ───────────────────────────────────
|
||||||
const int spaceLeft = vpTL.x() - screen.left() - margin;
|
const int spaceLeft = vpTL.x() - screen.left() - margin;
|
||||||
const int spaceRight = screen.right() - vpTR.x() - margin;
|
const int spaceRight = screen.right() - vpTR.x() - margin;
|
||||||
int x;
|
int x;
|
||||||
if (spaceLeft >= spaceRight) {
|
if (spaceLeft >= spaceRight) {
|
||||||
|
|
@ -817,13 +817,13 @@ void UserListWidget::positionPopup(const QString &userName)
|
||||||
x = qBound(screen.left() + margin, x, screen.right() - popW - margin);
|
x = qBound(screen.left() + margin, x, screen.right() - popW - margin);
|
||||||
|
|
||||||
// ── Y: grow down if there's room, otherwise grow up ───────────────────────
|
// ── Y: grow down if there's room, otherwise grow up ───────────────────────
|
||||||
const int itemTopY = itemTL.y();
|
const int itemTopY = itemTL.y();
|
||||||
const int spaceBelow = screen.bottom() - itemTopY - margin;
|
const int spaceBelow = screen.bottom() - itemTopY - margin;
|
||||||
const int spaceAbove = itemTopY - screen.top() - margin;
|
const int spaceAbove = itemTopY - screen.top() - margin;
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
if (spaceBelow >= popH) {
|
if (spaceBelow >= popH) {
|
||||||
y = itemTopY; // top edges align, popup grows downward
|
y = itemTopY; // top edges align, popup grows downward
|
||||||
} else if (spaceAbove >= popH) {
|
} else if (spaceAbove >= popH) {
|
||||||
y = itemTopY - popH; // bottom of popup meets top of item, grows upward
|
y = itemTopY - popH; // bottom of popup meets top of item, grows upward
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue