Fix initializing alignment; this shouldn't use nullptr

This commit is contained in:
Martchus 2020-06-11 21:49:21 +02:00
parent ee7539cf6e
commit 8ee82c9a3c
1 changed files with 3 additions and 3 deletions

View File

@ -136,9 +136,9 @@ void cornerWidget(QWidget *widget, const QPoint *position)
{
const QPoint cursorPos(position ? *position : QCursor::pos());
const QRect availableGeometry(availableScreenGeometryAtPoint(cursorPos));
Qt::Alignment alignment = nullptr;
alignment |= (cursorPos.x() - availableGeometry.left() < availableGeometry.right() - cursorPos.x() ? Qt::AlignLeft : Qt::AlignRight);
alignment |= (cursorPos.y() - availableGeometry.top() < availableGeometry.bottom() - cursorPos.y() ? Qt::AlignTop : Qt::AlignBottom);
const Qt::Alignment alignment
= (cursorPos.x() - availableGeometry.left() < availableGeometry.right() - cursorPos.x() ? Qt::AlignLeft : Qt::AlignRight)
| (cursorPos.y() - availableGeometry.top() < availableGeometry.bottom() - cursorPos.y() ? Qt::AlignTop : Qt::AlignBottom);
widget->setGeometry(QStyle::alignedRect(Qt::LeftToRight, alignment, widget->size(), availableGeometry));
}